OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All r
ights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 8 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
9 * Copyright (C) 2011 Google Inc. All rights reserved. | 9 * Copyright (C) 2011 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 class StyleSheetList; | 50 class StyleSheetList; |
51 | 51 |
52 // FIXME: Should be in separate file and be renamed like: | 52 // FIXME: Should be in separate file and be renamed like: |
53 // - StyleSheetCollectionBase -> StyleSheetCollection | 53 // - StyleSheetCollectionBase -> StyleSheetCollection |
54 // - StyleSheetCollection -> ScopeStyleSheetCollection | 54 // - StyleSheetCollection -> ScopeStyleSheetCollection |
55 // | 55 // |
56 class StyleSheetCollectionBase { | 56 class StyleSheetCollectionBase { |
57 WTF_MAKE_NONCOPYABLE(StyleSheetCollectionBase); WTF_MAKE_FAST_ALLOCATED; | 57 WTF_MAKE_NONCOPYABLE(StyleSheetCollectionBase); WTF_MAKE_FAST_ALLOCATED; |
58 public: | 58 public: |
59 StyleSheetCollectionBase(); | 59 StyleSheetCollectionBase(); |
60 ~StyleSheetCollectionBase(); | 60 virtual ~StyleSheetCollectionBase(); |
61 | 61 |
62 Vector<RefPtr<CSSStyleSheet> >& activeAuthorStyleSheets() { return m_activeA
uthorStyleSheets; } | 62 Vector<RefPtr<CSSStyleSheet> >& activeAuthorStyleSheets() { return m_activeA
uthorStyleSheets; } |
63 Vector<RefPtr<StyleSheet> >& styleSheetsForStyleSheetList() { return m_style
SheetsForStyleSheetList; } | 63 Vector<RefPtr<StyleSheet> >& styleSheetsForStyleSheetList() { return m_style
SheetsForStyleSheetList; } |
64 const Vector<RefPtr<CSSStyleSheet> >& activeAuthorStyleSheets() const { retu
rn m_activeAuthorStyleSheets; } | 64 const Vector<RefPtr<CSSStyleSheet> >& activeAuthorStyleSheets() const { retu
rn m_activeAuthorStyleSheets; } |
65 const Vector<RefPtr<StyleSheet> >& styleSheetsForStyleSheetList() const { re
turn m_styleSheetsForStyleSheetList; } | 65 const Vector<RefPtr<StyleSheet> >& styleSheetsForStyleSheetList() const { re
turn m_styleSheetsForStyleSheetList; } |
66 | 66 |
67 void swap(StyleSheetCollectionBase&); | 67 void swap(StyleSheetCollectionBase&); |
68 void appendActiveStyleSheets(const Vector<RefPtr<CSSStyleSheet> >&); | 68 void appendActiveStyleSheets(const Vector<RefPtr<CSSStyleSheet> >&); |
69 void appendActiveStyleSheet(CSSStyleSheet*); | 69 void appendActiveStyleSheet(CSSStyleSheet*); |
70 void appendSheetForList(StyleSheet*); | 70 void appendSheetForList(StyleSheet*); |
71 | 71 |
72 protected: | 72 protected: |
73 Vector<RefPtr<StyleSheet> > m_styleSheetsForStyleSheetList; | 73 Vector<RefPtr<StyleSheet> > m_styleSheetsForStyleSheetList; |
74 Vector<RefPtr<CSSStyleSheet> > m_activeAuthorStyleSheets; | 74 Vector<RefPtr<CSSStyleSheet> > m_activeAuthorStyleSheets; |
75 }; | 75 }; |
76 | 76 |
77 | 77 |
78 class StyleSheetCollection : public StyleSheetCollectionBase { | 78 class StyleSheetCollection : public StyleSheetCollectionBase { |
79 public: | 79 public: |
| 80 bool updateActiveStyleSheets(StyleEngine*, StyleResolverUpdateMode); |
| 81 |
80 void addStyleSheetCandidateNode(Node*, bool createdByParser); | 82 void addStyleSheetCandidateNode(Node*, bool createdByParser); |
81 void removeStyleSheetCandidateNode(Node*, ContainerNode* scopingNode); | 83 void removeStyleSheetCandidateNode(Node*, ContainerNode* scopingNode); |
82 bool hasStyleSheetCandidateNodes() const { return !m_styleSheetCandidateNode
s.isEmpty(); } | 84 bool hasStyleSheetCandidateNodes() const { return !m_styleSheetCandidateNode
s.isEmpty(); } |
83 | 85 |
84 | 86 |
85 bool usesRemUnits() const { return m_usesRemUnits; } | 87 bool usesRemUnits() const { return m_usesRemUnits; } |
86 | 88 |
87 DocumentOrderedList& styleSheetCandidateNodes() { return m_styleSheetCandida
teNodes; } | 89 DocumentOrderedList& styleSheetCandidateNodes() { return m_styleSheetCandida
teNodes; } |
88 DocumentOrderedList* scopingNodesForStyleScoped() { return m_scopingNodesFor
StyleScoped.scopingNodes(); } | 90 DocumentOrderedList* scopingNodesForStyleScoped() { return m_scopingNodesFor
StyleScoped.scopingNodes(); } |
89 ListHashSet<Node*, 4>* scopingNodesRemoved() { return m_scopingNodesForStyle
Scoped.scopingNodesRemoved(); } | 91 ListHashSet<Node*, 4>* scopingNodesRemoved() { return m_scopingNodesForStyle
Scoped.scopingNodesRemoved(); } |
90 | 92 |
91 void clearMediaQueryRuleSetStyleSheets(); | 93 void clearMediaQueryRuleSetStyleSheets(); |
92 | 94 |
93 protected: | 95 protected: |
94 explicit StyleSheetCollection(TreeScope&); | 96 explicit StyleSheetCollection(TreeScope&); |
95 | 97 |
96 Document* document() { return m_treeScope.documentScope(); } | 98 Document* document() { return m_treeScope.documentScope(); } |
97 | 99 |
98 enum StyleResolverUpdateType { | 100 enum StyleResolverUpdateType { |
99 Reconstruct, | 101 Reconstruct, |
100 Reset, | |
101 Additive, | 102 Additive, |
102 ResetStyleResolverAndFontSelector | |
103 }; | 103 }; |
104 | 104 |
105 struct StyleSheetChange { | 105 struct StyleSheetChange { |
106 StyleResolverUpdateType styleResolverUpdateType; | 106 StyleResolverUpdateType styleResolverUpdateType; |
107 bool requiresFullStyleRecalc; | 107 bool requiresFullStyleRecalc; |
108 | 108 |
109 StyleSheetChange() | 109 StyleSheetChange() |
110 : styleResolverUpdateType(Reconstruct) | 110 : styleResolverUpdateType(Reconstruct) |
111 , requiresFullStyleRecalc(true) { } | 111 , requiresFullStyleRecalc(true) { } |
112 }; | 112 }; |
113 | 113 |
114 void analyzeStyleSheetChange(StyleResolverUpdateMode, const StyleSheetCollec
tionBase&, StyleSheetChange&); | 114 void analyzeStyleSheetChange(StyleResolverUpdateMode, const StyleSheetCollec
tionBase&, StyleSheetChange&); |
115 void resetAllRuleSetsInTreeScope(StyleResolver*); | |
116 void updateUsesRemUnits(); | 115 void updateUsesRemUnits(); |
117 | 116 |
| 117 virtual void collectStyleSheets(StyleEngine*, StyleSheetCollectionBase&) = 0
; |
| 118 |
118 private: | 119 private: |
119 static StyleResolverUpdateType compareStyleSheets(const Vector<RefPtr<CSSSty
leSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStylesheets
, Vector<StyleSheetContents*>& addedSheets); | 120 static StyleResolverUpdateType compareStyleSheets(const Vector<RefPtr<CSSSty
leSheet> >& oldStyleSheets, const Vector<RefPtr<CSSStyleSheet> >& newStylesheets
, Vector<StyleSheetContents*>& addedSheets); |
120 bool activeLoadingStyleSheetLoaded(const Vector<RefPtr<CSSStyleSheet> >& new
StyleSheets); | 121 bool activeLoadingStyleSheetLoaded(const Vector<RefPtr<CSSStyleSheet> >& new
StyleSheets); |
121 | 122 |
122 protected: | 123 protected: |
123 TreeScope& m_treeScope; | 124 TreeScope& m_treeScope; |
124 bool m_hadActiveLoadingStylesheet; | 125 bool m_hadActiveLoadingStylesheet; |
125 bool m_usesRemUnits; | 126 bool m_usesRemUnits; |
126 | 127 |
127 DocumentOrderedList m_styleSheetCandidateNodes; | 128 DocumentOrderedList m_styleSheetCandidateNodes; |
128 StyleSheetScopingNodeList m_scopingNodesForStyleScoped; | 129 StyleSheetScopingNodeList m_scopingNodesForStyleScoped; |
129 }; | 130 }; |
130 | 131 |
131 } | 132 } |
132 | 133 |
133 #endif | 134 #endif |
134 | 135 |
OLD | NEW |