| 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 | 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 93 |
| 94 const HeapVector<TraceWrapperMember<StyleSheet>>& | 94 const HeapVector<TraceWrapperMember<StyleSheet>>& |
| 95 styleSheetsForStyleSheetList(TreeScope&); | 95 styleSheetsForStyleSheetList(TreeScope&); |
| 96 | 96 |
| 97 const HeapVector<TraceWrapperMember<CSSStyleSheet>>& | 97 const HeapVector<TraceWrapperMember<CSSStyleSheet>>& |
| 98 injectedAuthorStyleSheets() const { | 98 injectedAuthorStyleSheets() const { |
| 99 return m_injectedAuthorStyleSheets; | 99 return m_injectedAuthorStyleSheets; |
| 100 } | 100 } |
| 101 CSSStyleSheet* inspectorStyleSheet() const { return m_inspectorStyleSheet; } | 101 CSSStyleSheet* inspectorStyleSheet() const { return m_inspectorStyleSheet; } |
| 102 | 102 |
| 103 const HeapVector<Member<CSSStyleSheet>> activeStyleSheetsForInspector() const; | 103 const ActiveStyleSheetVector activeStyleSheetsForInspector(); |
| 104 | 104 |
| 105 bool needsActiveStyleUpdate() const; | 105 bool needsActiveStyleUpdate() const; |
| 106 void setNeedsActiveStyleUpdate(StyleSheet*, StyleResolverUpdateMode); | 106 void setNeedsActiveStyleUpdate(TreeScope&); |
| 107 void addStyleSheetCandidateNode(Node&); | 107 void addStyleSheetCandidateNode(Node&); |
| 108 void removeStyleSheetCandidateNode(Node&); | 108 void removeStyleSheetCandidateNode(Node&); |
| 109 void removeStyleSheetCandidateNode(Node&, TreeScope&); | 109 void removeStyleSheetCandidateNode(Node&, TreeScope&); |
| 110 void modifiedStyleSheetCandidateNode(Node&); | 110 void modifiedStyleSheetCandidateNode(Node&); |
| 111 void mediaQueriesChangedInScope(TreeScope&); |
| 111 void watchedSelectorsChanged(); | 112 void watchedSelectorsChanged(); |
| 112 void initialViewportChanged(); | 113 void initialViewportChanged(); |
| 113 void viewportRulesChanged(); | 114 void viewportRulesChanged(); |
| 114 void importRemoved(); | 115 void importAddedOrRemoved(); |
| 115 | 116 |
| 116 void injectAuthorSheet(StyleSheetContents* authorSheet); | 117 void injectAuthorSheet(StyleSheetContents* authorSheet); |
| 117 CSSStyleSheet& ensureInspectorStyleSheet(); | 118 CSSStyleSheet& ensureInspectorStyleSheet(); |
| 118 RuleSet* watchedSelectorsRuleSet() { | 119 RuleSet* watchedSelectorsRuleSet() { |
| 119 return m_globalRuleSet.watchedSelectorsRuleSet(); | 120 return m_globalRuleSet.watchedSelectorsRuleSet(); |
| 120 } | 121 } |
| 121 | 122 |
| 122 RuleSet* ruleSetForSheet(CSSStyleSheet&); | 123 RuleSet* ruleSetForSheet(CSSStyleSheet&); |
| 123 void mediaQueryAffectingValueChanged(); | 124 void mediaQueryAffectingValueChanged(); |
| 124 void updateStyleSheetsInImport(DocumentStyleSheetCollector& parentCollector); | 125 void updateStyleSheetsInImport(DocumentStyleSheetCollector& parentCollector); |
| 125 void updateActiveStyleSheets(StyleResolverUpdateMode); | |
| 126 void updateActiveStyle(); | 126 void updateActiveStyle(); |
| 127 void markAllTreeScopesDirty() { m_allTreeScopesDirty = true; } | 127 void markAllTreeScopesDirty() { m_allTreeScopesDirty = true; } |
| 128 | 128 |
| 129 enum ActiveSheetsUpdate { DontUpdateActiveSheets, UpdateActiveSheets }; | |
| 130 String preferredStylesheetSetName() const { | 129 String preferredStylesheetSetName() const { |
| 131 return m_preferredStylesheetSetName; | 130 return m_preferredStylesheetSetName; |
| 132 } | 131 } |
| 133 String selectedStylesheetSetName() const { | 132 String selectedStylesheetSetName() const { |
| 134 return m_selectedStylesheetSetName; | 133 return m_selectedStylesheetSetName; |
| 135 } | 134 } |
| 136 void setPreferredStylesheetSetNameIfNotSet(const String&, ActiveSheetsUpdate); | 135 void setPreferredStylesheetSetNameIfNotSet(const String&); |
| 137 void setSelectedStylesheetSetName(const String&); | 136 void setSelectedStylesheetSetName(const String&); |
| 138 void setHttpDefaultStyle(const String&); | 137 void setHttpDefaultStyle(const String&); |
| 139 | 138 |
| 140 void addPendingSheet(StyleEngineContext&); | 139 void addPendingSheet(StyleEngineContext&); |
| 141 void removePendingSheet(Node& styleSheetCandidateNode, | 140 void removePendingSheet(Node& styleSheetCandidateNode, |
| 142 const StyleEngineContext&); | 141 const StyleEngineContext&); |
| 143 | 142 |
| 144 bool hasPendingScriptBlockingSheets() const { | 143 bool hasPendingScriptBlockingSheets() const { |
| 145 return m_pendingScriptBlockingStylesheets > 0; | 144 return m_pendingScriptBlockingStylesheets > 0; |
| 146 } | 145 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 177 return m_treeBoundaryCrossingScopes; | 176 return m_treeBoundaryCrossingScopes; |
| 178 } | 177 } |
| 179 void resetAuthorStyle(TreeScope&); | 178 void resetAuthorStyle(TreeScope&); |
| 180 | 179 |
| 181 StyleResolver* resolver() const { return m_resolver; } | 180 StyleResolver* resolver() const { return m_resolver; } |
| 182 | 181 |
| 183 void setRuleUsageTracker(StyleRuleUsageTracker*); | 182 void setRuleUsageTracker(StyleRuleUsageTracker*); |
| 184 | 183 |
| 185 StyleResolver& ensureResolver() { | 184 StyleResolver& ensureResolver() { |
| 186 updateActiveStyle(); | 185 updateActiveStyle(); |
| 187 if (!m_resolver) { | 186 if (!m_resolver) |
| 188 createResolver(); | 187 createResolver(); |
| 189 } else if (m_resolver->hasPendingAuthorStyleSheets()) { | |
| 190 m_resolver->appendPendingAuthorStyleSheets(); | |
| 191 finishAppendAuthorStyleSheets(); | |
| 192 } else if (m_globalRuleSet.isDirty()) { | |
| 193 m_globalRuleSet.update(document()); | |
| 194 } | |
| 195 return *m_resolver; | 188 return *m_resolver; |
| 196 } | 189 } |
| 197 | 190 |
| 198 bool hasResolver() const { return m_resolver; } | 191 bool hasResolver() const { return m_resolver; } |
| 199 void clearResolver(); | 192 void clearResolver(); |
| 200 void clearMasterResolver(); | |
| 201 | 193 |
| 202 StyleInvalidator& styleInvalidator() { return m_styleInvalidator; } | 194 StyleInvalidator& styleInvalidator() { return m_styleInvalidator; } |
| 203 bool mediaQueryAffectedByViewportChange(); | 195 bool mediaQueryAffectedByViewportChange(); |
| 204 bool mediaQueryAffectedByDeviceChange(); | 196 bool mediaQueryAffectedByDeviceChange(); |
| 205 bool hasViewportDependentMediaQueries() const { | 197 bool hasViewportDependentMediaQueries() const { |
| 206 return !m_globalRuleSet.ruleFeatureSet() | 198 return !m_globalRuleSet.ruleFeatureSet() |
| 207 .viewportDependentMediaQueryResults() | 199 .viewportDependentMediaQueryResults() |
| 208 .isEmpty(); | 200 .isEmpty(); |
| 209 } | 201 } |
| 210 | 202 |
| 211 CSSFontSelector* fontSelector() { return m_fontSelector; } | 203 CSSFontSelector* fontSelector() { return m_fontSelector; } |
| 212 void setFontSelector(CSSFontSelector*); | 204 void setFontSelector(CSSFontSelector*); |
| 213 | 205 |
| 214 void removeFontFaceRules(const HeapVector<Member<const StyleRuleFontFace>>&); | 206 void removeFontFaceRules(const HeapVector<Member<const StyleRuleFontFace>>&); |
| 215 void clearFontCache(); | 207 void clearFontCache(); |
| 216 // updateGenericFontFamilySettings is used from WebSettingsImpl. | 208 // updateGenericFontFamilySettings is used from WebSettingsImpl. |
| 217 void updateGenericFontFamilySettings(); | 209 void updateGenericFontFamilySettings(); |
| 218 | 210 |
| 219 void didDetach(); | 211 void didDetach(); |
| 220 bool shouldClearResolver() const; | |
| 221 void resolverChanged(StyleResolverUpdateMode); | |
| 222 | 212 |
| 223 CSSStyleSheet* createSheet(Element&, | 213 CSSStyleSheet* createSheet(Element&, |
| 224 const String& text, | 214 const String& text, |
| 225 TextPosition startPosition, | 215 TextPosition startPosition, |
| 226 StyleEngineContext&); | 216 StyleEngineContext&); |
| 227 | 217 |
| 228 void collectScopedStyleFeaturesTo(RuleFeatureSet&) const; | 218 void collectScopedStyleFeaturesTo(RuleFeatureSet&) const; |
| 229 void ensureUAStyleForFullscreen(); | 219 void ensureUAStyleForFullscreen(); |
| 230 void ensureUAStyleForElement(const Element&); | 220 void ensureUAStyleForElement(const Element&); |
| 231 | 221 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 Document& document() const { return *m_document; } | 282 Document& document() const { return *m_document; } |
| 293 | 283 |
| 294 typedef HeapHashSet<Member<TreeScope>> UnorderedTreeScopeSet; | 284 typedef HeapHashSet<Member<TreeScope>> UnorderedTreeScopeSet; |
| 295 | 285 |
| 296 void mediaQueryAffectingValueChanged(UnorderedTreeScopeSet&); | 286 void mediaQueryAffectingValueChanged(UnorderedTreeScopeSet&); |
| 297 const RuleFeatureSet& ruleFeatureSet() const { | 287 const RuleFeatureSet& ruleFeatureSet() const { |
| 298 return m_globalRuleSet.ruleFeatureSet(); | 288 return m_globalRuleSet.ruleFeatureSet(); |
| 299 } | 289 } |
| 300 | 290 |
| 301 void createResolver(); | 291 void createResolver(); |
| 302 void appendActiveAuthorStyleSheets(); | |
| 303 void finishAppendAuthorStyleSheets(); | |
| 304 | 292 |
| 305 CSSStyleSheet* parseSheet(Element&, | 293 CSSStyleSheet* parseSheet(Element&, |
| 306 const String& text, | 294 const String& text, |
| 307 TextPosition startPosition); | 295 TextPosition startPosition); |
| 308 | 296 |
| 309 const DocumentStyleSheetCollection& documentStyleSheetCollection() const { | 297 const DocumentStyleSheetCollection& documentStyleSheetCollection() const { |
| 310 DCHECK(m_documentStyleSheetCollection); | 298 DCHECK(m_documentStyleSheetCollection); |
| 311 return *m_documentStyleSheetCollection; | 299 return *m_documentStyleSheetCollection; |
| 312 } | 300 } |
| 313 | 301 |
| 314 DocumentStyleSheetCollection& documentStyleSheetCollection() { | 302 DocumentStyleSheetCollection& documentStyleSheetCollection() { |
| 315 DCHECK(m_documentStyleSheetCollection); | 303 DCHECK(m_documentStyleSheetCollection); |
| 316 return *m_documentStyleSheetCollection; | 304 return *m_documentStyleSheetCollection; |
| 317 } | 305 } |
| 318 | 306 |
| 319 void updateActiveStyleSheetsInShadow( | 307 void updateActiveStyleSheetsInShadow( |
| 320 StyleResolverUpdateMode, | |
| 321 TreeScope*, | 308 TreeScope*, |
| 322 UnorderedTreeScopeSet& treeScopesRemoved); | 309 UnorderedTreeScopeSet& treeScopesRemoved); |
| 323 | 310 |
| 324 bool shouldSkipInvalidationFor(const Element&) const; | 311 bool shouldSkipInvalidationFor(const Element&) const; |
| 325 void scheduleRuleSetInvalidationsForElement( | 312 void scheduleRuleSetInvalidationsForElement( |
| 326 Element&, | 313 Element&, |
| 327 const HeapVector<Member<RuleSet>>&); | 314 const HeapVector<Member<RuleSet>>&); |
| 328 void invalidateSlottedElements(HTMLSlotElement&); | 315 void invalidateSlottedElements(HTMLSlotElement&); |
| 329 | 316 |
| 330 void updateViewport(); | 317 void updateViewport(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 342 int m_pendingRenderBlockingStylesheets = 0; | 329 int m_pendingRenderBlockingStylesheets = 0; |
| 343 | 330 |
| 344 HeapVector<TraceWrapperMember<CSSStyleSheet>> m_injectedAuthorStyleSheets; | 331 HeapVector<TraceWrapperMember<CSSStyleSheet>> m_injectedAuthorStyleSheets; |
| 345 Member<CSSStyleSheet> m_inspectorStyleSheet; | 332 Member<CSSStyleSheet> m_inspectorStyleSheet; |
| 346 | 333 |
| 347 TraceWrapperMember<DocumentStyleSheetCollection> | 334 TraceWrapperMember<DocumentStyleSheetCollection> |
| 348 m_documentStyleSheetCollection; | 335 m_documentStyleSheetCollection; |
| 349 | 336 |
| 350 Member<StyleRuleUsageTracker> m_tracker; | 337 Member<StyleRuleUsageTracker> m_tracker; |
| 351 | 338 |
| 352 typedef HeapHashMap<WeakMember<TreeScope>, | 339 using StyleSheetCollectionMap = |
| 353 Member<ShadowTreeStyleSheetCollection>> | 340 HeapHashMap<WeakMember<TreeScope>, |
| 354 StyleSheetCollectionMap; | 341 Member<ShadowTreeStyleSheetCollection>>; |
| 355 StyleSheetCollectionMap m_styleSheetCollectionMap; | 342 StyleSheetCollectionMap m_styleSheetCollectionMap; |
| 356 | 343 |
| 357 bool m_documentScopeDirty = true; | 344 bool m_documentScopeDirty = true; |
| 358 bool m_allTreeScopesDirty = false; | 345 bool m_allTreeScopesDirty = false; |
| 359 UnorderedTreeScopeSet m_dirtyTreeScopes; | 346 UnorderedTreeScopeSet m_dirtyTreeScopes; |
| 360 UnorderedTreeScopeSet m_activeTreeScopes; | 347 UnorderedTreeScopeSet m_activeTreeScopes; |
| 361 DocumentOrderedList m_treeBoundaryCrossingScopes; | 348 DocumentOrderedList m_treeBoundaryCrossingScopes; |
| 362 | 349 |
| 363 String m_preferredStylesheetSetName; | 350 String m_preferredStylesheetSetName; |
| 364 String m_selectedStylesheetSetName; | 351 String m_selectedStylesheetSetName; |
| 365 | 352 |
| 366 CSSGlobalRuleSet m_globalRuleSet; | 353 CSSGlobalRuleSet m_globalRuleSet; |
| 367 | 354 |
| 368 bool m_usesRemUnits = false; | 355 bool m_usesRemUnits = false; |
| 369 bool m_ignorePendingStylesheets = false; | 356 bool m_ignorePendingStylesheets = false; |
| 370 bool m_didCalculateResolver = false; | |
| 371 | 357 |
| 372 Member<StyleResolver> m_resolver; | 358 Member<StyleResolver> m_resolver; |
| 373 Member<ViewportStyleResolver> m_viewportResolver; | 359 Member<ViewportStyleResolver> m_viewportResolver; |
| 374 Member<MediaQueryEvaluator> m_mediaQueryEvaluator; | 360 Member<MediaQueryEvaluator> m_mediaQueryEvaluator; |
| 375 StyleInvalidator m_styleInvalidator; | 361 StyleInvalidator m_styleInvalidator; |
| 376 | 362 |
| 377 Member<CSSFontSelector> m_fontSelector; | 363 Member<CSSFontSelector> m_fontSelector; |
| 378 | 364 |
| 379 HeapHashMap<AtomicString, WeakMember<StyleSheetContents>> m_textToSheetCache; | 365 HeapHashMap<AtomicString, WeakMember<StyleSheetContents>> m_textToSheetCache; |
| 380 HeapHashMap<WeakMember<StyleSheetContents>, AtomicString> m_sheetToTextCache; | 366 HeapHashMap<WeakMember<StyleSheetContents>, AtomicString> m_sheetToTextCache; |
| 381 | 367 |
| 382 std::unique_ptr<StyleResolverStats> m_styleResolverStats; | 368 std::unique_ptr<StyleResolverStats> m_styleResolverStats; |
| 383 unsigned m_styleForElementCount = 0; | 369 unsigned m_styleForElementCount = 0; |
| 384 | 370 |
| 385 friend class StyleEngineTest; | 371 friend class StyleEngineTest; |
| 386 }; | 372 }; |
| 387 | 373 |
| 388 } // namespace blink | 374 } // namespace blink |
| 389 | 375 |
| 390 #endif | 376 #endif |
| OLD | NEW |