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