2013-02-18 21:18:40 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set sw=2 ts=2 et tw=80: */
|
|
|
|
/* 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_HTMLTextAreaElement_h
|
|
|
|
#define mozilla_dom_HTMLTextAreaElement_h
|
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-02-18 21:18:40 +00:00
|
|
|
#include "nsIDOMHTMLTextAreaElement.h"
|
|
|
|
#include "nsITextControlElement.h"
|
|
|
|
#include "nsIDOMNSEditableElement.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsGenericHTMLElement.h"
|
|
|
|
#include "nsStubMutationObserver.h"
|
|
|
|
#include "nsIConstraintValidation.h"
|
2013-06-19 14:24:37 +00:00
|
|
|
#include "mozilla/dom/HTMLFormElement.h"
|
2013-10-04 15:30:07 +00:00
|
|
|
#include "mozilla/dom/HTMLInputElementBinding.h"
|
2013-02-19 05:54:23 +00:00
|
|
|
#include "nsGkAtoms.h"
|
2013-02-18 21:18:40 +00:00
|
|
|
|
|
|
|
#include "nsTextEditorState.h"
|
|
|
|
|
|
|
|
class nsFormSubmission;
|
|
|
|
class nsIControllers;
|
|
|
|
class nsIDocument;
|
|
|
|
class nsPresContext;
|
|
|
|
class nsPresState;
|
|
|
|
|
|
|
|
namespace mozilla {
|
2014-03-18 04:48:19 +00:00
|
|
|
|
2014-03-18 04:48:20 +00:00
|
|
|
class EventChainPostVisitor;
|
2014-03-18 04:48:19 +00:00
|
|
|
class EventChainPreVisitor;
|
2014-04-03 04:18:36 +00:00
|
|
|
class EventStates;
|
2014-03-18 04:48:19 +00:00
|
|
|
|
2013-02-18 21:18:40 +00:00
|
|
|
namespace dom {
|
|
|
|
|
2013-08-02 01:21:31 +00:00
|
|
|
class HTMLTextAreaElement MOZ_FINAL : public nsGenericHTMLFormElementWithState,
|
2013-02-18 21:18:40 +00:00
|
|
|
public nsIDOMHTMLTextAreaElement,
|
|
|
|
public nsITextControlElement,
|
|
|
|
public nsIDOMNSEditableElement,
|
|
|
|
public nsStubMutationObserver,
|
|
|
|
public nsIConstraintValidation
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
using nsIConstraintValidation::GetValidationMessage;
|
|
|
|
|
2014-09-02 00:49:25 +00:00
|
|
|
explicit HTMLTextAreaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
|
|
|
|
FromParser aFromParser = NOT_FROM_PARSER);
|
2013-02-18 21:18:40 +00:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
|
|
|
virtual int32_t TabIndexDefault() MOZ_OVERRIDE;
|
|
|
|
|
|
|
|
// nsIDOMHTMLTextAreaElement
|
|
|
|
NS_DECL_NSIDOMHTMLTEXTAREAELEMENT
|
|
|
|
|
|
|
|
// nsIDOMNSEditableElement
|
2013-05-29 20:43:41 +00:00
|
|
|
NS_IMETHOD GetEditor(nsIEditor** aEditor) MOZ_OVERRIDE
|
2013-02-18 21:18:40 +00:00
|
|
|
{
|
|
|
|
return nsGenericHTMLElement::GetEditor(aEditor);
|
|
|
|
}
|
2013-05-29 20:43:41 +00:00
|
|
|
NS_IMETHOD SetUserInput(const nsAString& aInput) MOZ_OVERRIDE;
|
2013-02-18 21:18:40 +00:00
|
|
|
|
|
|
|
// nsIFormControl
|
2013-05-29 20:43:41 +00:00
|
|
|
NS_IMETHOD_(uint32_t) GetType() const MOZ_OVERRIDE { return NS_FORM_TEXTAREA; }
|
|
|
|
NS_IMETHOD Reset() MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD SaveState() MOZ_OVERRIDE;
|
|
|
|
virtual bool RestoreState(nsPresState* aState) MOZ_OVERRIDE;
|
|
|
|
virtual bool IsDisabledForEvents(uint32_t aMessage) MOZ_OVERRIDE;
|
2013-02-18 21:18:40 +00:00
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
virtual void FieldSetDisabledChanged(bool aNotify) MOZ_OVERRIDE;
|
2013-02-18 21:18:40 +00:00
|
|
|
|
2014-04-03 04:18:36 +00:00
|
|
|
virtual EventStates IntrinsicState() const MOZ_OVERRIDE;
|
2013-02-18 21:18:40 +00:00
|
|
|
|
|
|
|
// nsITextControlElemet
|
2013-05-29 20:43:41 +00:00
|
|
|
NS_IMETHOD SetValueChanged(bool aValueChanged) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(bool) IsSingleLineTextControl() const MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(bool) IsTextArea() const MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(bool) IsPlainTextControl() const MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(bool) IsPasswordTextControl() const MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(int32_t) GetCols() MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(int32_t) GetWrapCols() MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(int32_t) GetRows() MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(void) GetDefaultValueFromContent(nsAString& aValue) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(bool) ValueChanged() const MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(void) GetTextEditorValue(nsAString& aValue, bool aIgnoreWrap) const MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(nsIEditor*) GetTextEditor() MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(nsISelectionController*) GetSelectionController() MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(nsFrameSelection*) GetConstFrameSelection() MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD BindToFrame(nsTextControlFrame* aFrame) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(void) UnbindFromFrame(nsTextControlFrame* aFrame) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD CreateEditor() MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(nsIContent*) GetRootEditorNode() MOZ_OVERRIDE;
|
2013-12-03 14:40:12 +00:00
|
|
|
NS_IMETHOD_(Element*) CreatePlaceholderNode() MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(Element*) GetPlaceholderNode() MOZ_OVERRIDE;
|
2013-05-29 20:43:41 +00:00
|
|
|
NS_IMETHOD_(void) UpdatePlaceholderVisibility(bool aNotify) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(bool) GetPlaceholderVisibility() MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(void) InitializeKeyboardEventListeners() MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(void) OnValueChanged(bool aNotify) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(bool) HasCachedSelection() MOZ_OVERRIDE;
|
2013-02-18 21:18:40 +00:00
|
|
|
|
|
|
|
// nsIContent
|
|
|
|
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|
|
|
nsIContent* aBindingParent,
|
2013-05-29 20:43:41 +00:00
|
|
|
bool aCompileEventHandlers) MOZ_OVERRIDE;
|
2013-02-18 21:18:40 +00:00
|
|
|
virtual void UnbindFromTree(bool aDeep = true,
|
2013-05-29 20:43:41 +00:00
|
|
|
bool aNullParent = true) MOZ_OVERRIDE;
|
2013-02-18 21:18:40 +00:00
|
|
|
virtual bool ParseAttribute(int32_t aNamespaceID,
|
|
|
|
nsIAtom* aAttribute,
|
|
|
|
const nsAString& aValue,
|
2013-05-29 20:43:41 +00:00
|
|
|
nsAttrValue& aResult) MOZ_OVERRIDE;
|
|
|
|
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const MOZ_OVERRIDE;
|
2013-02-18 21:18:40 +00:00
|
|
|
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
2013-05-29 20:43:41 +00:00
|
|
|
int32_t aModType) const MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const MOZ_OVERRIDE;
|
2013-02-18 21:18:40 +00:00
|
|
|
|
2014-03-18 04:48:19 +00:00
|
|
|
virtual nsresult PreHandleEvent(EventChainPreVisitor& aVisitor) MOZ_OVERRIDE;
|
2014-03-18 04:48:20 +00:00
|
|
|
virtual nsresult PostHandleEvent(
|
|
|
|
EventChainPostVisitor& aVisitor) MOZ_OVERRIDE;
|
2013-02-18 21:18:40 +00:00
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex) MOZ_OVERRIDE;
|
2013-02-18 21:18:40 +00:00
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
virtual void DoneAddingChildren(bool aHaveNotified) MOZ_OVERRIDE;
|
|
|
|
virtual bool IsDoneAddingChildren() MOZ_OVERRIDE;
|
2013-02-18 21:18:40 +00:00
|
|
|
|
2014-06-20 02:01:40 +00:00
|
|
|
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
|
2013-02-18 21:18:40 +00:00
|
|
|
|
|
|
|
nsresult CopyInnerTo(Element* aDest);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called when an attribute is about to be changed
|
|
|
|
*/
|
|
|
|
virtual nsresult BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
|
|
|
|
const nsAttrValueOrString* aValue,
|
2013-05-29 20:43:41 +00:00
|
|
|
bool aNotify) MOZ_OVERRIDE;
|
2013-02-18 21:18:40 +00:00
|
|
|
|
|
|
|
// nsIMutationObserver
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
|
|
|
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLTextAreaElement,
|
2013-08-02 01:21:31 +00:00
|
|
|
nsGenericHTMLFormElementWithState)
|
2013-02-18 21:18:40 +00:00
|
|
|
|
|
|
|
// nsIConstraintValidation
|
|
|
|
bool IsTooLong();
|
|
|
|
bool IsValueMissing() const;
|
|
|
|
void UpdateTooLongValidityState();
|
|
|
|
void UpdateValueMissingValidityState();
|
|
|
|
void UpdateBarredFromConstraintValidation();
|
|
|
|
nsresult GetValidationMessage(nsAString& aValidationMessage,
|
2013-05-29 20:43:41 +00:00
|
|
|
ValidityStateType aType) MOZ_OVERRIDE;
|
2013-02-18 21:18:40 +00:00
|
|
|
|
2013-02-19 05:54:23 +00:00
|
|
|
// Web IDL binding methods
|
|
|
|
bool Autofocus()
|
|
|
|
{
|
|
|
|
return GetBoolAttr(nsGkAtoms::autofocus);
|
|
|
|
}
|
|
|
|
void SetAutofocus(bool aAutoFocus, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLBoolAttr(nsGkAtoms::autofocus, aAutoFocus, aError);
|
|
|
|
}
|
|
|
|
uint32_t Cols()
|
|
|
|
{
|
|
|
|
return GetIntAttr(nsGkAtoms::cols, DEFAULT_COLS);
|
|
|
|
}
|
|
|
|
void SetCols(uint32_t aCols, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
if (aCols == 0) {
|
|
|
|
aError.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
|
|
|
} else {
|
2013-04-04 07:03:50 +00:00
|
|
|
SetUnsignedIntAttr(nsGkAtoms::cols, aCols, aError);
|
2013-02-19 05:54:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
bool Disabled()
|
|
|
|
{
|
|
|
|
return GetBoolAttr(nsGkAtoms::disabled);
|
|
|
|
}
|
|
|
|
void SetDisabled(bool aDisabled, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLBoolAttr(nsGkAtoms::disabled, aDisabled, aError);
|
|
|
|
}
|
2013-08-02 01:21:31 +00:00
|
|
|
// nsGenericHTMLFormElementWithState::GetForm is fine
|
|
|
|
using nsGenericHTMLFormElementWithState::GetForm;
|
2013-02-19 05:54:23 +00:00
|
|
|
int32_t MaxLength()
|
|
|
|
{
|
|
|
|
return GetIntAttr(nsGkAtoms::maxlength, -1);
|
|
|
|
}
|
|
|
|
void SetMaxLength(int32_t aMaxLength, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
if (aMaxLength < 0) {
|
|
|
|
aError.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
|
|
|
} else {
|
|
|
|
SetHTMLIntAttr(nsGkAtoms::maxlength, aMaxLength, aError);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// XPCOM GetName is fine
|
|
|
|
void SetName(const nsAString& aName, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::name, aName, aError);
|
|
|
|
}
|
|
|
|
// XPCOM GetPlaceholder is fine
|
|
|
|
void SetPlaceholder(const nsAString& aPlaceholder, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::placeholder, aPlaceholder, aError);
|
|
|
|
}
|
|
|
|
bool ReadOnly()
|
|
|
|
{
|
|
|
|
return GetBoolAttr(nsGkAtoms::readonly);
|
|
|
|
}
|
|
|
|
void SetReadOnly(bool aReadOnly, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLBoolAttr(nsGkAtoms::readonly, aReadOnly, aError);
|
|
|
|
}
|
|
|
|
bool Required()
|
|
|
|
{
|
|
|
|
return GetBoolAttr(nsGkAtoms::required);
|
|
|
|
}
|
2013-10-04 15:30:07 +00:00
|
|
|
|
|
|
|
void SetRangeText(const nsAString& aReplacement, ErrorResult& aRv);
|
|
|
|
|
|
|
|
void SetRangeText(const nsAString& aReplacement, uint32_t aStart,
|
|
|
|
uint32_t aEnd, const SelectionMode& aSelectMode,
|
|
|
|
ErrorResult& aRv, int32_t aSelectionStart = -1,
|
|
|
|
int32_t aSelectionEnd = -1);
|
|
|
|
|
2013-02-19 05:54:23 +00:00
|
|
|
void SetRequired(bool aRequired, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLBoolAttr(nsGkAtoms::required, aRequired, aError);
|
|
|
|
}
|
|
|
|
uint32_t Rows()
|
|
|
|
{
|
|
|
|
return GetIntAttr(nsGkAtoms::rows, DEFAULT_ROWS_TEXTAREA);
|
|
|
|
}
|
|
|
|
void SetRows(uint32_t aRows, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
if (aRows == 0) {
|
|
|
|
aError.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
|
|
|
|
} else {
|
2013-04-04 07:03:50 +00:00
|
|
|
SetUnsignedIntAttr(nsGkAtoms::rows, aRows, aError);
|
2013-02-19 05:54:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// XPCOM GetWrap is fine
|
|
|
|
void SetWrap(const nsAString& aWrap, ErrorResult& aError)
|
|
|
|
{
|
|
|
|
SetHTMLAttr(nsGkAtoms::wrap, aWrap, aError);
|
|
|
|
}
|
|
|
|
// XPCOM GetType is fine
|
|
|
|
// XPCOM GetDefaultValue is fine
|
|
|
|
void SetDefaultValue(const nsAString& aDefaultValue, ErrorResult& aError);
|
|
|
|
// XPCOM GetValue/SetValue are fine
|
|
|
|
uint32_t GetTextLength();
|
|
|
|
// nsIConstraintValidation::WillValidate is fine.
|
|
|
|
// nsIConstraintValidation::Validity() is fine.
|
|
|
|
// nsIConstraintValidation::GetValidationMessage() is fine.
|
|
|
|
// nsIConstraintValidation::CheckValidity() is fine.
|
|
|
|
using nsIConstraintValidation::CheckValidity;
|
|
|
|
// nsIConstraintValidation::SetCustomValidity() is fine.
|
|
|
|
// XPCOM Select is fine
|
|
|
|
uint32_t GetSelectionStart(ErrorResult& aError);
|
|
|
|
void SetSelectionStart(uint32_t aSelectionStart, ErrorResult& aError);
|
|
|
|
uint32_t GetSelectionEnd(ErrorResult& aError);
|
|
|
|
void SetSelectionEnd(uint32_t aSelectionEnd, ErrorResult& aError);
|
|
|
|
void GetSelectionDirection(nsAString& aDirection, ErrorResult& aError);
|
|
|
|
void SetSelectionDirection(const nsAString& aDirection, ErrorResult& aError);
|
|
|
|
void SetSelectionRange(uint32_t aSelectionStart, uint32_t aSelectionEnd, const Optional<nsAString>& aDirecton, ErrorResult& aError);
|
|
|
|
nsIControllers* GetControllers(ErrorResult& aError);
|
|
|
|
nsIEditor* GetEditor()
|
|
|
|
{
|
|
|
|
return mState.GetEditor();
|
|
|
|
}
|
|
|
|
|
2013-02-18 21:18:40 +00:00
|
|
|
protected:
|
2014-07-08 21:23:16 +00:00
|
|
|
virtual ~HTMLTextAreaElement() {}
|
|
|
|
|
2013-08-02 01:21:31 +00:00
|
|
|
// get rid of the compiler warning
|
|
|
|
using nsGenericHTMLFormElementWithState::IsSingleLineTextControl;
|
2013-02-18 21:18:40 +00:00
|
|
|
|
2014-04-08 22:27:17 +00:00
|
|
|
virtual JSObject* WrapNode(JSContext *aCx) MOZ_OVERRIDE;
|
2013-02-19 05:54:23 +00:00
|
|
|
|
2013-02-18 21:18:40 +00:00
|
|
|
nsCOMPtr<nsIControllers> mControllers;
|
|
|
|
/** Whether or not the value has changed since its default value was given. */
|
|
|
|
bool mValueChanged;
|
|
|
|
/** Whether or not we are already handling select event. */
|
|
|
|
bool mHandlingSelect;
|
|
|
|
/** Whether or not we are done adding children (always true if not
|
|
|
|
created by a parser */
|
|
|
|
bool mDoneAddingChildren;
|
|
|
|
/** Whether state restoration should be inhibited in DoneAddingChildren. */
|
|
|
|
bool mInhibitStateRestoration;
|
|
|
|
/** Whether our disabled state has changed from the default **/
|
|
|
|
bool mDisabledChanged;
|
|
|
|
/** Whether we should make :-moz-ui-invalid apply on the element. **/
|
|
|
|
bool mCanShowInvalidUI;
|
|
|
|
/** Whether we should make :-moz-ui-valid apply on the element. **/
|
|
|
|
bool mCanShowValidUI;
|
|
|
|
|
|
|
|
void FireChangeEventIfNeeded();
|
|
|
|
|
|
|
|
nsString mFocusedValue;
|
|
|
|
|
|
|
|
/** The state of the text editor (selection controller and the editor) **/
|
|
|
|
nsTextEditorState mState;
|
|
|
|
|
|
|
|
NS_IMETHOD SelectAll(nsPresContext* aPresContext);
|
|
|
|
/**
|
|
|
|
* Get the value, whether it is from the content or the frame.
|
|
|
|
* @param aValue the value [out]
|
|
|
|
* @param aIgnoreWrap whether to ignore the wrap attribute when getting the
|
|
|
|
* value. If this is true, linebreaks will not be inserted even if
|
|
|
|
* wrap=hard.
|
|
|
|
*/
|
|
|
|
void GetValueInternal(nsAString& aValue, bool aIgnoreWrap) const;
|
|
|
|
|
|
|
|
nsresult SetValueInternal(const nsAString& aValue,
|
|
|
|
bool aUserInput);
|
|
|
|
nsresult GetSelectionRange(int32_t* aSelectionStart, int32_t* aSelectionEnd);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Common method to call from the various mutation observer methods.
|
|
|
|
* aContent is a content node that's either the one that changed or its
|
|
|
|
* parent; we should only respond to the change if aContent is non-anonymous.
|
|
|
|
*/
|
|
|
|
void ContentChanged(nsIContent* aContent);
|
|
|
|
|
|
|
|
virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom *aName,
|
2013-05-29 20:43:41 +00:00
|
|
|
const nsAttrValue* aValue, bool aNotify) MOZ_OVERRIDE;
|
2013-02-18 21:18:40 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return if an element should have a specific validity UI
|
|
|
|
* (with :-moz-ui-invalid and :-moz-ui-valid pseudo-classes).
|
|
|
|
*
|
|
|
|
* @return Whether the element should have a validity UI.
|
|
|
|
*/
|
|
|
|
bool ShouldShowValidityUI() const {
|
|
|
|
/**
|
|
|
|
* Always show the validity UI if the form has already tried to be submitted
|
|
|
|
* but was invalid.
|
|
|
|
*
|
|
|
|
* Otherwise, show the validity UI if the element's value has been changed.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (mForm && mForm->HasEverTriedInvalidSubmit()) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return mValueChanged;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the mutable state of the element.
|
|
|
|
*/
|
|
|
|
bool IsMutable() const;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns whether the current value is the empty string.
|
|
|
|
*
|
|
|
|
* @return whether the current value is the empty string.
|
|
|
|
*/
|
|
|
|
bool IsValueEmpty() const;
|
2013-11-19 19:21:29 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|
|
|
nsRuleData* aData);
|
2013-02-18 21:18:40 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|