LCOV - code coverage report
Current view: top level - dom/html - HTMLObjectElement.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 98 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 41 0.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_HTMLObjectElement_h
       8             : #define mozilla_dom_HTMLObjectElement_h
       9             : 
      10             : #include "mozilla/Attributes.h"
      11             : #include "nsGenericHTMLElement.h"
      12             : #include "nsObjectLoadingContent.h"
      13             : #include "nsIDOMHTMLObjectElement.h"
      14             : #include "nsIConstraintValidation.h"
      15             : 
      16             : namespace mozilla {
      17             : namespace dom {
      18             : 
      19             : class HTMLFormSubmission;
      20             : 
      21             : class HTMLObjectElement final : public nsGenericHTMLFormElement
      22             :                               , public nsObjectLoadingContent
      23             :                               , public nsIDOMHTMLObjectElement
      24             :                               , public nsIConstraintValidation
      25             : {
      26             : public:
      27             :   explicit HTMLObjectElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo,
      28             :                              FromParser aFromParser = NOT_FROM_PARSER);
      29             : 
      30             :   // nsISupports
      31             :   NS_DECL_ISUPPORTS_INHERITED
      32             : 
      33           0 :   NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLObjectElement, object)
      34             :   virtual int32_t TabIndexDefault() override;
      35             : 
      36             : #ifdef XP_MACOSX
      37             :   // nsIDOMEventTarget
      38             :   NS_IMETHOD PostHandleEvent(EventChainPostVisitor& aVisitor) override;
      39             :   // Helper methods
      40             :   static void OnFocusBlurPlugin(Element* aElement, bool aFocus);
      41             :   static void HandleFocusBlurPlugin(Element* aElement, WidgetEvent* aEvent);
      42             :   static void HandlePluginCrashed(Element* aElement);
      43             :   static void HandlePluginInstantiated(Element* aElement);
      44             :   // Weak pointer. Null if last action was blur.
      45             :   static Element* sLastFocused;
      46             : #endif
      47             : 
      48             :   // Element
      49             :   virtual bool IsInteractiveHTMLContent(bool aIgnoreTabindex) const override;
      50             : 
      51             :   // EventTarget
      52             :   virtual void AsyncEventRunning(AsyncEventDispatcher* aEvent) override;
      53             : 
      54             :   // nsIDOMHTMLObjectElement
      55             :   NS_DECL_NSIDOMHTMLOBJECTELEMENT
      56             : 
      57             :   virtual nsresult BindToTree(nsIDocument *aDocument, nsIContent *aParent,
      58             :                               nsIContent *aBindingParent,
      59             :                               bool aCompileEventHandlers) override;
      60             :   virtual void UnbindFromTree(bool aDeep = true,
      61             :                               bool aNullParent = true) override;
      62             : 
      63             :   virtual bool IsHTMLFocusable(bool aWithMouse, bool *aIsFocusable, int32_t *aTabIndex) override;
      64             :   virtual IMEState GetDesiredIMEState() override;
      65             : 
      66             :   // Overriden nsIFormControl methods
      67             :   NS_IMETHOD Reset() override;
      68             :   NS_IMETHOD SubmitNamesValues(HTMLFormSubmission *aFormSubmission) override;
      69             : 
      70           0 :   virtual bool IsDisabled() const override { return false; }
      71             : 
      72             :   virtual void DoneAddingChildren(bool aHaveNotified) override;
      73             :   virtual bool IsDoneAddingChildren() override;
      74             : 
      75             :   virtual bool ParseAttribute(int32_t aNamespaceID,
      76             :                                 nsIAtom *aAttribute,
      77             :                                 const nsAString &aValue,
      78             :                                 nsAttrValue &aResult) override;
      79             :   virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
      80             :   NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom *aAttribute) const override;
      81             :   virtual EventStates IntrinsicState() const override;
      82             :   virtual void DestroyContent() override;
      83             : 
      84             :   // nsObjectLoadingContent
      85             :   virtual uint32_t GetCapabilities() const override;
      86             : 
      87             :   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
      88             :                          bool aPreallocateChildren) const override;
      89             : 
      90             :   nsresult CopyInnerTo(Element* aDest, bool aPreallocateChildren);
      91             : 
      92           0 :   void StartObjectLoad() { StartObjectLoad(true, false); }
      93             : 
      94           0 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLObjectElement,
      95             :                                            nsGenericHTMLFormElement)
      96             : 
      97             :   // Web IDL binding methods
      98             :   // XPCOM GetData is ok; note that it's a URI attribute with a weird base URI
      99           0 :   void SetData(const nsAString& aValue, ErrorResult& aRv)
     100             :   {
     101           0 :     SetHTMLAttr(nsGkAtoms::data, aValue, aRv);
     102           0 :   }
     103           0 :   void GetType(DOMString& aValue)
     104             :   {
     105           0 :     GetHTMLAttr(nsGkAtoms::type, aValue);
     106           0 :   }
     107           0 :   void SetType(const nsAString& aValue, ErrorResult& aRv)
     108             :   {
     109           0 :     SetHTMLAttr(nsGkAtoms::type, aValue, aRv);
     110           0 :   }
     111           0 :   bool TypeMustMatch()
     112             :   {
     113           0 :     return GetBoolAttr(nsGkAtoms::typemustmatch);
     114             :   }
     115           0 :   void SetTypeMustMatch(bool aValue, ErrorResult& aRv)
     116             :   {
     117           0 :     SetHTMLBoolAttr(nsGkAtoms::typemustmatch, aValue, aRv);
     118           0 :   }
     119           0 :   void GetName(DOMString& aValue)
     120             :   {
     121           0 :     GetHTMLAttr(nsGkAtoms::name, aValue);
     122           0 :   }
     123           0 :   void SetName(const nsAString& aValue, ErrorResult& aRv)
     124             :   {
     125           0 :     SetHTMLAttr(nsGkAtoms::name, aValue, aRv);
     126           0 :   }
     127           0 :   void GetUseMap(DOMString& aValue)
     128             :   {
     129           0 :     GetHTMLAttr(nsGkAtoms::usemap, aValue);
     130           0 :   }
     131           0 :   void SetUseMap(const nsAString& aValue, ErrorResult& aRv)
     132             :   {
     133           0 :     SetHTMLAttr(nsGkAtoms::usemap, aValue, aRv);
     134           0 :   }
     135             :   using nsGenericHTMLFormElement::GetForm;
     136           0 :   void GetWidth(DOMString& aValue)
     137             :   {
     138           0 :     GetHTMLAttr(nsGkAtoms::width, aValue);
     139           0 :   }
     140           0 :   void SetWidth(const nsAString& aValue, ErrorResult& aRv)
     141             :   {
     142           0 :     SetHTMLAttr(nsGkAtoms::width, aValue, aRv);
     143           0 :   }
     144           0 :   void GetHeight(DOMString& aValue)
     145             :   {
     146           0 :     GetHTMLAttr(nsGkAtoms::height, aValue);
     147           0 :   }
     148           0 :   void SetHeight(const nsAString& aValue, ErrorResult& aRv)
     149             :   {
     150           0 :     SetHTMLAttr(nsGkAtoms::height, aValue, aRv);
     151           0 :   }
     152             :   using nsObjectLoadingContent::GetContentDocument;
     153             : 
     154             :   nsPIDOMWindowOuter*
     155             :   GetContentWindow(nsIPrincipal& aSubjectPrincipal);
     156             : 
     157             :   using nsIConstraintValidation::CheckValidity;
     158             :   using nsIConstraintValidation::ReportValidity;
     159             :   using nsIConstraintValidation::GetValidationMessage;
     160           0 :   void GetAlign(DOMString& aValue)
     161             :   {
     162           0 :     GetHTMLAttr(nsGkAtoms::align, aValue);
     163           0 :   }
     164           0 :   void SetAlign(const nsAString& aValue, ErrorResult& aRv)
     165             :   {
     166           0 :     SetHTMLAttr(nsGkAtoms::align, aValue, aRv);
     167           0 :   }
     168           0 :   void GetArchive(DOMString& aValue)
     169             :   {
     170           0 :     GetHTMLAttr(nsGkAtoms::archive, aValue);
     171           0 :   }
     172           0 :   void SetArchive(const nsAString& aValue, ErrorResult& aRv)
     173             :   {
     174           0 :     SetHTMLAttr(nsGkAtoms::archive, aValue, aRv);
     175           0 :   }
     176             :   // XPCOM GetCode is ok
     177           0 :   void SetCode(const nsAString& aValue, ErrorResult& aRv)
     178             :   {
     179           0 :     SetHTMLAttr(nsGkAtoms::code, aValue, aRv);
     180           0 :   }
     181           0 :   bool Declare()
     182             :   {
     183           0 :     return GetBoolAttr(nsGkAtoms::declare);
     184             :   }
     185           0 :   void SetDeclare(bool aValue, ErrorResult& aRv)
     186             :   {
     187           0 :     SetHTMLBoolAttr(nsGkAtoms::declare, aValue, aRv);
     188           0 :   }
     189           0 :   uint32_t Hspace()
     190             :   {
     191           0 :     return GetUnsignedIntAttr(nsGkAtoms::hspace, 0);
     192             :   }
     193           0 :   void SetHspace(uint32_t aValue, ErrorResult& aRv)
     194             :   {
     195           0 :     SetUnsignedIntAttr(nsGkAtoms::hspace, aValue, 0, aRv);
     196           0 :   }
     197           0 :   void GetStandby(DOMString& aValue)
     198             :   {
     199           0 :     GetHTMLAttr(nsGkAtoms::standby, aValue);
     200           0 :   }
     201           0 :   void SetStandby(const nsAString& aValue, ErrorResult& aRv)
     202             :   {
     203           0 :     SetHTMLAttr(nsGkAtoms::standby, aValue, aRv);
     204           0 :   }
     205           0 :   uint32_t Vspace()
     206             :   {
     207           0 :     return GetUnsignedIntAttr(nsGkAtoms::vspace, 0);
     208             :   }
     209           0 :   void SetVspace(uint32_t aValue, ErrorResult& aRv)
     210             :   {
     211           0 :     SetUnsignedIntAttr(nsGkAtoms::vspace, aValue, 0, aRv);
     212           0 :   }
     213             :   // XPCOM GetCodebase is ok; note that it's a URI attribute
     214           0 :   void SetCodeBase(const nsAString& aValue, ErrorResult& aRv)
     215             :   {
     216           0 :     SetHTMLAttr(nsGkAtoms::codebase, aValue, aRv);
     217           0 :   }
     218           0 :   void GetCodeType(DOMString& aValue)
     219             :   {
     220           0 :     GetHTMLAttr(nsGkAtoms::codetype, aValue);
     221           0 :   }
     222           0 :   void SetCodeType(const nsAString& aValue, ErrorResult& aRv)
     223             :   {
     224           0 :     SetHTMLAttr(nsGkAtoms::codetype, aValue, aRv);
     225           0 :   }
     226           0 :   void GetBorder(DOMString& aValue)
     227             :   {
     228           0 :     GetHTMLAttr(nsGkAtoms::border, aValue);
     229           0 :   }
     230           0 :   void SetBorder(const nsAString& aValue, ErrorResult& aRv)
     231             :   {
     232           0 :     SetHTMLAttr(nsGkAtoms::border, aValue, aRv);
     233           0 :   }
     234             : 
     235             :   nsIDocument*
     236           0 :   GetSVGDocument(nsIPrincipal& aSubjectPrincipal)
     237             :   {
     238           0 :     return GetContentDocument(aSubjectPrincipal);
     239             :   }
     240             : 
     241             :   /**
     242             :    * Calls LoadObject with the correct arguments to start the plugin load.
     243             :    */
     244             :   void StartObjectLoad(bool aNotify, bool aForceLoad);
     245             : 
     246             : protected:
     247             :   // Override for nsImageLoadingContent.
     248           0 :   nsIContent* AsContent() override { return this; }
     249             : 
     250             :   virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsIAtom* aName,
     251             :                                 const nsAttrValue* aValue,
     252             :                                 const nsAttrValue* aOldValue,
     253             :                                 bool aNotify) override;
     254             :   virtual nsresult OnAttrSetButNotChanged(int32_t aNamespaceID, nsIAtom* aName,
     255             :                                           const nsAttrValueOrString& aValue,
     256             :                                           bool aNotify) override;
     257             : 
     258             : private:
     259             :   /**
     260             :    * Returns if the element is currently focusable regardless of it's tabindex
     261             :    * value. This is used to know the default tabindex value.
     262             :    */
     263             :   bool IsFocusableForTabIndex();
     264             : 
     265           0 :   nsContentPolicyType GetContentPolicyType() const override
     266             :   {
     267           0 :     return nsIContentPolicy::TYPE_INTERNAL_OBJECT;
     268             :   }
     269             : 
     270             :   virtual ~HTMLObjectElement();
     271             : 
     272             :   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
     273             : 
     274             :   static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
     275             :                                     GenericSpecifiedValues* aGenericData);
     276             : 
     277             :   /**
     278             :    * This function is called by AfterSetAttr and OnAttrSetButNotChanged.
     279             :    * This function will be called by AfterSetAttr whether the attribute is being
     280             :    * set or unset.
     281             :    *
     282             :    * @param aNamespaceID the namespace of the attr being set
     283             :    * @param aName the localname of the attribute being set
     284             :    * @param aNotify Whether we plan to notify document observers.
     285             :    */
     286             :   nsresult AfterMaybeChangeAttr(int32_t aNamespaceID, nsIAtom* aName,
     287             :                                 bool aNotify);
     288             : 
     289             :   bool mIsDoneAddingChildren;
     290             : };
     291             : 
     292             : } // namespace dom
     293             : } // namespace mozilla
     294             : 
     295             : #endif // mozilla_dom_HTMLObjectElement_h

Generated by: LCOV version 1.13