OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CSSGlobalRuleSet_h |
| 6 #define CSSGlobalRuleSet_h |
| 7 |
| 8 #include "core/css/RuleFeature.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 class Document; |
| 13 class RuleSet; |
| 14 |
| 15 // A per Document collection of CSS metadata used for style matching and |
| 16 // invalidation. The data is aggregated from author rulesets from all TreeScopes |
| 17 // in the whole Document as well as UA stylesheets and watched selectors which |
| 18 // apply to elements in all TreeScopes. |
| 19 // |
| 20 // TODO(rune@opera.com): We would like to move as much of this data as possible |
| 21 // to the ScopedStyleResolver as possible to avoid full reconstruction of these |
| 22 // rulesets on shadow tree changes. See https://crbug.com/401359 |
| 23 |
| 24 class CSSGlobalRuleSet { |
| 25 DISALLOW_NEW(); |
| 26 WTF_MAKE_NONCOPYABLE(CSSGlobalRuleSet); |
| 27 |
| 28 public: |
| 29 CSSGlobalRuleSet() {} |
| 30 |
| 31 void initWatchedSelectorsRuleSet(Document&); |
| 32 void markDirty() { m_isDirty = true; } |
| 33 bool isDirty() const { return m_isDirty; } |
| 34 void update(Document&); |
| 35 |
| 36 const RuleFeatureSet& ruleFeatureSet() const { |
| 37 RELEASE_ASSERT(m_features.isAlive()); |
| 38 return m_features; |
| 39 } |
| 40 RuleSet* siblingRuleSet() const { return m_siblingRuleSet; } |
| 41 RuleSet* uncommonAttributeRuleSet() const { |
| 42 return m_uncommonAttributeRuleSet; |
| 43 } |
| 44 RuleSet* watchedSelectorsRuleSet() const { return m_watchedSelectorsRuleSet; } |
| 45 bool hasFullscreenUAStyle() const { return m_hasFullscreenUAStyle; } |
| 46 |
| 47 DECLARE_TRACE(); |
| 48 |
| 49 private: |
| 50 // Constructed from rules in all TreeScopes including UA style and style |
| 51 // injected from extensions. |
| 52 RuleFeatureSet m_features; |
| 53 Member<RuleSet> m_siblingRuleSet; |
| 54 Member<RuleSet> m_uncommonAttributeRuleSet; |
| 55 |
| 56 // Rules injected from extensions. |
| 57 Member<RuleSet> m_watchedSelectorsRuleSet; |
| 58 |
| 59 bool m_hasFullscreenUAStyle = false; |
| 60 bool m_isDirty = true; |
| 61 }; |
| 62 |
| 63 } // namespace blink |
| 64 |
| 65 #endif // CSSGlobalRuleSet_h |
OLD | NEW |