зеркало из https://github.com/mozilla/pjs.git
Bug 561634 - Rename nsConstraintValidation to nsIConstraintValidation. r=sicking a2.0=blocking
--HG-- rename : content/html/content/src/nsConstraintValidation.cpp => content/html/content/src/nsIConstraintValidation.cpp rename : content/html/content/src/nsConstraintValidation.h => content/html/content/src/nsIConstraintValidation.h
This commit is contained in:
Родитель
00b52d9848
Коммит
37ee17acc8
|
@ -113,7 +113,7 @@ CPPSRCS = \
|
|||
nsHTMLTimeRanges.cpp \
|
||||
nsHTMLTitleElement.cpp \
|
||||
nsDOMValidityState.cpp \
|
||||
nsConstraintValidation.cpp \
|
||||
nsIConstraintValidation.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_MEDIA
|
||||
|
|
|
@ -51,7 +51,7 @@ NS_INTERFACE_MAP_BEGIN(nsDOMValidityState)
|
|||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(ValidityState)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
nsDOMValidityState::nsDOMValidityState(nsConstraintValidation* aConstraintValidation)
|
||||
nsDOMValidityState::nsDOMValidityState(nsIConstraintValidation* aConstraintValidation)
|
||||
: mConstraintValidation(aConstraintValidation)
|
||||
{
|
||||
}
|
||||
|
@ -59,56 +59,56 @@ nsDOMValidityState::nsDOMValidityState(nsConstraintValidation* aConstraintValida
|
|||
NS_IMETHODIMP
|
||||
nsDOMValidityState::GetValueMissing(PRBool* aValueMissing)
|
||||
{
|
||||
*aValueMissing = GetValidityState(nsConstraintValidation::VALIDITY_STATE_VALUE_MISSING);
|
||||
*aValueMissing = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_VALUE_MISSING);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMValidityState::GetTypeMismatch(PRBool* aTypeMismatch)
|
||||
{
|
||||
*aTypeMismatch = GetValidityState(nsConstraintValidation::VALIDITY_STATE_TYPE_MISMATCH);
|
||||
*aTypeMismatch = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_TYPE_MISMATCH);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMValidityState::GetPatternMismatch(PRBool* aPatternMismatch)
|
||||
{
|
||||
*aPatternMismatch = GetValidityState(nsConstraintValidation::VALIDITY_STATE_PATTERN_MISMATCH);
|
||||
*aPatternMismatch = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_PATTERN_MISMATCH);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMValidityState::GetTooLong(PRBool* aTooLong)
|
||||
{
|
||||
*aTooLong = GetValidityState(nsConstraintValidation::VALIDITY_STATE_TOO_LONG);
|
||||
*aTooLong = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_TOO_LONG);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMValidityState::GetRangeUnderflow(PRBool* aRangeUnderflow)
|
||||
{
|
||||
*aRangeUnderflow = GetValidityState(nsConstraintValidation::VALIDITY_STATE_RANGE_UNDERFLOW);
|
||||
*aRangeUnderflow = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_RANGE_UNDERFLOW);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMValidityState::GetRangeOverflow(PRBool* aRangeOverflow)
|
||||
{
|
||||
*aRangeOverflow = GetValidityState(nsConstraintValidation::VALIDITY_STATE_RANGE_OVERFLOW);
|
||||
*aRangeOverflow = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_RANGE_OVERFLOW);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMValidityState::GetStepMismatch(PRBool* aStepMismatch)
|
||||
{
|
||||
*aStepMismatch = GetValidityState(nsConstraintValidation::VALIDITY_STATE_STEP_MISMATCH);
|
||||
*aStepMismatch = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_STEP_MISMATCH);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMValidityState::GetCustomError(PRBool* aCustomError)
|
||||
{
|
||||
*aCustomError = GetValidityState(nsConstraintValidation::VALIDITY_STATE_CUSTOM_ERROR);
|
||||
*aCustomError = GetValidityState(nsIConstraintValidation::VALIDITY_STATE_CUSTOM_ERROR);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#define nsDOMValidityState_h__
|
||||
|
||||
#include "nsIDOMValidityState.h"
|
||||
#include "nsConstraintValidation.h"
|
||||
#include "nsIConstraintValidation.h"
|
||||
|
||||
|
||||
class nsDOMValidityState : public nsIDOMValidityState
|
||||
|
@ -48,13 +48,13 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDOMVALIDITYSTATE
|
||||
|
||||
friend class nsConstraintValidation;
|
||||
friend class nsIConstraintValidation;
|
||||
|
||||
protected:
|
||||
nsDOMValidityState(nsConstraintValidation* aConstraintValidation);
|
||||
nsDOMValidityState(nsIConstraintValidation* aConstraintValidation);
|
||||
|
||||
/**
|
||||
* This function should be called by nsConstraintValidation
|
||||
* 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.
|
||||
*/
|
||||
|
@ -66,14 +66,14 @@ protected:
|
|||
/**
|
||||
* Helper function to get a validity state from constraint validation instance.
|
||||
*/
|
||||
inline PRBool GetValidityState(nsConstraintValidation::ValidityStateType aState) const
|
||||
inline PRBool GetValidityState(nsIConstraintValidation::ValidityStateType aState) const
|
||||
{
|
||||
return mConstraintValidation &&
|
||||
mConstraintValidation->GetValidityState(aState);
|
||||
}
|
||||
|
||||
// Weak reference to owner which will call Disconnect() when being destroyed.
|
||||
nsConstraintValidation* mConstraintValidation;
|
||||
nsIConstraintValidation* mConstraintValidation;
|
||||
};
|
||||
|
||||
#endif // nsDOMValidityState_h__
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
#include "nsLayoutErrors.h"
|
||||
#include "nsFocusManager.h"
|
||||
#include "nsHTMLFormElement.h"
|
||||
#include "nsConstraintValidation.h"
|
||||
#include "nsIConstraintValidation.h"
|
||||
|
||||
#define NS_IN_SUBMIT_CLICK (1 << 0)
|
||||
#define NS_OUTER_ACTIVATE_EVENT (1 << 1)
|
||||
|
@ -79,7 +79,7 @@ static const nsAttrValue::EnumTable* kButtonDefaultType = &kButtonTypeTable[2];
|
|||
|
||||
class nsHTMLButtonElement : public nsGenericHTMLFormElement,
|
||||
public nsIDOMHTMLButtonElement,
|
||||
public nsConstraintValidation
|
||||
public nsIConstraintValidation
|
||||
{
|
||||
public:
|
||||
nsHTMLButtonElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
@ -133,7 +133,7 @@ public:
|
|||
virtual void DoneCreatingElement();
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
// nsConstraintValidation
|
||||
// nsIConstraintValidation
|
||||
PRBool IsBarredFromConstraintValidation() const;
|
||||
|
||||
protected:
|
||||
|
@ -185,13 +185,13 @@ DOMCI_NODE_DATA(HTMLButtonElement, nsHTMLButtonElement)
|
|||
NS_INTERFACE_TABLE_HEAD(nsHTMLButtonElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE2(nsHTMLButtonElement,
|
||||
nsIDOMHTMLButtonElement,
|
||||
nsConstraintValidation)
|
||||
nsIConstraintValidation)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLButtonElement,
|
||||
nsGenericHTMLFormElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLButtonElement)
|
||||
|
||||
// nsConstraintValidation
|
||||
NS_IMPL_NSCONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(nsHTMLButtonElement)
|
||||
// nsIConstraintValidation
|
||||
NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(nsHTMLButtonElement)
|
||||
|
||||
// nsIDOMHTMLButtonElement
|
||||
|
||||
|
@ -671,12 +671,12 @@ nsHTMLButtonElement::IntrinsicState() const
|
|||
return state | NS_EVENT_STATE_OPTIONAL;
|
||||
}
|
||||
|
||||
// nsConstraintValidation
|
||||
// nsIConstraintValidation
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLButtonElement::SetCustomValidity(const nsAString& aError)
|
||||
{
|
||||
nsConstraintValidation::SetCustomValidity(aError);
|
||||
nsIConstraintValidation::SetCustomValidity(aError);
|
||||
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (doc) {
|
||||
|
|
|
@ -41,12 +41,12 @@
|
|||
#include "nsStyleConsts.h"
|
||||
#include "nsIForm.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsConstraintValidation.h"
|
||||
#include "nsIConstraintValidation.h"
|
||||
|
||||
|
||||
class nsHTMLFieldSetElement : public nsGenericHTMLFormElement,
|
||||
public nsIDOMHTMLFieldSetElement,
|
||||
public nsConstraintValidation
|
||||
public nsIConstraintValidation
|
||||
{
|
||||
public:
|
||||
nsHTMLFieldSetElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
@ -74,7 +74,7 @@ public:
|
|||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
// nsConstraintValidation
|
||||
// nsIConstraintValidation
|
||||
PRBool IsBarredFromConstraintValidation() const { return PR_TRUE; };
|
||||
};
|
||||
|
||||
|
@ -104,7 +104,7 @@ DOMCI_NODE_DATA(HTMLFieldSetElement, nsHTMLFieldSetElement)
|
|||
NS_INTERFACE_TABLE_HEAD(nsHTMLFieldSetElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE2(nsHTMLFieldSetElement,
|
||||
nsIDOMHTMLFieldSetElement,
|
||||
nsConstraintValidation)
|
||||
nsIConstraintValidation)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLFieldSetElement,
|
||||
nsGenericHTMLFormElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLFieldSetElement)
|
||||
|
@ -112,8 +112,8 @@ NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLFieldSetElement)
|
|||
|
||||
// nsIDOMHTMLFieldSetElement
|
||||
|
||||
// nsConstraintValidation
|
||||
NS_IMPL_NSCONSTRAINTVALIDATION(nsHTMLFieldSetElement)
|
||||
// nsIConstraintValidation
|
||||
NS_IMPL_NSICONSTRAINTVALIDATION(nsHTMLFieldSetElement)
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE(nsHTMLFieldSetElement)
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsIHTMLCollection.h"
|
||||
|
||||
#include "nsConstraintValidation.h"
|
||||
#include "nsIConstraintValidation.h"
|
||||
|
||||
static const int NS_FORM_CONTROL_LIST_HASHTABLE_SIZE = 16;
|
||||
|
||||
|
@ -1579,7 +1579,7 @@ nsHTMLFormElement::CheckFormValidity() const
|
|||
continue;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsConstraintValidation> cvElmt =
|
||||
nsCOMPtr<nsIConstraintValidation> cvElmt =
|
||||
do_QueryInterface((nsGenericHTMLElement*)sortedControls[i]);
|
||||
if (cvElmt && cvElmt->IsCandidateForConstraintValidation() &&
|
||||
!cvElmt->IsValid()) {
|
||||
|
|
|
@ -306,13 +306,13 @@ NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLInputElement)
|
|||
nsIImageLoadingContent,
|
||||
imgIContainerObserver,
|
||||
nsIDOMNSEditableElement,
|
||||
nsConstraintValidation)
|
||||
nsIConstraintValidation)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLInputElement,
|
||||
nsGenericHTMLFormElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLInputElement)
|
||||
|
||||
// nsConstraintValidation
|
||||
NS_IMPL_NSCONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(nsHTMLInputElement)
|
||||
// nsIConstraintValidation
|
||||
NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(nsHTMLInputElement)
|
||||
|
||||
// nsIDOMNode
|
||||
|
||||
|
@ -3178,12 +3178,12 @@ nsHTMLInputElement::DoesPatternApply() const
|
|||
return IsSingleLineTextControl(PR_FALSE);
|
||||
}
|
||||
|
||||
// nsConstraintValidation
|
||||
// nsIConstraintValidation
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLInputElement::SetCustomValidity(const nsAString& aError)
|
||||
{
|
||||
nsConstraintValidation::SetCustomValidity(aError);
|
||||
nsIConstraintValidation::SetCustomValidity(aError);
|
||||
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (doc) {
|
||||
|
@ -3449,7 +3449,7 @@ nsHTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
|
|||
break;
|
||||
}
|
||||
default:
|
||||
rv = nsConstraintValidation::GetValidationMessage(aValidationMessage, aType);
|
||||
rv = nsIConstraintValidation::GetValidationMessage(aValidationMessage, aType);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
#include "nsTextEditorState.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsConstraintValidation.h"
|
||||
#include "nsIConstraintValidation.h"
|
||||
|
||||
//
|
||||
// Accessors for mBitField
|
||||
|
@ -82,7 +82,7 @@ class nsHTMLInputElement : public nsGenericHTMLFormElement,
|
|||
public nsIPhonetic,
|
||||
public nsIDOMNSEditableElement,
|
||||
public nsIFileControlElement,
|
||||
public nsConstraintValidation
|
||||
public nsIConstraintValidation
|
||||
{
|
||||
public:
|
||||
nsHTMLInputElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
|
@ -211,7 +211,7 @@ public:
|
|||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
// nsConstraintValidation
|
||||
// nsIConstraintValidation
|
||||
PRBool IsTooLong();
|
||||
PRBool IsValueMissing();
|
||||
PRBool HasTypeMismatch();
|
||||
|
|
|
@ -40,13 +40,13 @@
|
|||
#include "nsFormSubmission.h"
|
||||
#include "nsDOMSettableTokenList.h"
|
||||
#include "nsStubMutationObserver.h"
|
||||
#include "nsConstraintValidation.h"
|
||||
#include "nsIConstraintValidation.h"
|
||||
|
||||
|
||||
class nsHTMLOutputElement : public nsGenericHTMLFormElement,
|
||||
public nsIDOMHTMLOutputElement,
|
||||
public nsStubMutationObserver,
|
||||
public nsConstraintValidation
|
||||
public nsIConstraintValidation
|
||||
{
|
||||
public:
|
||||
nsHTMLOutputElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
@ -81,7 +81,7 @@ public:
|
|||
// has to be used to update the defaultValue attribute.
|
||||
void DescendantsChanged();
|
||||
|
||||
// nsConstraintValidation
|
||||
// nsIConstraintValidation
|
||||
PRBool IsBarredFromConstraintValidation() const { return PR_TRUE; }
|
||||
|
||||
// nsIMutationObserver
|
||||
|
@ -133,7 +133,7 @@ NS_INTERFACE_TABLE_HEAD(nsHTMLOutputElement)
|
|||
NS_HTML_CONTENT_INTERFACE_TABLE3(nsHTMLOutputElement,
|
||||
nsIDOMHTMLOutputElement,
|
||||
nsIMutationObserver,
|
||||
nsConstraintValidation)
|
||||
nsIConstraintValidation)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLOutputElement,
|
||||
nsGenericHTMLFormElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLOutputElement)
|
||||
|
@ -143,8 +143,8 @@ NS_IMPL_ELEMENT_CLONE(nsHTMLOutputElement)
|
|||
|
||||
NS_IMPL_STRING_ATTR(nsHTMLOutputElement, Name, name)
|
||||
|
||||
// nsConstraintValidation
|
||||
NS_IMPL_NSCONSTRAINTVALIDATION(nsHTMLOutputElement)
|
||||
// nsIConstraintValidation
|
||||
NS_IMPL_NSICONSTRAINTVALIDATION(nsHTMLOutputElement)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLOutputElement::Reset()
|
||||
|
|
|
@ -184,7 +184,7 @@ NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLSelectElement)
|
|||
NS_HTML_CONTENT_INTERFACE_TABLE3(nsHTMLSelectElement,
|
||||
nsIDOMHTMLSelectElement,
|
||||
nsISelectElement,
|
||||
nsConstraintValidation)
|
||||
nsIConstraintValidation)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLSelectElement,
|
||||
nsGenericHTMLFormElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLSelectElement)
|
||||
|
@ -195,13 +195,13 @@ NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLSelectElement)
|
|||
|
||||
NS_IMPL_ELEMENT_CLONE(nsHTMLSelectElement)
|
||||
|
||||
// nsConstraintValidation
|
||||
NS_IMPL_NSCONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(nsHTMLSelectElement)
|
||||
// nsIConstraintValidation
|
||||
NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(nsHTMLSelectElement)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLSelectElement::SetCustomValidity(const nsAString& aError)
|
||||
{
|
||||
nsConstraintValidation::SetCustomValidity(aError);
|
||||
nsIConstraintValidation::SetCustomValidity(aError);
|
||||
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (doc) {
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
#include "nsISelectControlFrame.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsIHTMLCollection.h"
|
||||
#include "nsConstraintValidation.h"
|
||||
#include "nsIConstraintValidation.h"
|
||||
|
||||
// PresState
|
||||
#include "nsXPCOM.h"
|
||||
|
@ -238,7 +238,7 @@ private:
|
|||
class nsHTMLSelectElement : public nsGenericHTMLFormElement,
|
||||
public nsIDOMHTMLSelectElement,
|
||||
public nsISelectElement,
|
||||
public nsConstraintValidation
|
||||
public nsIConstraintValidation
|
||||
{
|
||||
public:
|
||||
nsHTMLSelectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsConstraintValidation.h"
|
||||
#include "nsIConstraintValidation.h"
|
||||
|
||||
#include "nsTextEditorState.h"
|
||||
|
||||
|
@ -91,7 +91,7 @@ class nsHTMLTextAreaElement : public nsGenericHTMLFormElement,
|
|||
public nsITextControlElement,
|
||||
public nsIDOMNSEditableElement,
|
||||
public nsStubMutationObserver,
|
||||
public nsConstraintValidation
|
||||
public nsIConstraintValidation
|
||||
{
|
||||
public:
|
||||
nsHTMLTextAreaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
|
@ -201,7 +201,7 @@ public:
|
|||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
// nsConstraintValidation
|
||||
// nsIConstraintValidation
|
||||
PRBool IsTooLong();
|
||||
PRBool IsValueMissing() const;
|
||||
void UpdateTooLongValidityState();
|
||||
|
@ -306,7 +306,7 @@ NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsHTMLTextAreaElement)
|
|||
nsITextControlElement,
|
||||
nsIDOMNSEditableElement,
|
||||
nsIMutationObserver,
|
||||
nsConstraintValidation)
|
||||
nsIConstraintValidation)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLTextAreaElement,
|
||||
nsGenericHTMLFormElement)
|
||||
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLTextAreaElement)
|
||||
|
@ -317,8 +317,8 @@ NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLTextAreaElement)
|
|||
|
||||
NS_IMPL_ELEMENT_CLONE(nsHTMLTextAreaElement)
|
||||
|
||||
// nsConstraintValidation
|
||||
NS_IMPL_NSCONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(nsHTMLTextAreaElement)
|
||||
// nsIConstraintValidation
|
||||
NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(nsHTMLTextAreaElement)
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1091,12 +1091,12 @@ nsHTMLTextAreaElement::IsMutable() const
|
|||
!HasAttr(kNameSpaceID_None, nsGkAtoms::disabled));
|
||||
}
|
||||
|
||||
// nsConstraintValidation
|
||||
// nsIConstraintValidation
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTextAreaElement::SetCustomValidity(const nsAString& aError)
|
||||
{
|
||||
nsConstraintValidation::SetCustomValidity(aError);
|
||||
nsIConstraintValidation::SetCustomValidity(aError);
|
||||
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (doc) {
|
||||
|
@ -1193,7 +1193,7 @@ nsHTMLTextAreaElement::GetValidationMessage(nsAString& aValidationMessage,
|
|||
}
|
||||
break;
|
||||
default:
|
||||
rv = nsConstraintValidation::GetValidationMessage(aValidationMessage, aType);
|
||||
rv = nsIConstraintValidation::GetValidationMessage(aValidationMessage, aType);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsConstraintValidation.h"
|
||||
#include "nsIConstraintValidation.h"
|
||||
|
||||
#include "nsAString.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
|
@ -43,13 +43,13 @@
|
|||
#include "nsDOMValidityState.h"
|
||||
|
||||
|
||||
nsConstraintValidation::nsConstraintValidation()
|
||||
nsIConstraintValidation::nsIConstraintValidation()
|
||||
: mValidityBitField(0)
|
||||
, mValidity(nsnull)
|
||||
{
|
||||
}
|
||||
|
||||
nsConstraintValidation::~nsConstraintValidation()
|
||||
nsIConstraintValidation::~nsIConstraintValidation()
|
||||
{
|
||||
if (mValidity) {
|
||||
mValidity->Disconnect();
|
||||
|
@ -57,7 +57,7 @@ nsConstraintValidation::~nsConstraintValidation()
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsConstraintValidation::GetValidity(nsIDOMValidityState** aValidity)
|
||||
nsIConstraintValidation::GetValidity(nsIDOMValidityState** aValidity)
|
||||
{
|
||||
if (!mValidity) {
|
||||
mValidity = new nsDOMValidityState(this);
|
||||
|
@ -69,7 +69,7 @@ nsConstraintValidation::GetValidity(nsIDOMValidityState** aValidity)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsConstraintValidation::GetValidationMessage(nsAString& aValidationMessage)
|
||||
nsIConstraintValidation::GetValidationMessage(nsAString& aValidationMessage)
|
||||
{
|
||||
aValidationMessage.Truncate();
|
||||
|
||||
|
@ -98,7 +98,7 @@ nsConstraintValidation::GetValidationMessage(nsAString& aValidationMessage)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsConstraintValidation::CheckValidity(PRBool* aValidity)
|
||||
nsIConstraintValidation::CheckValidity(PRBool* aValidity)
|
||||
{
|
||||
if (!IsCandidateForConstraintValidation() || IsValid()) {
|
||||
*aValidity = PR_TRUE;
|
||||
|
@ -116,14 +116,14 @@ nsConstraintValidation::CheckValidity(PRBool* aValidity)
|
|||
}
|
||||
|
||||
void
|
||||
nsConstraintValidation::SetCustomValidity(const nsAString& aError)
|
||||
nsIConstraintValidation::SetCustomValidity(const nsAString& aError)
|
||||
{
|
||||
mCustomValidity.Assign(aError);
|
||||
SetValidityState(VALIDITY_STATE_CUSTOM_ERROR, !mCustomValidity.IsEmpty());
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsConstraintValidation::IsCandidateForConstraintValidation() const
|
||||
nsIConstraintValidation::IsCandidateForConstraintValidation() const
|
||||
{
|
||||
/**
|
||||
* An element is never candidate for constraint validation if:
|
||||
|
@ -134,7 +134,7 @@ nsConstraintValidation::IsCandidateForConstraintValidation() const
|
|||
*/
|
||||
|
||||
nsCOMPtr<nsIContent> content =
|
||||
do_QueryInterface(const_cast<nsConstraintValidation*>(this));
|
||||
do_QueryInterface(const_cast<nsIConstraintValidation*>(this));
|
||||
NS_ASSERTION(content, "This class should be inherited by HTML elements only!");
|
||||
|
||||
// For the moment, all elements that are not barred from constraint validation
|
|
@ -35,8 +35,8 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsConstraintValidition_h___
|
||||
#define nsConstraintValidition_h___
|
||||
#ifndef nsIConstraintValidition_h___
|
||||
#define nsIConstraintValidition_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
@ -46,26 +46,26 @@ class nsDOMValidityState;
|
|||
class nsIDOMValidityState;
|
||||
class nsGenericHTMLFormElement;
|
||||
|
||||
#define NS_CONSTRAINTVALIDATION_IID \
|
||||
#define NS_ICONSTRAINTVALIDATION_IID \
|
||||
{ 0xca3824dc, 0x4f5c, 0x4878, \
|
||||
{ 0xa6, 0x8a, 0x95, 0x54, 0x5f, 0xfa, 0x4b, 0xf9 } }
|
||||
|
||||
/**
|
||||
* This class is used for form elements implementing the
|
||||
* validity constraint API.
|
||||
* This interface is for form elements implementing the validity constraint API.
|
||||
* See: http://dev.w3.org/html5/spec/forms.html#the-constraint-validation-api
|
||||
*
|
||||
* This class has to be used by all elements implementing the API.
|
||||
* This interface has to be implemented by all elements implementing the API
|
||||
* and only them.
|
||||
*/
|
||||
class nsConstraintValidation : public nsISupports
|
||||
class nsIConstraintValidation : public nsISupports
|
||||
{
|
||||
public:
|
||||
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_CONSTRAINTVALIDATION_IID);
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICONSTRAINTVALIDATION_IID);
|
||||
|
||||
friend class nsDOMValidityState;
|
||||
|
||||
virtual ~nsConstraintValidation();
|
||||
virtual ~nsIConstraintValidation();
|
||||
|
||||
PRBool IsValid() const { return mValidityBitField == 0; }
|
||||
|
||||
|
@ -86,7 +86,7 @@ protected:
|
|||
};
|
||||
|
||||
// You can't instantiate an object from that class.
|
||||
nsConstraintValidation();
|
||||
nsIConstraintValidation();
|
||||
|
||||
nsresult GetValidity(nsIDOMValidityState** aValidity);
|
||||
nsresult GetValidationMessage(nsAString& aValidationMessage);
|
||||
|
@ -132,56 +132,57 @@ private:
|
|||
};
|
||||
|
||||
/**
|
||||
* Use these macro for class inherit from nsConstraintValidation to forward
|
||||
* functions to nsConstraintValidation.
|
||||
* Use these macro for class inheriting from nsIConstraintValidation to forward
|
||||
* functions to nsIConstraintValidation.
|
||||
*/
|
||||
#define NS_FORWARD_NSCONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY \
|
||||
#define NS_FORWARD_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY \
|
||||
NS_IMETHOD GetValidity(nsIDOMValidityState** aValidity) { \
|
||||
return nsConstraintValidation::GetValidity(aValidity); \
|
||||
return nsIConstraintValidation::GetValidity(aValidity); \
|
||||
} \
|
||||
NS_IMETHOD GetWillValidate(PRBool* aWillValidate) { \
|
||||
*aWillValidate = IsCandidateForConstraintValidation(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHOD GetValidationMessage(nsAString& aValidationMessage) { \
|
||||
return nsConstraintValidation::GetValidationMessage(aValidationMessage); \
|
||||
return nsIConstraintValidation::GetValidationMessage(aValidationMessage); \
|
||||
} \
|
||||
NS_IMETHOD CheckValidity(PRBool* aValidity) { \
|
||||
return nsConstraintValidation::CheckValidity(aValidity); \
|
||||
return nsIConstraintValidation::CheckValidity(aValidity); \
|
||||
}
|
||||
|
||||
#define NS_FORWARD_NSCONSTRAINTVALIDATION \
|
||||
NS_FORWARD_NSCONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY \
|
||||
#define NS_FORWARD_NSICONSTRAINTVALIDATION \
|
||||
NS_FORWARD_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY \
|
||||
NS_IMETHOD SetCustomValidity(const nsAString& aError) { \
|
||||
nsConstraintValidation::SetCustomValidity(aError); \
|
||||
nsIConstraintValidation::SetCustomValidity(aError); \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
|
||||
/* Use these macro when class declares functions from nsConstraintValidation */
|
||||
#define NS_IMPL_NSCONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(_from) \
|
||||
/* Use these macro when class declares functions from nsIConstraintValidation */
|
||||
#define NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(_from) \
|
||||
NS_IMETHODIMP _from::GetValidity(nsIDOMValidityState** aValidity) { \
|
||||
return nsConstraintValidation::GetValidity(aValidity); \
|
||||
return nsIConstraintValidation::GetValidity(aValidity); \
|
||||
} \
|
||||
NS_IMETHODIMP _from::GetWillValidate(PRBool* aWillValidate) { \
|
||||
*aWillValidate = IsCandidateForConstraintValidation(); \
|
||||
return NS_OK; \
|
||||
} \
|
||||
NS_IMETHODIMP _from::GetValidationMessage(nsAString& aValidationMessage) { \
|
||||
return nsConstraintValidation::GetValidationMessage(aValidationMessage); \
|
||||
return nsIConstraintValidation::GetValidationMessage(aValidationMessage); \
|
||||
} \
|
||||
NS_IMETHODIMP _from::CheckValidity(PRBool* aValidity) { \
|
||||
return nsConstraintValidation::CheckValidity(aValidity); \
|
||||
return nsIConstraintValidation::CheckValidity(aValidity); \
|
||||
}
|
||||
|
||||
#define NS_IMPL_NSCONSTRAINTVALIDATION(_from) \
|
||||
NS_IMPL_NSCONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(_from) \
|
||||
#define NS_IMPL_NSICONSTRAINTVALIDATION(_from) \
|
||||
NS_IMPL_NSICONSTRAINTVALIDATION_EXCEPT_SETCUSTOMVALIDITY(_from) \
|
||||
NS_IMETHODIMP _from::SetCustomValidity(const nsAString& aError) { \
|
||||
nsConstraintValidation::SetCustomValidity(aError); \
|
||||
nsIConstraintValidation::SetCustomValidity(aError); \
|
||||
return NS_OK; \
|
||||
}
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsConstraintValidation, NS_CONSTRAINTVALIDATION_IID)
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIConstraintValidation,
|
||||
NS_ICONSTRAINTVALIDATION_IID)
|
||||
|
||||
#endif // nsConstraintValidation_h___
|
||||
#endif // nsIConstraintValidation_h___
|
||||
|
Загрузка…
Ссылка в новой задаче