ValidityState.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "mozilla/dom/ValidityState.h"
  6. #include "mozilla/dom/ValidityStateBinding.h"
  7. #include "nsCycleCollectionParticipant.h"
  8. namespace mozilla {
  9. namespace dom {
  10. NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(ValidityState, mConstraintValidation)
  11. NS_IMPL_CYCLE_COLLECTING_ADDREF(ValidityState)
  12. NS_IMPL_CYCLE_COLLECTING_RELEASE(ValidityState)
  13. NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ValidityState)
  14. NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
  15. NS_INTERFACE_MAP_ENTRY(nsIDOMValidityState)
  16. NS_INTERFACE_MAP_ENTRY(nsISupports)
  17. NS_INTERFACE_MAP_END
  18. ValidityState::ValidityState(nsIConstraintValidation* aConstraintValidation)
  19. : mConstraintValidation(aConstraintValidation)
  20. {
  21. }
  22. NS_IMETHODIMP
  23. ValidityState::GetValueMissing(bool* aValueMissing)
  24. {
  25. *aValueMissing = ValueMissing();
  26. return NS_OK;
  27. }
  28. NS_IMETHODIMP
  29. ValidityState::GetTypeMismatch(bool* aTypeMismatch)
  30. {
  31. *aTypeMismatch = TypeMismatch();
  32. return NS_OK;
  33. }
  34. NS_IMETHODIMP
  35. ValidityState::GetPatternMismatch(bool* aPatternMismatch)
  36. {
  37. *aPatternMismatch = PatternMismatch();
  38. return NS_OK;
  39. }
  40. NS_IMETHODIMP
  41. ValidityState::GetTooLong(bool* aTooLong)
  42. {
  43. *aTooLong = TooLong();
  44. return NS_OK;
  45. }
  46. NS_IMETHODIMP
  47. ValidityState::GetTooShort(bool* aTooShort)
  48. {
  49. *aTooShort = TooShort();
  50. return NS_OK;
  51. }
  52. NS_IMETHODIMP
  53. ValidityState::GetRangeUnderflow(bool* aRangeUnderflow)
  54. {
  55. *aRangeUnderflow = RangeUnderflow();
  56. return NS_OK;
  57. }
  58. NS_IMETHODIMP
  59. ValidityState::GetRangeOverflow(bool* aRangeOverflow)
  60. {
  61. *aRangeOverflow = RangeOverflow();
  62. return NS_OK;
  63. }
  64. NS_IMETHODIMP
  65. ValidityState::GetStepMismatch(bool* aStepMismatch)
  66. {
  67. *aStepMismatch = StepMismatch();
  68. return NS_OK;
  69. }
  70. NS_IMETHODIMP
  71. ValidityState::GetBadInput(bool* aBadInput)
  72. {
  73. *aBadInput = BadInput();
  74. return NS_OK;
  75. }
  76. NS_IMETHODIMP
  77. ValidityState::GetCustomError(bool* aCustomError)
  78. {
  79. *aCustomError = CustomError();
  80. return NS_OK;
  81. }
  82. NS_IMETHODIMP
  83. ValidityState::GetValid(bool* aValid)
  84. {
  85. *aValid = Valid();
  86. return NS_OK;
  87. }
  88. JSObject*
  89. ValidityState::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
  90. {
  91. return ValidityStateBinding::Wrap(aCx, this, aGivenProto);
  92. }
  93. } // namespace dom
  94. } // namespace mozilla