| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 namespace blink { | 50 namespace blink { |
| 51 | 51 |
| 52 class CSSFontSelector; | 52 class CSSFontSelector; |
| 53 class CSSStyleSheet; | 53 class CSSStyleSheet; |
| 54 class Node; | 54 class Node; |
| 55 class RuleFeatureSet; | 55 class RuleFeatureSet; |
| 56 class ShadowTreeStyleSheetCollection; | 56 class ShadowTreeStyleSheetCollection; |
| 57 class StyleRuleFontFace; | 57 class StyleRuleFontFace; |
| 58 class StyleSheet; | 58 class StyleSheet; |
| 59 class StyleSheetContents; | 59 class StyleSheetContents; |
| 60 class ViewportStyleResolver; |
| 60 | 61 |
| 61 class CORE_EXPORT StyleEngine final | 62 class CORE_EXPORT StyleEngine final |
| 62 : public GarbageCollectedFinalized<StyleEngine>, | 63 : public GarbageCollectedFinalized<StyleEngine>, |
| 63 public CSSFontSelectorClient { | 64 public CSSFontSelectorClient { |
| 64 USING_GARBAGE_COLLECTED_MIXIN(StyleEngine); | 65 USING_GARBAGE_COLLECTED_MIXIN(StyleEngine); |
| 65 | 66 |
| 66 public: | 67 public: |
| 67 class IgnoringPendingStylesheet { | 68 class IgnoringPendingStylesheet { |
| 68 DISALLOW_NEW(); | 69 DISALLOW_NEW(); |
| 69 | 70 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 92 CSSStyleSheet* inspectorStyleSheet() const { return m_inspectorStyleSheet; } | 93 CSSStyleSheet* inspectorStyleSheet() const { return m_inspectorStyleSheet; } |
| 93 | 94 |
| 94 const HeapVector<Member<CSSStyleSheet>> activeStyleSheetsForInspector() const; | 95 const HeapVector<Member<CSSStyleSheet>> activeStyleSheetsForInspector() const; |
| 95 | 96 |
| 96 void setNeedsActiveStyleUpdate(StyleSheet*, StyleResolverUpdateMode); | 97 void setNeedsActiveStyleUpdate(StyleSheet*, StyleResolverUpdateMode); |
| 97 void addStyleSheetCandidateNode(Node&); | 98 void addStyleSheetCandidateNode(Node&); |
| 98 void removeStyleSheetCandidateNode(Node&); | 99 void removeStyleSheetCandidateNode(Node&); |
| 99 void removeStyleSheetCandidateNode(Node&, TreeScope&); | 100 void removeStyleSheetCandidateNode(Node&, TreeScope&); |
| 100 void modifiedStyleSheetCandidateNode(Node&); | 101 void modifiedStyleSheetCandidateNode(Node&); |
| 101 void watchedSelectorsChanged(); | 102 void watchedSelectorsChanged(); |
| 103 void initialViewportChanged(); |
| 102 | 104 |
| 103 void injectAuthorSheet(StyleSheetContents* authorSheet); | 105 void injectAuthorSheet(StyleSheetContents* authorSheet); |
| 104 CSSStyleSheet& ensureInspectorStyleSheet(); | 106 CSSStyleSheet& ensureInspectorStyleSheet(); |
| 105 | 107 |
| 106 void clearMediaQueryRuleSetStyleSheets(); | 108 void clearMediaQueryRuleSetStyleSheets(); |
| 107 void updateStyleSheetsInImport(DocumentStyleSheetCollector& parentCollector); | 109 void updateStyleSheetsInImport(DocumentStyleSheetCollector& parentCollector); |
| 108 void updateActiveStyleSheets(StyleResolverUpdateMode); | 110 void updateActiveStyleSheets(StyleResolverUpdateMode); |
| 111 void updateViewport() { documentStyleSheetCollection().updateViewport(); } |
| 109 | 112 |
| 110 enum ActiveSheetsUpdate { DontUpdateActiveSheets, UpdateActiveSheets }; | 113 enum ActiveSheetsUpdate { DontUpdateActiveSheets, UpdateActiveSheets }; |
| 111 String preferredStylesheetSetName() const { | 114 String preferredStylesheetSetName() const { |
| 112 return m_preferredStylesheetSetName; | 115 return m_preferredStylesheetSetName; |
| 113 } | 116 } |
| 114 String selectedStylesheetSetName() const { | 117 String selectedStylesheetSetName() const { |
| 115 return m_selectedStylesheetSetName; | 118 return m_selectedStylesheetSetName; |
| 116 } | 119 } |
| 117 void setPreferredStylesheetSetNameIfNotSet(const String&, ActiveSheetsUpdate); | 120 void setPreferredStylesheetSetNameIfNotSet(const String&, ActiveSheetsUpdate); |
| 118 void setSelectedStylesheetSetName(const String&); | 121 void setSelectedStylesheetSetName(const String&); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 void didRemoveShadowRoot(ShadowRoot*); | 156 void didRemoveShadowRoot(ShadowRoot*); |
| 154 void shadowRootRemovedFromDocument(ShadowRoot*); | 157 void shadowRootRemovedFromDocument(ShadowRoot*); |
| 155 void appendActiveAuthorStyleSheets(); | 158 void appendActiveAuthorStyleSheets(); |
| 156 | 159 |
| 157 StyleResolver* resolver() const { return m_resolver.get(); } | 160 StyleResolver* resolver() const { return m_resolver.get(); } |
| 158 | 161 |
| 159 StyleResolver& ensureResolver() { | 162 StyleResolver& ensureResolver() { |
| 160 if (!m_resolver) { | 163 if (!m_resolver) { |
| 161 createResolver(); | 164 createResolver(); |
| 162 } else if (m_resolver->hasPendingAuthorStyleSheets()) { | 165 } else if (m_resolver->hasPendingAuthorStyleSheets()) { |
| 166 updateViewport(); |
| 163 m_resolver->appendPendingAuthorStyleSheets(); | 167 m_resolver->appendPendingAuthorStyleSheets(); |
| 164 } | 168 } |
| 165 return *m_resolver.get(); | 169 return *m_resolver.get(); |
| 166 } | 170 } |
| 167 | 171 |
| 168 bool hasResolver() const { return m_resolver.get(); } | 172 bool hasResolver() const { return m_resolver.get(); } |
| 169 void clearResolver(); | 173 void clearResolver(); |
| 170 void clearMasterResolver(); | 174 void clearMasterResolver(); |
| 171 | 175 |
| 172 StyleInvalidator& styleInvalidator() { return m_styleInvalidator; } | 176 StyleInvalidator& styleInvalidator() { return m_styleInvalidator; } |
| 173 | 177 |
| 174 CSSFontSelector* fontSelector() { return m_fontSelector.get(); } | 178 CSSFontSelector* fontSelector() { return m_fontSelector.get(); } |
| 175 void setFontSelector(CSSFontSelector*); | 179 void setFontSelector(CSSFontSelector*); |
| 176 | 180 |
| 177 void removeFontFaceRules(const HeapVector<Member<const StyleRuleFontFace>>&); | 181 void removeFontFaceRules(const HeapVector<Member<const StyleRuleFontFace>>&); |
| 178 void clearFontCache(); | 182 void clearFontCache(); |
| 179 // updateGenericFontFamilySettings is used from WebSettingsImpl. | 183 // updateGenericFontFamilySettings is used from WebSettingsImpl. |
| 180 void updateGenericFontFamilySettings(); | 184 void updateGenericFontFamilySettings(); |
| 181 | 185 |
| 186 ViewportStyleResolver& ensureViewportStyleResolver(); |
| 187 |
| 182 void didDetach(); | 188 void didDetach(); |
| 183 bool shouldClearResolver() const; | 189 bool shouldClearResolver() const; |
| 184 void resolverChanged(StyleResolverUpdateMode); | 190 void resolverChanged(StyleResolverUpdateMode); |
| 185 | 191 |
| 186 CSSStyleSheet* createSheet(Element&, | 192 CSSStyleSheet* createSheet(Element&, |
| 187 const String& text, | 193 const String& text, |
| 188 TextPosition startPosition, | 194 TextPosition startPosition, |
| 189 StyleEngineContext&); | 195 StyleEngineContext&); |
| 190 | 196 |
| 191 void collectScopedStyleFeaturesTo(RuleFeatureSet&) const; | 197 void collectScopedStyleFeaturesTo(RuleFeatureSet&) const; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 bool m_usesSiblingRules = false; | 311 bool m_usesSiblingRules = false; |
| 306 bool m_usesFirstLineRules = false; | 312 bool m_usesFirstLineRules = false; |
| 307 bool m_usesWindowInactiveSelector = false; | 313 bool m_usesWindowInactiveSelector = false; |
| 308 bool m_usesRemUnits = false; | 314 bool m_usesRemUnits = false; |
| 309 unsigned m_maxDirectAdjacentSelectors = 0; | 315 unsigned m_maxDirectAdjacentSelectors = 0; |
| 310 | 316 |
| 311 bool m_ignorePendingStylesheets = false; | 317 bool m_ignorePendingStylesheets = false; |
| 312 bool m_didCalculateResolver = false; | 318 bool m_didCalculateResolver = false; |
| 313 | 319 |
| 314 Member<StyleResolver> m_resolver; | 320 Member<StyleResolver> m_resolver; |
| 321 Member<ViewportStyleResolver> m_viewportResolver; |
| 315 StyleInvalidator m_styleInvalidator; | 322 StyleInvalidator m_styleInvalidator; |
| 316 | 323 |
| 317 Member<CSSFontSelector> m_fontSelector; | 324 Member<CSSFontSelector> m_fontSelector; |
| 318 | 325 |
| 319 HeapHashMap<AtomicString, WeakMember<StyleSheetContents>> m_textToSheetCache; | 326 HeapHashMap<AtomicString, WeakMember<StyleSheetContents>> m_textToSheetCache; |
| 320 HeapHashMap<WeakMember<StyleSheetContents>, AtomicString> m_sheetToTextCache; | 327 HeapHashMap<WeakMember<StyleSheetContents>, AtomicString> m_sheetToTextCache; |
| 321 | 328 |
| 322 std::unique_ptr<StyleResolverStats> m_styleResolverStats; | 329 std::unique_ptr<StyleResolverStats> m_styleResolverStats; |
| 323 unsigned m_styleForElementCount = 0; | 330 unsigned m_styleForElementCount = 0; |
| 324 | 331 |
| 325 friend class StyleEngineTest; | 332 friend class StyleEngineTest; |
| 326 }; | 333 }; |
| 327 | 334 |
| 328 } // namespace blink | 335 } // namespace blink |
| 329 | 336 |
| 330 #endif | 337 #endif |
| OLD | NEW |