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

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

Issue 1903803002: Do not block painting for in-body CSS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed premature script execution Created 4 years, 7 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 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 void clearMediaQueryRuleSetStyleSheets(); 91 void clearMediaQueryRuleSetStyleSheets();
92 void updateStyleSheetsInImport(DocumentStyleSheetCollector& parentCollector) ; 92 void updateStyleSheetsInImport(DocumentStyleSheetCollector& parentCollector) ;
93 void updateActiveStyleSheets(StyleResolverUpdateMode); 93 void updateActiveStyleSheets(StyleResolverUpdateMode);
94 94
95 String preferredStylesheetSetName() const { return m_preferredStylesheetSetN ame; } 95 String preferredStylesheetSetName() const { return m_preferredStylesheetSetN ame; }
96 String selectedStylesheetSetName() const { return m_selectedStylesheetSetNam e; } 96 String selectedStylesheetSetName() const { return m_selectedStylesheetSetNam e; }
97 void setPreferredStylesheetSetNameIfNotSet(const String&); 97 void setPreferredStylesheetSetNameIfNotSet(const String&);
98 void setSelectedStylesheetSetName(const String&); 98 void setSelectedStylesheetSetName(const String&);
99 void setHttpDefaultStyle(const String&); 99 void setHttpDefaultStyle(const String&);
100 100
101 void addPendingSheet(); 101 void addPendingSheet(bool isBeforeBody);
102 void removePendingSheet(Node* styleSheetCandidateNode); 102 void removePendingSheet(Node* styleSheetCandidateNode, bool isBeforeBody);
103 103
104 bool hasPendingSheets() const { return m_pendingStylesheets > 0; } 104 bool hasPendingSheets() const { return m_pendingStylesheets > 0; }
105 bool hasPendingRenderBlockingSheets() const { return m_pendingRenderBlocking Stylesheets > 0; }
105 bool haveStylesheetsLoaded() const { return !hasPendingSheets() || m_ignoreP endingStylesheets; } 106 bool haveStylesheetsLoaded() const { return !hasPendingSheets() || m_ignoreP endingStylesheets; }
107 bool haveRenderBlockingStylesheetsLoaded() const { return !hasPendingRenderB lockingSheets() || m_ignorePendingStylesheets; }
106 bool ignoringPendingStylesheets() const { return m_ignorePendingStylesheets; } 108 bool ignoringPendingStylesheets() const { return m_ignorePendingStylesheets; }
107 109
108 unsigned maxDirectAdjacentSelectors() const { return m_maxDirectAdjacentSele ctors; } 110 unsigned maxDirectAdjacentSelectors() const { return m_maxDirectAdjacentSele ctors; }
109 bool usesSiblingRules() const { return m_usesSiblingRules; } 111 bool usesSiblingRules() const { return m_usesSiblingRules; }
110 bool usesFirstLineRules() const { return m_usesFirstLineRules; } 112 bool usesFirstLineRules() const { return m_usesFirstLineRules; }
111 bool usesWindowInactiveSelector() const { return m_usesWindowInactiveSelecto r; } 113 bool usesWindowInactiveSelector() const { return m_usesWindowInactiveSelecto r; }
112 114
113 bool usesRemUnits() const { return m_usesRemUnits; } 115 bool usesRemUnits() const { return m_usesRemUnits; }
114 void setUsesRemUnit(bool b) { m_usesRemUnits = b; } 116 void setUsesRemUnit(bool b) { m_usesRemUnits = b; }
115 117
(...skipping 29 matching lines...) Expand all
145 147
146 void removeFontFaceRules(const HeapVector<Member<const StyleRuleFontFace>>&) ; 148 void removeFontFaceRules(const HeapVector<Member<const StyleRuleFontFace>>&) ;
147 void clearFontCache(); 149 void clearFontCache();
148 // updateGenericFontFamilySettings is used from WebSettingsImpl. 150 // updateGenericFontFamilySettings is used from WebSettingsImpl.
149 void updateGenericFontFamilySettings(); 151 void updateGenericFontFamilySettings();
150 152
151 void didDetach(); 153 void didDetach();
152 bool shouldClearResolver() const; 154 bool shouldClearResolver() const;
153 void resolverChanged(StyleResolverUpdateMode); 155 void resolverChanged(StyleResolverUpdateMode);
154 156
155 CSSStyleSheet* createSheet(Element*, const String& text, TextPosition startP osition); 157 CSSStyleSheet* createSheet(Element*, const String& text, TextPosition startP osition, bool isBeforeBody);
156 void removeSheet(StyleSheetContents*); 158 void removeSheet(StyleSheetContents*);
157 159
158 void collectScopedStyleFeaturesTo(RuleFeatureSet&) const; 160 void collectScopedStyleFeaturesTo(RuleFeatureSet&) const;
159 void ensureFullscreenUAStyle(); 161 void ensureFullscreenUAStyle();
160 162
161 void platformColorsChanged(); 163 void platformColorsChanged();
162 164
163 void classChangedForElement(const SpaceSplitString& changedClasses, Element& ); 165 void classChangedForElement(const SpaceSplitString& changedClasses, Element& );
164 void classChangedForElement(const SpaceSplitString& oldClasses, const SpaceS plitString& newClasses, Element&); 166 void classChangedForElement(const SpaceSplitString& oldClasses, const SpaceS plitString& newClasses, Element&);
165 void attributeChangedForElement(const QualifiedName& attributeName, Element& ); 167 void attributeChangedForElement(const QualifiedName& attributeName, Element& );
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 bool shouldSkipInvalidationFor(const Element&) const; 218 bool shouldSkipInvalidationFor(const Element&) const;
217 219
218 Member<Document> m_document; 220 Member<Document> m_document;
219 bool m_isMaster; 221 bool m_isMaster;
220 222
221 // Track the number of currently loading top-level stylesheets needed for la yout. 223 // Track the number of currently loading top-level stylesheets needed for la yout.
222 // Sheets loaded using the @import directive are not included in this count. 224 // Sheets loaded using the @import directive are not included in this count.
223 // We use this count of pending sheets to detect when we can begin attaching 225 // We use this count of pending sheets to detect when we can begin attaching
224 // elements and when it is safe to execute scripts. 226 // elements and when it is safe to execute scripts.
225 int m_pendingStylesheets = 0; 227 int m_pendingStylesheets = 0;
228 int m_pendingRenderBlockingStylesheets = 0;
226 229
227 HeapVector<Member<CSSStyleSheet>> m_injectedAuthorStyleSheets; 230 HeapVector<Member<CSSStyleSheet>> m_injectedAuthorStyleSheets;
228 231
229 Member<DocumentStyleSheetCollection> m_documentStyleSheetCollection; 232 Member<DocumentStyleSheetCollection> m_documentStyleSheetCollection;
230 233
231 typedef HeapHashMap<WeakMember<TreeScope>, Member<ShadowTreeStyleSheetCollec tion>> StyleSheetCollectionMap; 234 typedef HeapHashMap<WeakMember<TreeScope>, Member<ShadowTreeStyleSheetCollec tion>> StyleSheetCollectionMap;
232 StyleSheetCollectionMap m_styleSheetCollectionMap; 235 StyleSheetCollectionMap m_styleSheetCollectionMap;
233 236
234 bool m_documentScopeDirty = true; 237 bool m_documentScopeDirty = true;
235 UnorderedTreeScopeSet m_dirtyTreeScopes; 238 UnorderedTreeScopeSet m_dirtyTreeScopes;
(...skipping 21 matching lines...) Expand all
257 260
258 OwnPtr<StyleResolverStats> m_styleResolverStats; 261 OwnPtr<StyleResolverStats> m_styleResolverStats;
259 unsigned m_styleForElementCount = 0; 262 unsigned m_styleForElementCount = 0;
260 263
261 friend class StyleEngineTest; 264 friend class StyleEngineTest;
262 }; 265 };
263 266
264 } // namespace blink 267 } // namespace blink
265 268
266 #endif 269 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698