Bug 827158 - Part 2: Rename nsDOMValidityState to mozilla::dom::ValidityState; r=bzbarsky
authorEhsan Akhgari <ehsan@mozilla.com>
Sun, 06 Jan 2013 14:20:02 -0500
changeset 119004 0a8c4b6efd8cdeb591504949cd3d0f567797770b
parent 119003 a28186bf974844a8e7fbbd6ed21395c1c0891177
child 119005 e3c728cb2119007e3ce1e94435ed1879c2d73226
push id21410
push usereakhgari@mozilla.com
push dateWed, 16 Jan 2013 06:16:08 +0000
treeherdermozilla-inbound@0a8c4b6efd8c [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/HTMLObjectElement.cpp
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		+= \
rename from content/html/content/src/nsDOMValidityState.cpp
rename to content/html/content/src/ValidityState.cpp
--- a/content/html/content/src/nsDOMValidityState.cpp
+++ b/content/html/content/src/ValidityState.cpp
@@ -1,89 +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 "nsDOMValidityState.h"
+#include "mozilla/dom/ValidityState.h"
 
 #include "nsDOMClassInfoID.h"
 
 
-DOMCI_DATA(ValidityState, nsDOMValidityState)
+DOMCI_DATA(ValidityState, mozilla::dom::ValidityState)
+
+namespace mozilla {
+namespace dom {
 
-NS_IMPL_ADDREF(nsDOMValidityState)
-NS_IMPL_RELEASE(nsDOMValidityState)
+NS_IMPL_ADDREF(ValidityState)
+NS_IMPL_RELEASE(ValidityState)
 
-NS_INTERFACE_MAP_BEGIN(nsDOMValidityState)
+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
 
-nsDOMValidityState::nsDOMValidityState(nsIConstraintValidation* aConstraintValidation)
+ValidityState::ValidityState(nsIConstraintValidation* aConstraintValidation)
   : mConstraintValidation(aConstraintValidation)
 {
 }
 
 NS_IMETHODIMP
-nsDOMValidityState::GetValueMissing(bool* aValueMissing)
+ValidityState::GetValueMissing(bool* aValueMissing)
 {
   *aValueMissing = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_VALUE_MISSING);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMValidityState::GetTypeMismatch(bool* aTypeMismatch)
+ValidityState::GetTypeMismatch(bool* aTypeMismatch)
 {
   *aTypeMismatch = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_TYPE_MISMATCH);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMValidityState::GetPatternMismatch(bool* aPatternMismatch)
+ValidityState::GetPatternMismatch(bool* aPatternMismatch)
 {
   *aPatternMismatch = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_PATTERN_MISMATCH);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMValidityState::GetTooLong(bool* aTooLong)
+ValidityState::GetTooLong(bool* aTooLong)
 {
   *aTooLong = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_TOO_LONG);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMValidityState::GetRangeUnderflow(bool* aRangeUnderflow)
+ValidityState::GetRangeUnderflow(bool* aRangeUnderflow)
 {
   *aRangeUnderflow = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_RANGE_UNDERFLOW);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMValidityState::GetRangeOverflow(bool* aRangeOverflow)
+ValidityState::GetRangeOverflow(bool* aRangeOverflow)
 {
   *aRangeOverflow = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_RANGE_OVERFLOW);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMValidityState::GetStepMismatch(bool* aStepMismatch)
+ValidityState::GetStepMismatch(bool* aStepMismatch)
 {
   *aStepMismatch = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_STEP_MISMATCH);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMValidityState::GetCustomError(bool* aCustomError)
+ValidityState::GetCustomError(bool* aCustomError)
 {
   *aCustomError = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_CUSTOM_ERROR);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMValidityState::GetValid(bool* aValid)
+ValidityState::GetValid(bool* aValid)
 {
   *aValid = !mConstraintValidation || mConstraintValidation->IsValid();
   return NS_OK;
 }
 
+} // namespace dom
+} // namespace mozilla
+
rename from content/html/content/src/nsDOMValidityState.h
rename to content/html/content/src/ValidityState.h
--- a/content/html/content/src/nsDOMValidityState.h
+++ b/content/html/content/src/ValidityState.h
@@ -1,30 +1,32 @@
 /* -*- 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__
+#ifndef mozilla_dom_ValidityState_h
+#define mozilla_dom_ValidityState_h
 
 #include "nsIDOMValidityState.h"
 #include "nsIConstraintValidation.h"
 
+namespace mozilla {
+namespace dom {
 
-class nsDOMValidityState MOZ_FINAL : public nsIDOMValidityState
+class ValidityState MOZ_FINAL : public nsIDOMValidityState
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIDOMVALIDITYSTATE
 
-  friend class nsIConstraintValidation;
+  friend class ::nsIConstraintValidation;
 
 protected:
-  nsDOMValidityState(nsIConstraintValidation* aConstraintValidation);
+  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()
   {
@@ -39,10 +41,13 @@ protected:
     return mConstraintValidation &&
            mConstraintValidation->GetValidityState(aState);
   }
 
   // Weak reference to owner which will call Disconnect() when being destroyed.
   nsIConstraintValidation*       mConstraintValidation;
 };
 
-#endif // nsDOMValidityState_h__
+} // namespace dom
+} // namespace mozilla
 
+#endif // mozilla_dom_ValidityState_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