/* 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_TextControlElement_h #define mozilla_TextControlElement_h #include "mozilla/Attributes.h" #include "mozilla/dom/FromParser.h" #include "mozilla/dom/NodeInfo.h" #include "nsGenericHTMLElement.h" class nsIContent; class nsISelectionController; class nsFrameSelection; class nsTextControlFrame; namespace mozilla { class ErrorResult; class TextControlState; class TextEditor; /** * This abstract class is used for the text control frame to get the editor and * selection controller objects, and some helper properties. */ class TextControlElement : public nsGenericHTMLFormControlElementWithState { public: TextControlElement(already_AddRefed aNodeInfo, dom::FromParser aFromParser, FormControlType aType) : nsGenericHTMLFormControlElementWithState(std::move(aNodeInfo), aFromParser, aType) {}; NS_DECL_ISUPPORTS_INHERITED NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED( TextControlElement, nsGenericHTMLFormControlElementWithState) /** * Return true always, i.e., even if this is an but the type is not * for a single line text control, this returns true. Use * IsSingleLineTextControlOrTextArea() if you want to know whether this may * work with a TextEditor. */ bool IsTextControlElement() const final { return true; } bool IsSingleLineTextControlOrTextArea() const { return IsSingleLineTextControl() || IsTextArea(); } /** * Find out whether this is a single line text control. (text or password) * @return whether this is a single line text control */ bool IsSingleLineTextControl() const { return nsGenericHTMLFormControlElement::IsSingleLineTextControl(false); } NS_IMPL_FROMNODE_HELPER(TextControlElement, IsTextControlElement()) /** * Tell the control that value has been deliberately changed (or not). */ virtual void SetValueChanged(bool) = 0; /** * Called when this is a single line text control or a