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 13 matching lines...) Expand all Loading... | |
24 * along with this library; see the file COPYING.LIB. If not, write to | 24 * along with this library; see the file COPYING.LIB. If not, write to |
25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 * Boston, MA 02110-1301, USA. | 26 * Boston, MA 02110-1301, USA. |
27 * | 27 * |
28 */ | 28 */ |
29 | 29 |
30 #ifndef StyleEngine_h | 30 #ifndef StyleEngine_h |
31 #define StyleEngine_h | 31 #define StyleEngine_h |
32 | 32 |
33 #include <memory> | 33 #include <memory> |
34 #include <utility> | |
34 #include "core/CoreExport.h" | 35 #include "core/CoreExport.h" |
35 #include "core/css/ActiveStyleSheets.h" | 36 #include "core/css/ActiveStyleSheets.h" |
36 #include "core/css/CSSFontSelectorClient.h" | 37 #include "core/css/CSSFontSelectorClient.h" |
37 #include "core/css/CSSGlobalRuleSet.h" | 38 #include "core/css/CSSGlobalRuleSet.h" |
38 #include "core/css/invalidation/StyleInvalidator.h" | 39 #include "core/css/invalidation/StyleInvalidator.h" |
39 #include "core/css/resolver/StyleResolver.h" | 40 #include "core/css/resolver/StyleResolver.h" |
40 #include "core/css/resolver/StyleResolverStats.h" | 41 #include "core/css/resolver/StyleResolverStats.h" |
41 #include "core/dom/Document.h" | 42 #include "core/dom/Document.h" |
42 #include "core/dom/DocumentOrderedList.h" | 43 #include "core/dom/DocumentOrderedList.h" |
43 #include "core/dom/DocumentStyleSheetCollection.h" | 44 #include "core/dom/DocumentStyleSheetCollection.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 | 87 |
87 static StyleEngine* Create(Document& document) { | 88 static StyleEngine* Create(Document& document) { |
88 return new StyleEngine(document); | 89 return new StyleEngine(document); |
89 } | 90 } |
90 | 91 |
91 ~StyleEngine(); | 92 ~StyleEngine(); |
92 | 93 |
93 const HeapVector<TraceWrapperMember<StyleSheet>>& | 94 const HeapVector<TraceWrapperMember<StyleSheet>>& |
94 StyleSheetsForStyleSheetList(TreeScope&); | 95 StyleSheetsForStyleSheetList(TreeScope&); |
95 | 96 |
96 const HeapVector<TraceWrapperMember<CSSStyleSheet>>& | 97 const HeapVector<std::pair<unsigned, TraceWrapperMember<CSSStyleSheet>>>& |
97 InjectedAuthorStyleSheets() const { | 98 InjectedAuthorStyleSheets() const { |
98 return injected_author_style_sheets_; | 99 return injected_author_style_sheets_; |
99 } | 100 } |
100 CSSStyleSheet* InspectorStyleSheet() const { return inspector_style_sheet_; } | 101 CSSStyleSheet* InspectorStyleSheet() const { return inspector_style_sheet_; } |
101 | 102 |
102 const ActiveStyleSheetVector ActiveStyleSheetsForInspector(); | 103 const ActiveStyleSheetVector ActiveStyleSheetsForInspector(); |
103 | 104 |
104 bool NeedsActiveStyleUpdate() const; | 105 bool NeedsActiveStyleUpdate() const; |
105 void SetNeedsActiveStyleUpdate(TreeScope&); | 106 void SetNeedsActiveStyleUpdate(TreeScope&); |
106 void AddStyleSheetCandidateNode(Node&); | 107 void AddStyleSheetCandidateNode(Node&); |
107 void RemoveStyleSheetCandidateNode(Node&, ContainerNode& insertion_point); | 108 void RemoveStyleSheetCandidateNode(Node&, ContainerNode& insertion_point); |
108 void ModifiedStyleSheetCandidateNode(Node&); | 109 void ModifiedStyleSheetCandidateNode(Node&); |
109 void MediaQueriesChangedInScope(TreeScope&); | 110 void MediaQueriesChangedInScope(TreeScope&); |
110 void WatchedSelectorsChanged(); | 111 void WatchedSelectorsChanged(); |
111 void InitialViewportChanged(); | 112 void InitialViewportChanged(); |
112 void ViewportRulesChanged(); | 113 void ViewportRulesChanged(); |
113 void HtmlImportAddedOrRemoved(); | 114 void HtmlImportAddedOrRemoved(); |
114 | 115 |
115 void InjectAuthorSheet(StyleSheetContents* author_sheet); | 116 unsigned InjectAuthorSheet(StyleSheetContents* author_sheet); |
rune
2017/05/18 13:13:21
I think I would've used an stylesheet id type in t
limasdf
2017/05/18 14:32:26
Done.
| |
117 void RemoveInjectedAuthorSheet(unsigned author_sheet_id); | |
116 CSSStyleSheet& EnsureInspectorStyleSheet(); | 118 CSSStyleSheet& EnsureInspectorStyleSheet(); |
117 RuleSet* WatchedSelectorsRuleSet() { | 119 RuleSet* WatchedSelectorsRuleSet() { |
118 return global_rule_set_.WatchedSelectorsRuleSet(); | 120 return global_rule_set_.WatchedSelectorsRuleSet(); |
119 } | 121 } |
120 | 122 |
121 RuleSet* RuleSetForSheet(CSSStyleSheet&); | 123 RuleSet* RuleSetForSheet(CSSStyleSheet&); |
122 void MediaQueryAffectingValueChanged(); | 124 void MediaQueryAffectingValueChanged(); |
123 void UpdateStyleSheetsInImport(StyleEngine& master_engine, | 125 void UpdateStyleSheetsInImport(StyleEngine& master_engine, |
124 DocumentStyleSheetCollector& parent_collector); | 126 DocumentStyleSheetCollector& parent_collector); |
125 void UpdateActiveStyle(); | 127 void UpdateActiveStyle(); |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 bool is_master_; | 339 bool is_master_; |
338 | 340 |
339 // Track the number of currently loading top-level stylesheets needed for | 341 // Track the number of currently loading top-level stylesheets needed for |
340 // layout. Sheets loaded using the @import directive are not included in this | 342 // layout. Sheets loaded using the @import directive are not included in this |
341 // count. We use this count of pending sheets to detect when we can begin | 343 // count. We use this count of pending sheets to detect when we can begin |
342 // attaching elements and when it is safe to execute scripts. | 344 // attaching elements and when it is safe to execute scripts. |
343 int pending_script_blocking_stylesheets_ = 0; | 345 int pending_script_blocking_stylesheets_ = 0; |
344 int pending_render_blocking_stylesheets_ = 0; | 346 int pending_render_blocking_stylesheets_ = 0; |
345 int pending_body_stylesheets_ = 0; | 347 int pending_body_stylesheets_ = 0; |
346 | 348 |
347 HeapVector<TraceWrapperMember<CSSStyleSheet>> injected_author_style_sheets_; | 349 HeapVector<std::pair<unsigned, TraceWrapperMember<CSSStyleSheet>>> |
350 injected_author_style_sheets_; | |
348 Member<CSSStyleSheet> inspector_style_sheet_; | 351 Member<CSSStyleSheet> inspector_style_sheet_; |
349 | 352 |
350 TraceWrapperMember<DocumentStyleSheetCollection> | 353 TraceWrapperMember<DocumentStyleSheetCollection> |
351 document_style_sheet_collection_; | 354 document_style_sheet_collection_; |
352 | 355 |
353 Member<StyleRuleUsageTracker> tracker_; | 356 Member<StyleRuleUsageTracker> tracker_; |
354 | 357 |
355 using StyleSheetCollectionMap = | 358 using StyleSheetCollectionMap = |
356 HeapHashMap<WeakMember<TreeScope>, | 359 HeapHashMap<WeakMember<TreeScope>, |
357 Member<ShadowTreeStyleSheetCollection>>; | 360 Member<ShadowTreeStyleSheetCollection>>; |
(...skipping 22 matching lines...) Expand all Loading... | |
380 Member<CSSFontSelector> font_selector_; | 383 Member<CSSFontSelector> font_selector_; |
381 | 384 |
382 HeapHashMap<AtomicString, WeakMember<StyleSheetContents>> | 385 HeapHashMap<AtomicString, WeakMember<StyleSheetContents>> |
383 text_to_sheet_cache_; | 386 text_to_sheet_cache_; |
384 HeapHashMap<WeakMember<StyleSheetContents>, AtomicString> | 387 HeapHashMap<WeakMember<StyleSheetContents>, AtomicString> |
385 sheet_to_text_cache_; | 388 sheet_to_text_cache_; |
386 | 389 |
387 std::unique_ptr<StyleResolverStats> style_resolver_stats_; | 390 std::unique_ptr<StyleResolverStats> style_resolver_stats_; |
388 unsigned style_for_element_count_ = 0; | 391 unsigned style_for_element_count_ = 0; |
389 | 392 |
393 unsigned injected_author_sheets_id_count_ = 0; | |
394 | |
390 friend class StyleEngineTest; | 395 friend class StyleEngineTest; |
391 }; | 396 }; |
392 | 397 |
393 } // namespace blink | 398 } // namespace blink |
394 | 399 |
395 #endif | 400 #endif |
OLD | NEW |