LCOV - code coverage report
Current view: top level - dom/html - HTMLButtonElement.h (source / functions) Hit Total Coverage
Test: output.info Lines: 1 40 2.5 %
Date: 2017-07-14 16:53:18 Functions: 1 20 5.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef mozilla_dom_HTMLButtonElement_h
       8             : #define mozilla_dom_HTMLButtonElement_h
       9             : 
      10             : #include "mozilla/Attributes.h"
      11             : #include "nsGenericHTMLElement.h"
      12             : #include "nsIDOMHTMLButtonElement.h"
      13             : #include "nsIConstraintValidation.h"
      14             : 
      15             : namespace mozilla {
      16             : class EventChainPostVisitor;
      17             : class EventChainPreVisitor;
      18             : namespace dom {
      19             : 
      20             : class HTMLButtonElement final : public nsGenericHTMLFormElementWithState,
      21             :                                 public nsIDOMHTMLButtonElement,
      22             :                                 public nsIConstraintValidation
      23             : {
      24             : public:
      25             :   using nsIConstraintValidation::GetValidationMessage;
      26             : 
      27             :   explicit HTMLButtonElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
      28             :                              FromParser aFromParser = NOT_FROM_PARSER);
      29             : 
      30           1 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLButtonElement,
      31             :                                            nsGenericHTMLFormElementWithState)
      32             : 
      33             :   // nsISupports
      34             :   NS_DECL_ISUPPORTS_INHERITED
      35             : 
      36             :   virtual int32_t TabIndexDefault() override;
      37             : 
      38           0 :   NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLButtonElement, button)
      39             : 
      40             :   // Element
      41           0 :   virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override
      42             :   {
      43           0 :     return true;
      44             :   }
      45             : 
      46             :   // nsIDOMHTMLButtonElement
      47             :   NS_DECL_NSIDOMHTMLBUTTONELEMENT
      48             : 
      49             :   // overriden nsIFormControl methods
      50             :   NS_IMETHOD Reset() override;
      51             :   NS_IMETHOD SubmitNamesValues(HTMLFormSubmission* aFormSubmission) override;
      52             :   NS_IMETHOD SaveState() override;
      53             :   bool RestoreState(nsPresState* aState) override;
      54             :   virtual bool IsDisabledForEvents(EventMessage aMessage) override;
      55             : 
      56             :   virtual void FieldSetDisabledChanged(bool aNotify) override;
      57             : 
      58             :   // nsIDOMEventTarget
      59             :   virtual nsresult GetEventTargetParent(
      60             :                      EventChainPreVisitor& aVisitor) override;
      61             :   virtual nsresult PostHandleEvent(
      62             :                      EventChainPostVisitor& aVisitor) override;
      63             : 
      64             :   // nsINode
      65             :   virtual nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
      66             :                          bool aPreallocateChildren) const override;
      67             :   virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
      68             : 
      69             :   // nsIContent
      70             :   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
      71             :                               nsIContent* aBindingParent,
      72             :                               bool aCompileEventHandlers) override;
      73             :   virtual void UnbindFromTree(bool aDeep = true,
      74             :                               bool aNullParent = true) override;
      75             :   virtual void DoneCreatingElement() override;
      76             : 
      77             :   void UpdateBarredFromConstraintValidation();
      78             :   // Element
      79             :   EventStates IntrinsicState() const override;
      80             :   /**
      81             :    * Called when an attribute is about to be changed
      82             :    */
      83             :   virtual nsresult BeforeSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
      84             :                                  const nsAttrValueOrString* aValue,
      85             :                                  bool aNotify) override;
      86             :   /**
      87             :    * Called when an attribute has just been changed
      88             :    */
      89             :   virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
      90             :                                 const nsAttrValue* aValue,
      91             :                                 const nsAttrValue* aOldValue,
      92             :                                 bool aNotify) override;
      93             :   virtual bool ParseAttribute(int32_t aNamespaceID,
      94             :                               nsIAtom* aAttribute,
      95             :                               const nsAString& aValue,
      96             :                               nsAttrValue& aResult) override;
      97             : 
      98             :   // nsGenericHTMLElement
      99             :   virtual bool IsHTMLFocusable(bool aWithMouse,
     100             :                                bool* aIsFocusable,
     101             :                                int32_t* aTabIndex) override;
     102             : 
     103             :   // WebIDL
     104           0 :   bool Autofocus() const
     105             :   {
     106           0 :     return GetBoolAttr(nsGkAtoms::autofocus);
     107             :   }
     108           0 :   void SetAutofocus(bool aAutofocus, ErrorResult& aError)
     109             :   {
     110           0 :     SetHTMLBoolAttr(nsGkAtoms::autofocus, aAutofocus, aError);
     111           0 :   }
     112           0 :   bool Disabled() const
     113             :   {
     114           0 :     return GetBoolAttr(nsGkAtoms::disabled);
     115             :   }
     116           0 :   void SetDisabled(bool aDisabled, ErrorResult& aError)
     117             :   {
     118           0 :     SetHTMLBoolAttr(nsGkAtoms::disabled, aDisabled, aError);
     119           0 :   }
     120             :   // nsGenericHTMLFormElement::GetForm is fine.
     121             :   using nsGenericHTMLFormElement::GetForm;
     122             :   // XPCOM GetFormAction is fine.
     123           0 :   void SetFormAction(const nsAString& aFormAction, ErrorResult& aRv)
     124             :   {
     125           0 :     SetHTMLAttr(nsGkAtoms::formaction, aFormAction, aRv);
     126           0 :   }
     127             :   // XPCOM GetFormEnctype is fine.
     128           0 :   void SetFormEnctype(const nsAString& aFormEnctype, ErrorResult& aRv)
     129             :   {
     130           0 :     SetHTMLAttr(nsGkAtoms::formenctype, aFormEnctype, aRv);
     131           0 :   }
     132             :   // XPCOM GetFormMethod is fine.
     133           0 :   void SetFormMethod(const nsAString& aFormMethod, ErrorResult& aRv)
     134             :   {
     135           0 :     SetHTMLAttr(nsGkAtoms::formmethod, aFormMethod, aRv);
     136           0 :   }
     137           0 :   bool FormNoValidate() const
     138             :   {
     139           0 :     return GetBoolAttr(nsGkAtoms::formnovalidate);
     140             :   }
     141           0 :   void SetFormNoValidate(bool aFormNoValidate, ErrorResult& aError)
     142             :   {
     143           0 :     SetHTMLBoolAttr(nsGkAtoms::formnovalidate, aFormNoValidate, aError);
     144           0 :   }
     145             :   // XPCOM GetFormTarget is fine.
     146           0 :   void SetFormTarget(const nsAString& aFormTarget, ErrorResult& aRv)
     147             :   {
     148           0 :     SetHTMLAttr(nsGkAtoms::formtarget, aFormTarget, aRv);
     149           0 :   }
     150             :   // XPCOM GetName is fine.
     151           0 :   void SetName(const nsAString& aName, ErrorResult& aRv)
     152             :   {
     153           0 :     SetHTMLAttr(nsGkAtoms::name, aName, aRv);
     154           0 :   }
     155             :   // XPCOM GetType is fine.
     156           0 :   void SetType(const nsAString& aType, ErrorResult& aRv)
     157             :   {
     158           0 :     SetHTMLAttr(nsGkAtoms::type, aType, aRv);
     159           0 :   }
     160             :   // XPCOM GetValue is fine.
     161           0 :   void SetValue(const nsAString& aValue, ErrorResult& aRv)
     162             :   {
     163           0 :     SetHTMLAttr(nsGkAtoms::value, aValue, aRv);
     164           0 :   }
     165             : 
     166             :   // nsIConstraintValidation::WillValidate is fine.
     167             :   // nsIConstraintValidation::Validity() is fine.
     168             :   // nsIConstraintValidation::GetValidationMessage() is fine.
     169             :   // nsIConstraintValidation::CheckValidity() is fine.
     170             :   using nsIConstraintValidation::CheckValidity;
     171             :   using nsIConstraintValidation::ReportValidity;
     172             :   // nsIConstraintValidation::SetCustomValidity() is fine.
     173             : 
     174             : protected:
     175             :   virtual ~HTMLButtonElement();
     176             : 
     177             :   bool mDisabledChanged;
     178             :   bool mInInternalActivate;
     179             :   bool mInhibitStateRestoration;
     180             : };
     181             : 
     182             : } // namespace dom
     183             : } // namespace mozilla
     184             : 
     185             : #endif // mozilla_dom_HTMLButtonElement_h

Generated by: LCOV version 1.13