Bug 827158 - Part 2: Rename nsDOMValidityState to mozilla::dom::ValidityState; r=bzbarsky
☠☠ backed out by 8c6a29d22334 ☠ ☠
authorEhsan Akhgari <ehsan@mozilla.com>
Sun, 06 Jan 2013 14:20:02 -0500
changeset 118999 4b3fc69a1893e0a50c4513592b2a26717a5cb5a5
parent 118998 a1c95996fc3e43bbd58f23a71a68808624654aaa
child 119000 8c6a29d2233494c11c91002ad771ab47eaf31c69
push id21407
push usereakhgari@mozilla.com
push dateWed, 16 Jan 2013 06:08:44 +0000
treeherdermozilla-inbound@4b3fc69a1893 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs827158
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 827158 - Part 2: Rename nsDOMValidityState to mozilla::dom::ValidityState; r=bzbarsky
content/html/content/public/nsIConstraintValidation.h
content/html/content/src/Makefile.in
content/html/content/src/ValidityState.cpp
content/html/content/src/ValidityState.h
content/html/content/src/nsDOMValidityState.cpp
content/html/content/src/nsDOMValidityState.h
content/html/content/src/nsIConstraintValidation.cpp
--- a/content/html/content/public/nsIConstraintValidation.h
+++ b/content/html/content/public/nsIConstraintValidation.h
@@ -5,19 +5,24 @@
 
 #ifndef nsIConstraintValidition_h___
 #define nsIConstraintValidition_h___
 
 #include "nsISupports.h"
 #include "nsAutoPtr.h"
 #include "nsString.h"
 
-class nsDOMValidityState;
 class nsIDOMValidityState;
 
+namespace mozilla {
+namespace dom {
+class ValidityState;
+}
+}
+
 #define NS_ICONSTRAINTVALIDATION_IID \
 { 0xca3824dc, 0x4f5c, 0x4878, \
  { 0xa6, 0x8a, 0x95, 0x54, 0x5f, 0xfa, 0x4b, 0xf9 } }
 
 /**
  * This interface is for form elements implementing the validity constraint API.
  * See: http://dev.w3.org/html5/spec/forms.html#the-constraint-validation-api
  *
@@ -25,17 +30,17 @@ class nsIDOMValidityState;
  * and only them.
  */
 class nsIConstraintValidation : public nsISupports
 {
 public:
 
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONSTRAINTVALIDATION_IID);
 
-  friend class nsDOMValidityState;
+  friend class mozilla::dom::ValidityState;
 
   static const uint16_t sContentSpecifiedMaxLengthMessage;
 
   virtual ~nsIConstraintValidation();
 
   bool IsValid() const { return mValidityBitField == 0; }
 
   bool IsCandidateForConstraintValidation() const {
@@ -85,17 +90,17 @@ private:
    * A bitfield representing the current validity state of the element.
    * Each bit represent an error. All bits to zero means the element is valid.
    */
   int8_t                        mValidityBitField;
 
   /**
    * A pointer to the ValidityState object.
    */
-  nsRefPtr<nsDOMValidityState>  mValidity;
+  nsRefPtr<mozilla::dom::ValidityState>  mValidity;
 
   /**
    * Keeps track whether the element is barred from constraint validation.
    */
   bool                          mBarredFromConstraintValidation;
 
   /**
    * The string representing the custom error.
--- a/content/html/content/src/Makefile.in
+++ b/content/html/content/src/Makefile.in
@@ -49,16 +49,17 @@ EXPORTS_mozilla/dom = \
 		HTMLTableCellElement.h \
 		HTMLTableColElement.h \
 		HTMLTableElement.h \
 		HTMLTableRowElement.h \
 		HTMLTableSectionElement.h \
 		HTMLTitleElement.h \
 		HTMLUnknownElement.h \
 		UndoManager.h \
+		ValidityState.h \
 		$(NULL)
 
 CPPSRCS		= \
 		HTMLPropertiesCollection.cpp \
 		nsClientRect.cpp \
 		nsHTMLDNSPrefetch.cpp \
 		nsGenericHTMLElement.cpp \
 		nsGenericHTMLFrameElement.cpp \
@@ -111,17 +112,17 @@ CPPSRCS		= \
 		HTMLTableCaptionElement.cpp \
 		HTMLTableCellElement.cpp \
 		HTMLTableColElement.cpp \
 		HTMLTableRowElement.cpp \
 		HTMLTableSectionElement.cpp \
 		nsHTMLTextAreaElement.cpp \
 		HTMLTitleElement.cpp \
 		HTMLUnknownElement.cpp \
-		nsDOMValidityState.cpp \
+		ValidityState.cpp \
 		nsIConstraintValidation.cpp \
 		nsRadioVisitor.cpp \
 		nsDOMStringMap.cpp \
 		UndoManager.cpp \
 		$(NULL)
 
 ifdef MOZ_MEDIA
 CPPSRCS		+= \
new file mode 100644
--- /dev/null
+++ b/content/html/content/src/ValidityState.cpp
@@ -0,0 +1,95 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "mozilla/dom/ValidityState.h"
+
+#include "nsDOMClassInfoID.h"
+
+
+DOMCI_DATA(ValidityState, mozilla::dom::ValidityState)
+
+namespace mozilla {
+namespace dom {
+
+NS_IMPL_ADDREF(ValidityState)
+NS_IMPL_RELEASE(ValidityState)
+
+NS_INTERFACE_MAP_BEGIN(ValidityState)
+  NS_INTERFACE_MAP_ENTRY(nsIDOMValidityState)
+  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMValidityState)
+  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(ValidityState)
+NS_INTERFACE_MAP_END
+
+ValidityState::ValidityState(nsIConstraintValidation* aConstraintValidation)
+  : mConstraintValidation(aConstraintValidation)
+{
+}
+
+NS_IMETHODIMP
+ValidityState::GetValueMissing(bool* aValueMissing)
+{
+  *aValueMissing = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_VALUE_MISSING);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+ValidityState::GetTypeMismatch(bool* aTypeMismatch)
+{
+  *aTypeMismatch = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_TYPE_MISMATCH);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+ValidityState::GetPatternMismatch(bool* aPatternMismatch)
+{
+  *aPatternMismatch = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_PATTERN_MISMATCH);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+ValidityState::GetTooLong(bool* aTooLong)
+{
+  *aTooLong = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_TOO_LONG);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+ValidityState::GetRangeUnderflow(bool* aRangeUnderflow)
+{
+  *aRangeUnderflow = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_RANGE_UNDERFLOW);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+ValidityState::GetRangeOverflow(bool* aRangeOverflow)
+{
+  *aRangeOverflow = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_RANGE_OVERFLOW);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+ValidityState::GetStepMismatch(bool* aStepMismatch)
+{
+  *aStepMismatch = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_STEP_MISMATCH);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+ValidityState::GetCustomError(bool* aCustomError)
+{
+  *aCustomError = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_CUSTOM_ERROR);
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+ValidityState::GetValid(bool* aValid)
+{
+  *aValid = !mConstraintValidation || mConstraintValidation->IsValid();
+  return NS_OK;
+}
+
+} // namespace dom
+} // namespace mozilla
+
new file mode 100644
--- /dev/null
+++ b/content/html/content/src/ValidityState.h
@@ -0,0 +1,53 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_dom_ValidityState_h
+#define mozilla_dom_ValidityState_h
+
+#include "nsIDOMValidityState.h"
+#include "nsIConstraintValidation.h"
+
+namespace mozilla {
+namespace dom {
+
+class ValidityState MOZ_FINAL : public nsIDOMValidityState
+{
+public:
+  NS_DECL_ISUPPORTS
+  NS_DECL_NSIDOMVALIDITYSTATE
+
+  friend class ::nsIConstraintValidation;
+
+protected:
+  ValidityState(nsIConstraintValidation* aConstraintValidation);
+
+  /**
+   * This function should be called by nsIConstraintValidation
+   * to set mConstraintValidation to null to be sure
+   * it will not be used when the object is destroyed.
+   */
+  inline void Disconnect()
+  {
+    mConstraintValidation = nullptr;
+  }
+
+  /**
+   * Helper function to get a validity state from constraint validation instance.
+   */
+  inline bool GetValidityState(nsIConstraintValidation::ValidityStateType aState) const
+  {
+    return mConstraintValidation &&
+           mConstraintValidation->GetValidityState(aState);
+  }
+
+  // Weak reference to owner which will call Disconnect() when being destroyed.
+  nsIConstraintValidation*       mConstraintValidation;
+};
+
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_ValidityState_h
+
deleted file mode 100644
--- a/content/html/content/src/nsDOMValidityState.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsDOMValidityState.h"
-
-#include "nsDOMClassInfoID.h"
-
-
-DOMCI_DATA(ValidityState, nsDOMValidityState)
-
-NS_IMPL_ADDREF(nsDOMValidityState)
-NS_IMPL_RELEASE(nsDOMValidityState)
-
-NS_INTERFACE_MAP_BEGIN(nsDOMValidityState)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMValidityState)
-  NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMValidityState)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(ValidityState)
-NS_INTERFACE_MAP_END
-
-nsDOMValidityState::nsDOMValidityState(nsIConstraintValidation* aConstraintValidation)
-  : mConstraintValidation(aConstraintValidation)
-{
-}
-
-NS_IMETHODIMP
-nsDOMValidityState::GetValueMissing(bool* aValueMissing)
-{
-  *aValueMissing = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_VALUE_MISSING);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMValidityState::GetTypeMismatch(bool* aTypeMismatch)
-{
-  *aTypeMismatch = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_TYPE_MISMATCH);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMValidityState::GetPatternMismatch(bool* aPatternMismatch)
-{
-  *aPatternMismatch = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_PATTERN_MISMATCH);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMValidityState::GetTooLong(bool* aTooLong)
-{
-  *aTooLong = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_TOO_LONG);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMValidityState::GetRangeUnderflow(bool* aRangeUnderflow)
-{
-  *aRangeUnderflow = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_RANGE_UNDERFLOW);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMValidityState::GetRangeOverflow(bool* aRangeOverflow)
-{
-  *aRangeOverflow = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_RANGE_OVERFLOW);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMValidityState::GetStepMismatch(bool* aStepMismatch)
-{
-  *aStepMismatch = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_STEP_MISMATCH);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMValidityState::GetCustomError(bool* aCustomError)
-{
-  *aCustomError = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_CUSTOM_ERROR);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMValidityState::GetValid(bool* aValid)
-{
-  *aValid = !mConstraintValidation || mConstraintValidation->IsValid();
-  return NS_OK;
-}
-
deleted file mode 100644
--- a/content/html/content/src/nsDOMValidityState.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef nsDOMValidityState_h__
-#define nsDOMValidityState_h__
-
-#include "nsIDOMValidityState.h"
-#include "nsIConstraintValidation.h"
-
-
-class nsDOMValidityState MOZ_FINAL : public nsIDOMValidityState
-{
-public:
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIDOMVALIDITYSTATE
-
-  friend class nsIConstraintValidation;
-
-protected:
-  nsDOMValidityState(nsIConstraintValidation* aConstraintValidation);
-
-  /**
-   * This function should be called by nsIConstraintValidation
-   * to set mConstraintValidation to null to be sure
-   * it will not be used when the object is destroyed.
-   */
-  inline void Disconnect()
-  {
-    mConstraintValidation = nullptr;
-  }
-
-  /**
-   * Helper function to get a validity state from constraint validation instance.
-   */
-  inline bool GetValidityState(nsIConstraintValidation::ValidityStateType aState) const
-  {
-    return mConstraintValidation &&
-           mConstraintValidation->GetValidityState(aState);
-  }
-
-  // Weak reference to owner which will call Disconnect() when being destroyed.
-  nsIConstraintValidation*       mConstraintValidation;
-};
-
-#endif // nsDOMValidityState_h__
-
--- a/content/html/content/src/nsIConstraintValidation.cpp
+++ b/content/html/content/src/nsIConstraintValidation.cpp
@@ -3,17 +3,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsIConstraintValidation.h"
 
 #include "nsAString.h"
 #include "nsGenericHTMLElement.h"
 #include "nsHTMLFormElement.h"
-#include "nsDOMValidityState.h"
+#include "mozilla/dom/ValidityState.h"
 #include "nsIFormControl.h"
 #include "nsContentUtils.h"
 
 const uint16_t nsIConstraintValidation::sContentSpecifiedMaxLengthMessage = 256;
 
 nsIConstraintValidation::nsIConstraintValidation()
   : mValidityBitField(0)
   , mValidity(nullptr)
@@ -28,17 +28,17 @@ nsIConstraintValidation::~nsIConstraintV
     mValidity->Disconnect();
   }
 }
 
 nsresult
 nsIConstraintValidation::GetValidity(nsIDOMValidityState** aValidity)
 {
   if (!mValidity) {
-    mValidity = new nsDOMValidityState(this);
+    mValidity = new mozilla::dom::ValidityState(this);
   }
 
   NS_ADDREF(*aValidity = mValidity);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP