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

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

Issue 2484863003: Make updateStyleAndLayoutTree ready for async stylesheet update. (Closed)
Patch Set: Rebased Created 4 years, 1 month 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
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 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 styleSheetsForStyleSheetList(TreeScope&); 94 styleSheetsForStyleSheetList(TreeScope&);
95 95
96 const HeapVector<TraceWrapperMember<CSSStyleSheet>>& 96 const HeapVector<TraceWrapperMember<CSSStyleSheet>>&
97 injectedAuthorStyleSheets() const { 97 injectedAuthorStyleSheets() const {
98 return m_injectedAuthorStyleSheets; 98 return m_injectedAuthorStyleSheets;
99 } 99 }
100 CSSStyleSheet* inspectorStyleSheet() const { return m_inspectorStyleSheet; } 100 CSSStyleSheet* inspectorStyleSheet() const { return m_inspectorStyleSheet; }
101 101
102 const HeapVector<Member<CSSStyleSheet>> activeStyleSheetsForInspector() const; 102 const HeapVector<Member<CSSStyleSheet>> activeStyleSheetsForInspector() const;
103 103
104 bool needsActiveStyleUpdate() const;
104 void setNeedsActiveStyleUpdate(StyleSheet*, StyleResolverUpdateMode); 105 void setNeedsActiveStyleUpdate(StyleSheet*, StyleResolverUpdateMode);
105 void addStyleSheetCandidateNode(Node&); 106 void addStyleSheetCandidateNode(Node&);
106 void removeStyleSheetCandidateNode(Node&); 107 void removeStyleSheetCandidateNode(Node&);
107 void removeStyleSheetCandidateNode(Node&, TreeScope&); 108 void removeStyleSheetCandidateNode(Node&, TreeScope&);
108 void modifiedStyleSheetCandidateNode(Node&); 109 void modifiedStyleSheetCandidateNode(Node&);
109 void watchedSelectorsChanged(); 110 void watchedSelectorsChanged();
110 void initialViewportChanged(); 111 void initialViewportChanged();
111 void viewportRulesChanged(); 112 void viewportRulesChanged();
112 113
113 void injectAuthorSheet(StyleSheetContents* authorSheet); 114 void injectAuthorSheet(StyleSheetContents* authorSheet);
114 CSSStyleSheet& ensureInspectorStyleSheet(); 115 CSSStyleSheet& ensureInspectorStyleSheet();
115 RuleSet* watchedSelectorsRuleSet() { 116 RuleSet* watchedSelectorsRuleSet() {
116 return m_globalRuleSet.watchedSelectorsRuleSet(); 117 return m_globalRuleSet.watchedSelectorsRuleSet();
117 } 118 }
118 119
119 void clearMediaQueryRuleSetStyleSheets(); 120 void clearMediaQueryRuleSetStyleSheets();
120 void updateStyleSheetsInImport(DocumentStyleSheetCollector& parentCollector); 121 void updateStyleSheetsInImport(DocumentStyleSheetCollector& parentCollector);
121 void updateActiveStyleSheets(StyleResolverUpdateMode); 122 void updateActiveStyleSheets(StyleResolverUpdateMode);
123 void updateActiveStyle();
122 124
123 enum ActiveSheetsUpdate { DontUpdateActiveSheets, UpdateActiveSheets }; 125 enum ActiveSheetsUpdate { DontUpdateActiveSheets, UpdateActiveSheets };
124 String preferredStylesheetSetName() const { 126 String preferredStylesheetSetName() const {
125 return m_preferredStylesheetSetName; 127 return m_preferredStylesheetSetName;
126 } 128 }
127 String selectedStylesheetSetName() const { 129 String selectedStylesheetSetName() const {
128 return m_selectedStylesheetSetName; 130 return m_selectedStylesheetSetName;
129 } 131 }
130 void setPreferredStylesheetSetNameIfNotSet(const String&, ActiveSheetsUpdate); 132 void setPreferredStylesheetSetNameIfNotSet(const String&, ActiveSheetsUpdate);
131 void setSelectedStylesheetSetName(const String&); 133 void setSelectedStylesheetSetName(const String&);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 const DocumentOrderedList& treeBoundaryCrossingScopes() const { 172 const DocumentOrderedList& treeBoundaryCrossingScopes() const {
171 return m_treeBoundaryCrossingScopes; 173 return m_treeBoundaryCrossingScopes;
172 } 174 }
173 void resetAuthorStyle(TreeScope&); 175 void resetAuthorStyle(TreeScope&);
174 176
175 StyleResolver* resolver() const { return m_resolver; } 177 StyleResolver* resolver() const { return m_resolver; }
176 178
177 void setRuleUsageTracker(StyleRuleUsageTracker*); 179 void setRuleUsageTracker(StyleRuleUsageTracker*);
178 180
179 StyleResolver& ensureResolver() { 181 StyleResolver& ensureResolver() {
182 updateActiveStyle();
180 if (!m_resolver) { 183 if (!m_resolver) {
181 createResolver(); 184 createResolver();
182 } else if (m_resolver->hasPendingAuthorStyleSheets()) { 185 } else if (m_resolver->hasPendingAuthorStyleSheets()) {
183 viewportRulesChanged();
184 m_resolver->appendPendingAuthorStyleSheets(); 186 m_resolver->appendPendingAuthorStyleSheets();
185 finishAppendAuthorStyleSheets(); 187 finishAppendAuthorStyleSheets();
186 } else if (m_globalRuleSet.isDirty()) { 188 } else if (m_globalRuleSet.isDirty()) {
187 m_globalRuleSet.update(document()); 189 m_globalRuleSet.update(document());
188 } 190 }
189 return *m_resolver; 191 return *m_resolver;
190 } 192 }
191 193
192 bool hasResolver() const { return m_resolver; } 194 bool hasResolver() const { return m_resolver; }
193 void clearResolver(); 195 void clearResolver();
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 StyleResolverUpdateMode, 306 StyleResolverUpdateMode,
305 TreeScope*, 307 TreeScope*,
306 UnorderedTreeScopeSet& treeScopesRemoved); 308 UnorderedTreeScopeSet& treeScopesRemoved);
307 309
308 bool shouldSkipInvalidationFor(const Element&) const; 310 bool shouldSkipInvalidationFor(const Element&) const;
309 void scheduleRuleSetInvalidationsForElement( 311 void scheduleRuleSetInvalidationsForElement(
310 Element&, 312 Element&,
311 const HeapVector<Member<RuleSet>>&); 313 const HeapVector<Member<RuleSet>>&);
312 void invalidateSlottedElements(HTMLSlotElement&); 314 void invalidateSlottedElements(HTMLSlotElement&);
313 315
316 void updateViewport();
317 void updateActiveStyleSheets();
318
314 Member<Document> m_document; 319 Member<Document> m_document;
315 bool m_isMaster; 320 bool m_isMaster;
316 321
317 // Track the number of currently loading top-level stylesheets needed for 322 // Track the number of currently loading top-level stylesheets needed for
318 // layout. Sheets loaded using the @import directive are not included in this 323 // layout. Sheets loaded using the @import directive are not included in this
319 // count. We use this count of pending sheets to detect when we can begin 324 // count. We use this count of pending sheets to detect when we can begin
320 // attaching elements and when it is safe to execute scripts. 325 // attaching elements and when it is safe to execute scripts.
321 int m_pendingScriptBlockingStylesheets = 0; 326 int m_pendingScriptBlockingStylesheets = 0;
322 int m_pendingRenderBlockingStylesheets = 0; 327 int m_pendingRenderBlockingStylesheets = 0;
323 328
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 364
360 std::unique_ptr<StyleResolverStats> m_styleResolverStats; 365 std::unique_ptr<StyleResolverStats> m_styleResolverStats;
361 unsigned m_styleForElementCount = 0; 366 unsigned m_styleForElementCount = 0;
362 367
363 friend class StyleEngineTest; 368 friend class StyleEngineTest;
364 }; 369 };
365 370
366 } // namespace blink 371 } // namespace blink
367 372
368 #endif 373 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698