LCOV - code coverage report
Current view: top level - dom/base - nsStyledElement.h (source / functions) Hit Total Coverage
Test: output.info Lines: 4 4 100.0 %
Date: 2017-07-14 16:53:18 Functions: 2 3 66.7 %
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             : /**
       8             :  * nsStyledElement is the base for elements supporting styling via the
       9             :  * id/class/style attributes; it is a common base for their support in HTML,
      10             :  * SVG and MathML.
      11             :  */
      12             : 
      13             : #ifndef __NS_STYLEDELEMENT_H_
      14             : #define __NS_STYLEDELEMENT_H_
      15             : 
      16             : #include "mozilla/Attributes.h"
      17             : #include "nsString.h"
      18             : #include "mozilla/dom/Element.h"
      19             : 
      20             : namespace mozilla {
      21             : class DeclarationBlock;
      22             : } // namespace mozilla
      23             : 
      24             : // IID for nsStyledElement interface
      25             : #define NS_STYLED_ELEMENT_IID \
      26             : { 0xacbd9ea6, 0x15aa, 0x4f37, \
      27             :  { 0x8c, 0xe0, 0x35, 0x1e, 0xd7, 0x21, 0xca, 0xe9 } }
      28             : 
      29             : typedef mozilla::dom::Element nsStyledElementBase;
      30             : 
      31          31 : class nsStyledElement : public nsStyledElementBase
      32             : {
      33             : 
      34             : protected:
      35             : 
      36        2526 :   inline explicit nsStyledElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
      37        2526 :     : nsStyledElementBase(aNodeInfo)
      38        2526 :   {}
      39             : 
      40             : public:
      41             :   // We don't want to implement AddRef/Release because that would add an extra
      42             :   // function call for those on pretty much all elements.  But we do need QI, so
      43             :   // we can QI to nsStyledElement.
      44             :   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
      45             : 
      46             :   // Element interface methods
      47             :   virtual nsresult SetInlineStyleDeclaration(mozilla::DeclarationBlock* aDeclaration,
      48             :                                              const nsAString* aSerialized,
      49             :                                              bool aNotify) override;
      50             : 
      51             :   nsICSSDeclaration* Style();
      52             : 
      53             :   NS_DECLARE_STATIC_IID_ACCESSOR(NS_STYLED_ELEMENT_IID)
      54             : 
      55             : protected:
      56             : 
      57             :   nsICSSDeclaration* GetExistingStyle();
      58             : 
      59             :   /**
      60             :    * Parse a style attr value into a CSS rulestruct (or, if there is no
      61             :    * document, leave it as a string) and return as nsAttrValue.
      62             :    *
      63             :    * @param aValue the value to parse
      64             :    * @param aResult the resulting HTMLValue [OUT]
      65             :    */
      66             :   void ParseStyleAttribute(const nsAString& aValue,
      67             :                            nsAttrValue& aResult,
      68             :                            bool aForceInDataDoc);
      69             : 
      70             :   virtual bool ParseAttribute(int32_t aNamespaceID, nsIAtom* aAttribute,
      71             :                                 const nsAString& aValue, nsAttrValue& aResult) override;
      72             : 
      73             :   friend class mozilla::dom::Element;
      74             : 
      75             :   /**
      76             :    * Create the style struct from the style attr.  Used when an element is
      77             :    * first put into a document.  Only has an effect if the old value is a
      78             :    * string.  If aForceInDataDoc is true, will reparse even if we're in a data
      79             :    * document. If aForceIfAlreadyParsed is set, this will always reparse even
      80             :    * if the value has already been parsed.
      81             :    */
      82             :   nsresult ReparseStyleAttribute(bool aForceInDataDoc, bool aForceIfAlreadyParsed);
      83             : 
      84             :   virtual void NodeInfoChanged(nsIDocument* aOldDoc) override;
      85             : 
      86             :   virtual nsresult BeforeSetAttr(int32_t aNamespaceID, nsIAtom* aName,
      87             :                                  const nsAttrValueOrString* aValue,
      88             :                                  bool aNotify) override;
      89             : };
      90             : 
      91             : NS_DEFINE_STATIC_IID_ACCESSOR(nsStyledElement, NS_STYLED_ELEMENT_IID)
      92             : #endif // __NS_STYLEDELEMENT_H_

Generated by: LCOV version 1.13