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

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

Issue 2420413005: Collect @viewport before constructing RuleSets. (Closed)
Patch Set: Rebased Created 4 years, 2 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
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 namespace blink { 51 namespace blink {
52 52
53 class CSSFontSelector; 53 class CSSFontSelector;
54 class CSSStyleSheet; 54 class CSSStyleSheet;
55 class Node; 55 class Node;
56 class RuleFeatureSet; 56 class RuleFeatureSet;
57 class ShadowTreeStyleSheetCollection; 57 class ShadowTreeStyleSheetCollection;
58 class StyleRuleFontFace; 58 class StyleRuleFontFace;
59 class StyleSheet; 59 class StyleSheet;
60 class StyleSheetContents; 60 class StyleSheetContents;
61 class ViewportStyleResolver;
61 62
62 class CORE_EXPORT StyleEngine final 63 class CORE_EXPORT StyleEngine final
63 : public GarbageCollectedFinalized<StyleEngine>, 64 : public GarbageCollectedFinalized<StyleEngine>,
64 public CSSFontSelectorClient { 65 public CSSFontSelectorClient {
65 USING_GARBAGE_COLLECTED_MIXIN(StyleEngine); 66 USING_GARBAGE_COLLECTED_MIXIN(StyleEngine);
66 67
67 public: 68 public:
68 class IgnoringPendingStylesheet { 69 class IgnoringPendingStylesheet {
69 DISALLOW_NEW(); 70 DISALLOW_NEW();
70 71
(...skipping 22 matching lines...) Expand all
93 CSSStyleSheet* inspectorStyleSheet() const { return m_inspectorStyleSheet; } 94 CSSStyleSheet* inspectorStyleSheet() const { return m_inspectorStyleSheet; }
94 95
95 const HeapVector<Member<CSSStyleSheet>> activeStyleSheetsForInspector() const; 96 const HeapVector<Member<CSSStyleSheet>> activeStyleSheetsForInspector() const;
96 97
97 void setNeedsActiveStyleUpdate(StyleSheet*, StyleResolverUpdateMode); 98 void setNeedsActiveStyleUpdate(StyleSheet*, StyleResolverUpdateMode);
98 void addStyleSheetCandidateNode(Node&); 99 void addStyleSheetCandidateNode(Node&);
99 void removeStyleSheetCandidateNode(Node&); 100 void removeStyleSheetCandidateNode(Node&);
100 void removeStyleSheetCandidateNode(Node&, TreeScope&); 101 void removeStyleSheetCandidateNode(Node&, TreeScope&);
101 void modifiedStyleSheetCandidateNode(Node&); 102 void modifiedStyleSheetCandidateNode(Node&);
102 void watchedSelectorsChanged(); 103 void watchedSelectorsChanged();
104 void initialViewportChanged();
105 void viewportRulesChanged();
103 106
104 void injectAuthorSheet(StyleSheetContents* authorSheet); 107 void injectAuthorSheet(StyleSheetContents* authorSheet);
105 CSSStyleSheet& ensureInspectorStyleSheet(); 108 CSSStyleSheet& ensureInspectorStyleSheet();
106 109
107 void clearMediaQueryRuleSetStyleSheets(); 110 void clearMediaQueryRuleSetStyleSheets();
108 void updateStyleSheetsInImport(DocumentStyleSheetCollector& parentCollector); 111 void updateStyleSheetsInImport(DocumentStyleSheetCollector& parentCollector);
109 void updateActiveStyleSheets(StyleResolverUpdateMode); 112 void updateActiveStyleSheets(StyleResolverUpdateMode);
110 113
111 enum ActiveSheetsUpdate { DontUpdateActiveSheets, UpdateActiveSheets }; 114 enum ActiveSheetsUpdate { DontUpdateActiveSheets, UpdateActiveSheets };
112 String preferredStylesheetSetName() const { 115 String preferredStylesheetSetName() const {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 void didRemoveShadowRoot(ShadowRoot*); 157 void didRemoveShadowRoot(ShadowRoot*);
155 void shadowRootRemovedFromDocument(ShadowRoot*); 158 void shadowRootRemovedFromDocument(ShadowRoot*);
156 void appendActiveAuthorStyleSheets(); 159 void appendActiveAuthorStyleSheets();
157 160
158 StyleResolver* resolver() const { return m_resolver.get(); } 161 StyleResolver* resolver() const { return m_resolver.get(); }
159 162
160 StyleResolver& ensureResolver() { 163 StyleResolver& ensureResolver() {
161 if (!m_resolver) { 164 if (!m_resolver) {
162 createResolver(); 165 createResolver();
163 } else if (m_resolver->hasPendingAuthorStyleSheets()) { 166 } else if (m_resolver->hasPendingAuthorStyleSheets()) {
167 viewportRulesChanged();
164 m_resolver->appendPendingAuthorStyleSheets(); 168 m_resolver->appendPendingAuthorStyleSheets();
165 } 169 }
166 return *m_resolver.get(); 170 return *m_resolver.get();
167 } 171 }
168 172
169 bool hasResolver() const { return m_resolver.get(); } 173 bool hasResolver() const { return m_resolver.get(); }
170 void clearResolver(); 174 void clearResolver();
171 void clearMasterResolver(); 175 void clearMasterResolver();
172 176
173 StyleInvalidator& styleInvalidator() { return m_styleInvalidator; } 177 StyleInvalidator& styleInvalidator() { return m_styleInvalidator; }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 bool m_usesSiblingRules = false; 310 bool m_usesSiblingRules = false;
307 bool m_usesFirstLineRules = false; 311 bool m_usesFirstLineRules = false;
308 bool m_usesWindowInactiveSelector = false; 312 bool m_usesWindowInactiveSelector = false;
309 bool m_usesRemUnits = false; 313 bool m_usesRemUnits = false;
310 unsigned m_maxDirectAdjacentSelectors = 0; 314 unsigned m_maxDirectAdjacentSelectors = 0;
311 315
312 bool m_ignorePendingStylesheets = false; 316 bool m_ignorePendingStylesheets = false;
313 bool m_didCalculateResolver = false; 317 bool m_didCalculateResolver = false;
314 318
315 Member<StyleResolver> m_resolver; 319 Member<StyleResolver> m_resolver;
320 Member<ViewportStyleResolver> m_viewportResolver;
316 StyleInvalidator m_styleInvalidator; 321 StyleInvalidator m_styleInvalidator;
317 322
318 Member<CSSFontSelector> m_fontSelector; 323 Member<CSSFontSelector> m_fontSelector;
319 324
320 HeapHashMap<AtomicString, WeakMember<StyleSheetContents>> m_textToSheetCache; 325 HeapHashMap<AtomicString, WeakMember<StyleSheetContents>> m_textToSheetCache;
321 HeapHashMap<WeakMember<StyleSheetContents>, AtomicString> m_sheetToTextCache; 326 HeapHashMap<WeakMember<StyleSheetContents>, AtomicString> m_sheetToTextCache;
322 327
323 std::unique_ptr<StyleResolverStats> m_styleResolverStats; 328 std::unique_ptr<StyleResolverStats> m_styleResolverStats;
324 unsigned m_styleForElementCount = 0; 329 unsigned m_styleForElementCount = 0;
325 330
326 friend class StyleEngineTest; 331 friend class StyleEngineTest;
327 }; 332 };
328 333
329 } // namespace blink 334 } // namespace blink
330 335
331 #endif 336 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698