LCOV - code coverage report
Current view: top level - layout/inspector - ServoStyleRuleMap.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 3 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 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_ServoStyleRuleMap_h
       8             : #define mozilla_ServoStyleRuleMap_h
       9             : 
      10             : #include "mozilla/ServoStyleRule.h"
      11             : 
      12             : #include "nsDataHashtable.h"
      13             : #include "nsICSSLoaderObserver.h"
      14             : #include "nsStubDocumentObserver.h"
      15             : 
      16             : struct RawServoStyleRule;
      17             : 
      18             : namespace mozilla {
      19             : class ServoCSSRuleList;
      20             : class ServoStyleSet;
      21             : namespace css {
      22             : class Rule;
      23             : } // namespace css
      24             : 
      25             : class ServoStyleRuleMap final : public nsStubDocumentObserver
      26             :                               , public nsICSSLoaderObserver
      27             : {
      28             : public:
      29             :   NS_DECL_ISUPPORTS
      30             : 
      31             :   explicit ServoStyleRuleMap(ServoStyleSet* aStyleSet);
      32             : 
      33             :   void EnsureTable();
      34           0 :   ServoStyleRule* Lookup(const RawServoStyleRule* aRawRule) const {
      35           0 :     return mTable.Get(aRawRule);
      36             :   }
      37             : 
      38             :   // nsIDocumentObserver methods
      39             :   void StyleSheetAdded(StyleSheet* aStyleSheet, bool aDocumentSheet) final;
      40             :   void StyleSheetRemoved(StyleSheet* aStyleSheet, bool aDocumentSheet) final;
      41             :   void StyleSheetApplicableStateChanged(StyleSheet* aStyleSheet) final;
      42             :   void StyleRuleAdded(StyleSheet* aStyleSheet, css::Rule* aStyleRule) final;
      43             :   void StyleRuleRemoved(StyleSheet* aStyleSheet, css::Rule* aStyleRule) final;
      44             : 
      45             :   // nsICSSLoaderObserver
      46             :   NS_IMETHOD StyleSheetLoaded(StyleSheet* aSheet,
      47             :                               bool aWasAlternate, nsresult aStatus) final;
      48             : 
      49             :   size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
      50             : 
      51             : private:
      52             :   ~ServoStyleRuleMap();
      53             : 
      54             :   // Since we would never have a document which contains no style rule,
      55             :   // we use IsEmpty as an indication whether we need to walk through
      56             :   // all stylesheets to fill the table.
      57           0 :   bool IsEmpty() const { return mTable.Count() == 0; }
      58             : 
      59             :   void FillTableFromRule(css::Rule* aRule);
      60             :   void FillTableFromRuleList(ServoCSSRuleList* aRuleList);
      61             :   void FillTableFromStyleSheet(ServoStyleSheet* aSheet);
      62             : 
      63             :   typedef nsDataHashtable<nsPtrHashKey<const RawServoStyleRule>,
      64             :                           WeakPtr<ServoStyleRule>> Hashtable;
      65             :   Hashtable mTable;
      66             :   ServoStyleSet* mStyleSet;
      67             : };
      68             : 
      69             : } // namespace mozilla
      70             : 
      71             : #endif // mozilla_ServoStyleRuleMap_h

Generated by: LCOV version 1.13