LCOV - code coverage report
Current view: top level - layout/style - nsCSSFontFaceRule.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 16 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 20 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 nsCSSFontFaceRule_h
       8             : #define nsCSSFontFaceRule_h
       9             : 
      10             : #include "mozilla/css/Rule.h"
      11             : #include "nsCSSValue.h"
      12             : #include "nsICSSDeclaration.h"
      13             : #include "nsIDOMCSSFontFaceRule.h"
      14             : 
      15             : namespace mozilla {
      16             : 
      17           0 : struct CSSFontFaceDescriptors
      18             : {
      19             : #define CSS_FONT_DESC(name_, method_) nsCSSValue m##method_;
      20             : #include "nsCSSFontDescList.h"
      21             : #undef CSS_FONT_DESC
      22             : 
      23             :   const nsCSSValue& Get(nsCSSFontDesc aFontDescID) const;
      24             :   nsCSSValue& Get(nsCSSFontDesc aFontDescID);
      25             : 
      26             : private:
      27             :   static nsCSSValue CSSFontFaceDescriptors::* const Fields[];
      28             : };
      29             : 
      30             : } // namespace mozilla
      31             : 
      32             : // A nsCSSFontFaceStyleDecl is always embedded in a nsCSSFontFaceRule.
      33             : class nsCSSFontFaceRule;
      34           0 : class nsCSSFontFaceStyleDecl final : public nsICSSDeclaration
      35             : {
      36             : public:
      37             :   NS_DECL_ISUPPORTS_INHERITED
      38             :   NS_DECL_NSIDOMCSSSTYLEDECLARATION_HELPER
      39             :   NS_DECL_NSICSSDECLARATION
      40             :   virtual already_AddRefed<mozilla::dom::CSSValue>
      41             :   GetPropertyCSSValue(const nsAString& aProp, mozilla::ErrorResult& aRv)
      42             :     override;
      43             :   using nsICSSDeclaration::GetPropertyCSSValue;
      44             : 
      45             :   virtual nsINode *GetParentObject() override;
      46             :   virtual void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName) override;
      47             : 
      48             :   nsresult GetPropertyValue(nsCSSFontDesc aFontDescID,
      49             :                             nsAString & aResult) const;
      50             : 
      51             :   virtual JSObject* WrapObject(JSContext *cx, JS::Handle<JSObject*> aGivenProto) override;
      52             : 
      53             : protected:
      54           0 :   ~nsCSSFontFaceStyleDecl() {}
      55             : 
      56             :   friend class nsCSSFontFaceRule;
      57             : 
      58             :   inline nsCSSFontFaceRule* ContainingRule();
      59             :   inline const nsCSSFontFaceRule* ContainingRule() const;
      60             : 
      61             :   mozilla::CSSFontFaceDescriptors mDescriptors;
      62             : 
      63             :   // The actual implementation of GetCssText, so we can make it const.
      64             :   void GetCssTextImpl(nsAString& aCssText) const;
      65             : 
      66             : private:
      67             :   // NOT TO BE IMPLEMENTED
      68             :   // This object cannot be allocated on its own, only as part of
      69             :   // nsCSSFontFaceRule.
      70             :   void* operator new(size_t size) CPP_THROW_NEW;
      71             : };
      72             : 
      73             : class nsCSSFontFaceRule final : public mozilla::css::Rule,
      74             :                                 public nsIDOMCSSFontFaceRule
      75             : {
      76             : public:
      77           0 :   nsCSSFontFaceRule(uint32_t aLineNumber, uint32_t aColumnNumber)
      78           0 :     : mozilla::css::Rule(aLineNumber, aColumnNumber)
      79             :   {
      80           0 :   }
      81             : 
      82           0 :   nsCSSFontFaceRule(const nsCSSFontFaceRule& aCopy)
      83             :     // copy everything except our reference count
      84           0 :     : mozilla::css::Rule(aCopy), mDecl(aCopy.mDecl)
      85             :   {
      86           0 :   }
      87             : 
      88             :   NS_DECL_ISUPPORTS_INHERITED
      89           0 :   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(nsCSSFontFaceRule,
      90             :                                                          mozilla::css::Rule)
      91             :   virtual bool IsCCLeaf() const override;
      92             : 
      93             : #ifdef DEBUG
      94             :   virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
      95             : #endif
      96             :   virtual int32_t GetType() const override;
      97             :   using Rule::GetType;
      98             :   virtual already_AddRefed<mozilla::css::Rule> Clone() const override;
      99             : 
     100             :   // nsIDOMCSSFontFaceRule interface
     101             :   NS_DECL_NSIDOMCSSFONTFACERULE
     102             : 
     103             :   void SetDesc(nsCSSFontDesc aDescID, nsCSSValue const & aValue);
     104             :   void GetDesc(nsCSSFontDesc aDescID, nsCSSValue & aValue);
     105             : 
     106             :   // WebIDL interface
     107             :   uint16_t Type() const override;
     108             :   void GetCssTextImpl(nsAString& aCssText) const override;
     109             :   nsICSSDeclaration* Style();
     110             : 
     111             :   virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const override;
     112             : 
     113             :   virtual JSObject* WrapObject(JSContext* aCx,
     114             :                                JS::Handle<JSObject*> aGivenProto) override;
     115             : 
     116           0 :   void GetDescriptors(mozilla::CSSFontFaceDescriptors& aDescriptors) const
     117           0 :     { aDescriptors = mDecl.mDescriptors; }
     118             : 
     119             : protected:
     120           0 :   ~nsCSSFontFaceRule() {}
     121             : 
     122             :   friend class nsCSSFontFaceStyleDecl;
     123             :   nsCSSFontFaceStyleDecl mDecl;
     124             : };
     125             : 
     126             : // nsFontFaceRuleContainer - used for associating sheet type with
     127             : // specific @font-face rules
     128           0 : struct nsFontFaceRuleContainer {
     129             :   RefPtr<nsCSSFontFaceRule> mRule;
     130             :   mozilla::SheetType mSheetType;
     131             : };
     132             : 
     133             : inline nsCSSFontFaceRule*
     134           0 : nsCSSFontFaceStyleDecl::ContainingRule()
     135             : {
     136             :   return reinterpret_cast<nsCSSFontFaceRule*>
     137           0 :     (reinterpret_cast<char*>(this) - offsetof(nsCSSFontFaceRule, mDecl));
     138             : }
     139             : 
     140             : inline const nsCSSFontFaceRule*
     141             : nsCSSFontFaceStyleDecl::ContainingRule() const
     142             : {
     143             :   return reinterpret_cast<const nsCSSFontFaceRule*>
     144             :     (reinterpret_cast<const char*>(this) - offsetof(nsCSSFontFaceRule, mDecl));
     145             : }
     146             : 
     147             : #endif // nsCSSFontFaceRule_h

Generated by: LCOV version 1.13