Bug 827158 - Part 2: Rename nsDOMValidityState to mozilla::dom::ValidityState; r=bzbarsky

This commit is contained in:
Ehsan Akhgari 2013-01-06 14:20:02 -05:00
parent 34c375426a
commit 05d64ee278
5 changed files with 44 additions and 27 deletions

View File

@ -10,9 +10,14 @@
#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 } }
@ -30,7 +35,7 @@ public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONSTRAINTVALIDATION_IID);
friend class nsDOMValidityState;
friend class mozilla::dom::ValidityState;
static const uint16_t sContentSpecifiedMaxLengthMessage;
@ -90,7 +95,7 @@ private:
/**
* A pointer to the ValidityState object.
*/
nsRefPtr<nsDOMValidityState> mValidity;
nsRefPtr<mozilla::dom::ValidityState> mValidity;
/**
* Keeps track whether the element is barred from constraint validation.

View File

@ -54,6 +54,7 @@ EXPORTS_mozilla/dom = \
HTMLTitleElement.h \
HTMLUnknownElement.h \
UndoManager.h \
ValidityState.h \
$(NULL)
CPPSRCS = \
@ -116,7 +117,7 @@ CPPSRCS = \
nsHTMLTextAreaElement.cpp \
HTMLTitleElement.cpp \
HTMLUnknownElement.cpp \
nsDOMValidityState.cpp \
ValidityState.cpp \
nsIConstraintValidation.cpp \
nsRadioVisitor.cpp \
nsDOMStringMap.cpp \

View File

@ -3,87 +3,93 @@
* 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)
NS_IMPL_ADDREF(nsDOMValidityState)
NS_IMPL_RELEASE(nsDOMValidityState)
namespace mozilla {
namespace dom {
NS_INTERFACE_MAP_BEGIN(nsDOMValidityState)
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
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

View File

@ -3,23 +3,25 @@
* 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
@ -44,5 +46,8 @@ protected:
nsIConstraintValidation* mConstraintValidation;
};
#endif // nsDOMValidityState_h__
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_ValidityState_h

View File

@ -8,7 +8,7 @@
#include "nsAString.h"
#include "nsGenericHTMLElement.h"
#include "nsHTMLFormElement.h"
#include "nsDOMValidityState.h"
#include "mozilla/dom/ValidityState.h"
#include "nsIFormControl.h"
#include "nsContentUtils.h"
@ -33,7 +33,7 @@ nsresult
nsIConstraintValidation::GetValidity(nsIDOMValidityState** aValidity)
{
if (!mValidity) {
mValidity = new nsDOMValidityState(this);
mValidity = new mozilla::dom::ValidityState(this);
}
NS_ADDREF(*aValidity = mValidity);