Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: Source/core/dom/StyleEngine.h

Issue 330043002: Simplified code for styleResolverChanged. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/dom/ShadowTreeStyleSheetCollection.cpp ('k') | Source/core/dom/StyleEngine.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 class Node; 49 class Node;
50 class RuleFeatureSet; 50 class RuleFeatureSet;
51 class ShadowTreeStyleSheetCollection; 51 class ShadowTreeStyleSheetCollection;
52 class StyleResolver; 52 class StyleResolver;
53 class StyleRuleFontFace; 53 class StyleRuleFontFace;
54 class StyleSheet; 54 class StyleSheet;
55 class StyleSheetCollection; 55 class StyleSheetCollection;
56 class StyleSheetContents; 56 class StyleSheetContents;
57 class StyleSheetList; 57 class StyleSheetList;
58 58
59 class StyleResolverChange {
60 public:
61 StyleResolverChange()
62 : m_needsRepaint(false)
63 , m_needsStyleRecalc(false)
64 { }
65
66 bool needsRepaint() const { return m_needsRepaint; }
67 bool needsStyleRecalc() const { return m_needsStyleRecalc; }
68 void setNeedsRepaint() { m_needsRepaint = true; }
69 void setNeedsStyleRecalc() { m_needsStyleRecalc = true; }
70
71 private:
72 bool m_needsRepaint;
73 bool m_needsStyleRecalc;
74 };
75
76 class StyleEngine FINAL : public CSSFontSelectorClient { 59 class StyleEngine FINAL : public CSSFontSelectorClient {
77 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; 60 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
78 public: 61 public:
79 62
80 class IgnoringPendingStylesheet : public TemporaryChange<bool> { 63 class IgnoringPendingStylesheet : public TemporaryChange<bool> {
81 public: 64 public:
82 IgnoringPendingStylesheet(StyleEngine* engine) 65 IgnoringPendingStylesheet(StyleEngine* engine)
83 : TemporaryChange<bool>(engine->m_ignorePendingStylesheets, true) 66 : TemporaryChange<bool>(engine->m_ignorePendingStylesheets, true)
84 { 67 {
85 } 68 }
(...skipping 26 matching lines...) Expand all
112 void addXSLStyleSheet(ProcessingInstruction*, bool createdByParser); 95 void addXSLStyleSheet(ProcessingInstruction*, bool createdByParser);
113 void removeXSLStyleSheet(ProcessingInstruction*); 96 void removeXSLStyleSheet(ProcessingInstruction*);
114 97
115 void invalidateInjectedStyleSheetCache(); 98 void invalidateInjectedStyleSheetCache();
116 void updateInjectedStyleSheetCache() const; 99 void updateInjectedStyleSheetCache() const;
117 100
118 void addAuthorSheet(PassRefPtrWillBeRawPtr<StyleSheetContents> authorSheet); 101 void addAuthorSheet(PassRefPtrWillBeRawPtr<StyleSheetContents> authorSheet);
119 102
120 void clearMediaQueryRuleSetStyleSheets(); 103 void clearMediaQueryRuleSetStyleSheets();
121 void updateStyleSheetsInImport(DocumentStyleSheetCollector& parentCollector) ; 104 void updateStyleSheetsInImport(DocumentStyleSheetCollector& parentCollector) ;
122 bool updateActiveStyleSheets(StyleResolverUpdateMode); 105 void updateActiveStyleSheets(StyleResolverUpdateMode);
123 106
124 String preferredStylesheetSetName() const { return m_preferredStylesheetSetN ame; } 107 String preferredStylesheetSetName() const { return m_preferredStylesheetSetN ame; }
125 String selectedStylesheetSetName() const { return m_selectedStylesheetSetNam e; } 108 String selectedStylesheetSetName() const { return m_selectedStylesheetSetNam e; }
126 void setPreferredStylesheetSetName(const String& name) { m_preferredStyleshe etSetName = name; } 109 void setPreferredStylesheetSetName(const String& name) { m_preferredStyleshe etSetName = name; }
127 void setSelectedStylesheetSetName(const String& name) { m_selectedStylesheet SetName = name; } 110 void setSelectedStylesheetSetName(const String& name) { m_selectedStylesheet SetName = name; }
128 111
129 void selectStylesheetSetName(const String& name) 112 void selectStylesheetSetName(const String& name)
130 { 113 {
131 setPreferredStylesheetSetName(name); 114 setPreferredStylesheetSetName(name);
132 setSelectedStylesheetSetName(name); 115 setSelectedStylesheetSetName(name);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 void clearMasterResolver(); 158 void clearMasterResolver();
176 159
177 CSSFontSelector* fontSelector() { return m_fontSelector.get(); } 160 CSSFontSelector* fontSelector() { return m_fontSelector.get(); }
178 void removeFontFaceRules(const WillBeHeapVector<RawPtrWillBeMember<const Sty leRuleFontFace> >&); 161 void removeFontFaceRules(const WillBeHeapVector<RawPtrWillBeMember<const Sty leRuleFontFace> >&);
179 void clearFontCache(); 162 void clearFontCache();
180 // updateGenericFontFamilySettings is used from WebSettingsImpl. 163 // updateGenericFontFamilySettings is used from WebSettingsImpl.
181 void updateGenericFontFamilySettings(); 164 void updateGenericFontFamilySettings();
182 165
183 void didDetach(); 166 void didDetach();
184 bool shouldClearResolver() const; 167 bool shouldClearResolver() const;
185 StyleResolverChange resolverChanged(StyleResolverUpdateMode); 168 void resolverChanged(StyleResolverUpdateMode);
186 unsigned resolverAccessCount() const; 169 unsigned resolverAccessCount() const;
187 170
188 void markDocumentDirty(); 171 void markDocumentDirty();
189 172
190 PassRefPtrWillBeRawPtr<CSSStyleSheet> createSheet(Element*, const String& te xt, TextPosition startPosition, bool createdByParser); 173 PassRefPtrWillBeRawPtr<CSSStyleSheet> createSheet(Element*, const String& te xt, TextPosition startPosition, bool createdByParser);
191 void removeSheet(StyleSheetContents*); 174 void removeSheet(StyleSheetContents*);
192 175
193 virtual void trace(Visitor*) OVERRIDE; 176 virtual void trace(Visitor*) OVERRIDE;
194 177
195 private: 178 private:
196 // CSSFontSelectorClient implementation. 179 // CSSFontSelectorClient implementation.
197 virtual void fontsNeedUpdate(CSSFontSelector*) OVERRIDE; 180 virtual void fontsNeedUpdate(CSSFontSelector*) OVERRIDE;
198 181
199 private: 182 private:
200 StyleEngine(Document&); 183 StyleEngine(Document&);
201 184
202 TreeScopeStyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&); 185 TreeScopeStyleSheetCollection* ensureStyleSheetCollectionFor(TreeScope&);
203 TreeScopeStyleSheetCollection* styleSheetCollectionFor(TreeScope&); 186 TreeScopeStyleSheetCollection* styleSheetCollectionFor(TreeScope&);
204 bool shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode); 187 bool shouldUpdateDocumentStyleSheetCollection(StyleResolverUpdateMode) const ;
188 bool shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode) con st;
205 bool shouldApplyXSLTransform() const; 189 bool shouldApplyXSLTransform() const;
206 190
207 void markTreeScopeDirty(TreeScope&); 191 void markTreeScopeDirty(TreeScope&);
208 192
209 bool isMaster() const { return m_isMaster; } 193 bool isMaster() const { return m_isMaster; }
210 Document* master(); 194 Document* master();
211 Document& document() const { return *m_document; } 195 Document& document() const { return *m_document; }
212 196
213 typedef ListHashSet<TreeScope*, 16> TreeScopeSet; 197 typedef ListHashSet<TreeScope*, 16> TreeScopeSet;
214 static void insertTreeScopeInDocumentOrder(TreeScopeSet&, TreeScope*); 198 static void insertTreeScopeInDocumentOrder(TreeScopeSet&, TreeScope*);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 265
282 WillBeHeapHashMap<AtomicString, RawPtrWillBeMember<StyleSheetContents> > m_t extToSheetCache; 266 WillBeHeapHashMap<AtomicString, RawPtrWillBeMember<StyleSheetContents> > m_t extToSheetCache;
283 WillBeHeapHashMap<RawPtrWillBeMember<StyleSheetContents>, AtomicString> m_sh eetToTextCache; 267 WillBeHeapHashMap<RawPtrWillBeMember<StyleSheetContents>, AtomicString> m_sh eetToTextCache;
284 268
285 RefPtr<ProcessingInstruction> m_xslStyleSheet; 269 RefPtr<ProcessingInstruction> m_xslStyleSheet;
286 }; 270 };
287 271
288 } 272 }
289 273
290 #endif 274 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/ShadowTreeStyleSheetCollection.cpp ('k') | Source/core/dom/StyleEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698