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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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* author_sheet); | 115 void InjectAuthorSheet(StyleSheetContents* author_sheet); |
116 CSSStyleSheet& EnsureInspectorStyleSheet(); | 116 CSSStyleSheet& EnsureInspectorStyleSheet(); |
117 RuleSet* WatchedSelectorsRuleSet() { | 117 RuleSet* WatchedSelectorsRuleSet() { |
118 return global_rule_set_.WatchedSelectorsRuleSet(); | 118 DCHECK(IsMaster()); |
| 119 DCHECK(global_rule_set_); |
| 120 return global_rule_set_->WatchedSelectorsRuleSet(); |
119 } | 121 } |
120 bool HasStyleSheets() const { | 122 bool HasStyleSheets() const { |
121 return GetDocumentStyleSheetCollection().HasStyleSheets(); | 123 return GetDocumentStyleSheetCollection().HasStyleSheets(); |
122 } | 124 } |
123 | 125 |
124 RuleSet* RuleSetForSheet(CSSStyleSheet&); | 126 RuleSet* RuleSetForSheet(CSSStyleSheet&); |
125 void MediaQueryAffectingValueChanged(); | 127 void MediaQueryAffectingValueChanged(); |
126 void UpdateStyleSheetsInImport(StyleEngine& master_engine, | 128 void UpdateStyleSheetsInImport(StyleEngine& master_engine, |
127 DocumentStyleSheetCollector& parent_collector); | 129 DocumentStyleSheetCollector& parent_collector); |
128 void UpdateActiveStyle(); | 130 void UpdateActiveStyle(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 CreateResolver(); | 195 CreateResolver(); |
194 return *resolver_; | 196 return *resolver_; |
195 } | 197 } |
196 | 198 |
197 bool HasResolver() const { return resolver_; } | 199 bool HasResolver() const { return resolver_; } |
198 | 200 |
199 StyleInvalidator& GetStyleInvalidator() { return style_invalidator_; } | 201 StyleInvalidator& GetStyleInvalidator() { return style_invalidator_; } |
200 bool MediaQueryAffectedByViewportChange(); | 202 bool MediaQueryAffectedByViewportChange(); |
201 bool MediaQueryAffectedByDeviceChange(); | 203 bool MediaQueryAffectedByDeviceChange(); |
202 bool HasViewportDependentMediaQueries() const { | 204 bool HasViewportDependentMediaQueries() const { |
203 return !global_rule_set_.GetRuleFeatureSet() | 205 DCHECK(IsMaster()); |
| 206 DCHECK(global_rule_set_); |
| 207 return !global_rule_set_->GetRuleFeatureSet() |
204 .ViewportDependentMediaQueryResults() | 208 .ViewportDependentMediaQueryResults() |
205 .IsEmpty(); | 209 .IsEmpty(); |
206 } | 210 } |
207 | 211 |
208 CSSFontSelector* FontSelector() { return font_selector_; } | 212 CSSFontSelector* FontSelector() { return font_selector_; } |
209 void SetFontSelector(CSSFontSelector*); | 213 void SetFontSelector(CSSFontSelector*); |
210 | 214 |
211 void RemoveFontFaceRules(const HeapVector<Member<const StyleRuleFontFace>>&); | 215 void RemoveFontFaceRules(const HeapVector<Member<const StyleRuleFontFace>>&); |
212 void ClearFontCache(); | 216 void ClearFontCache(); |
213 // updateGenericFontFamilySettings is used from WebSettingsImpl. | 217 // updateGenericFontFamilySettings is used from WebSettingsImpl. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 void MarkTreeScopeDirty(TreeScope&); | 293 void MarkTreeScopeDirty(TreeScope&); |
290 | 294 |
291 bool IsMaster() const { return is_master_; } | 295 bool IsMaster() const { return is_master_; } |
292 Document* Master(); | 296 Document* Master(); |
293 Document& GetDocument() const { return *document_; } | 297 Document& GetDocument() const { return *document_; } |
294 | 298 |
295 typedef HeapHashSet<Member<TreeScope>> UnorderedTreeScopeSet; | 299 typedef HeapHashSet<Member<TreeScope>> UnorderedTreeScopeSet; |
296 | 300 |
297 void MediaQueryAffectingValueChanged(UnorderedTreeScopeSet&); | 301 void MediaQueryAffectingValueChanged(UnorderedTreeScopeSet&); |
298 const RuleFeatureSet& GetRuleFeatureSet() const { | 302 const RuleFeatureSet& GetRuleFeatureSet() const { |
299 return global_rule_set_.GetRuleFeatureSet(); | 303 DCHECK(IsMaster()); |
| 304 DCHECK(global_rule_set_); |
| 305 return global_rule_set_->GetRuleFeatureSet(); |
300 } | 306 } |
301 | 307 |
302 void CreateResolver(); | 308 void CreateResolver(); |
303 void ClearResolvers(); | 309 void ClearResolvers(); |
304 | 310 |
305 CSSStyleSheet* ParseSheet(Element&, | 311 CSSStyleSheet* ParseSheet(Element&, |
306 const String& text, | 312 const String& text, |
307 TextPosition start_position); | 313 TextPosition start_position); |
308 | 314 |
309 const DocumentStyleSheetCollection& GetDocumentStyleSheetCollection() const { | 315 const DocumentStyleSheetCollection& GetDocumentStyleSheetCollection() const { |
(...skipping 15 matching lines...) Expand all Loading... |
325 Element&, | 331 Element&, |
326 const HeapHashSet<Member<RuleSet>>&); | 332 const HeapHashSet<Member<RuleSet>>&); |
327 void ScheduleTypeRuleSetInvalidations(ContainerNode&, | 333 void ScheduleTypeRuleSetInvalidations(ContainerNode&, |
328 const HeapHashSet<Member<RuleSet>>&); | 334 const HeapHashSet<Member<RuleSet>>&); |
329 void InvalidateSlottedElements(HTMLSlotElement&); | 335 void InvalidateSlottedElements(HTMLSlotElement&); |
330 | 336 |
331 void UpdateViewport(); | 337 void UpdateViewport(); |
332 void UpdateActiveStyleSheets(); | 338 void UpdateActiveStyleSheets(); |
333 void UpdateGlobalRuleSet() { | 339 void UpdateGlobalRuleSet() { |
334 DCHECK(!NeedsActiveStyleSheetUpdate()); | 340 DCHECK(!NeedsActiveStyleSheetUpdate()); |
335 global_rule_set_.Update(GetDocument()); | 341 if (global_rule_set_) |
| 342 global_rule_set_->Update(GetDocument()); |
336 } | 343 } |
337 const MediaQueryEvaluator& EnsureMediaQueryEvaluator(); | 344 const MediaQueryEvaluator& EnsureMediaQueryEvaluator(); |
338 | 345 |
339 Member<Document> document_; | 346 Member<Document> document_; |
340 bool is_master_; | 347 bool is_master_; |
341 | 348 |
342 // Track the number of currently loading top-level stylesheets needed for | 349 // Track the number of currently loading top-level stylesheets needed for |
343 // layout. Sheets loaded using the @import directive are not included in this | 350 // layout. Sheets loaded using the @import directive are not included in this |
344 // count. We use this count of pending sheets to detect when we can begin | 351 // count. We use this count of pending sheets to detect when we can begin |
345 // attaching elements and when it is safe to execute scripts. | 352 // attaching elements and when it is safe to execute scripts. |
(...skipping 17 matching lines...) Expand all Loading... |
363 bool document_scope_dirty_ = true; | 370 bool document_scope_dirty_ = true; |
364 bool all_tree_scopes_dirty_ = false; | 371 bool all_tree_scopes_dirty_ = false; |
365 bool tree_scopes_removed_ = false; | 372 bool tree_scopes_removed_ = false; |
366 UnorderedTreeScopeSet dirty_tree_scopes_; | 373 UnorderedTreeScopeSet dirty_tree_scopes_; |
367 UnorderedTreeScopeSet active_tree_scopes_; | 374 UnorderedTreeScopeSet active_tree_scopes_; |
368 DocumentOrderedList tree_boundary_crossing_scopes_; | 375 DocumentOrderedList tree_boundary_crossing_scopes_; |
369 | 376 |
370 String preferred_stylesheet_set_name_; | 377 String preferred_stylesheet_set_name_; |
371 String selected_stylesheet_set_name_; | 378 String selected_stylesheet_set_name_; |
372 | 379 |
373 CSSGlobalRuleSet global_rule_set_; | |
374 | |
375 bool uses_rem_units_ = false; | 380 bool uses_rem_units_ = false; |
376 bool ignore_pending_stylesheets_ = false; | 381 bool ignore_pending_stylesheets_ = false; |
377 | 382 |
378 Member<StyleResolver> resolver_; | 383 Member<StyleResolver> resolver_; |
379 Member<ViewportStyleResolver> viewport_resolver_; | 384 Member<ViewportStyleResolver> viewport_resolver_; |
380 Member<MediaQueryEvaluator> media_query_evaluator_; | 385 Member<MediaQueryEvaluator> media_query_evaluator_; |
| 386 Member<CSSGlobalRuleSet> global_rule_set_; |
381 StyleInvalidator style_invalidator_; | 387 StyleInvalidator style_invalidator_; |
382 | 388 |
383 Member<CSSFontSelector> font_selector_; | 389 Member<CSSFontSelector> font_selector_; |
384 | 390 |
385 HeapHashMap<AtomicString, WeakMember<StyleSheetContents>> | 391 HeapHashMap<AtomicString, WeakMember<StyleSheetContents>> |
386 text_to_sheet_cache_; | 392 text_to_sheet_cache_; |
387 HeapHashMap<WeakMember<StyleSheetContents>, AtomicString> | 393 HeapHashMap<WeakMember<StyleSheetContents>, AtomicString> |
388 sheet_to_text_cache_; | 394 sheet_to_text_cache_; |
389 | 395 |
390 std::unique_ptr<StyleResolverStats> style_resolver_stats_; | 396 std::unique_ptr<StyleResolverStats> style_resolver_stats_; |
391 unsigned style_for_element_count_ = 0; | 397 unsigned style_for_element_count_ = 0; |
392 | 398 |
393 friend class StyleEngineTest; | 399 friend class StyleEngineTest; |
394 }; | 400 }; |
395 | 401 |
396 } // namespace blink | 402 } // namespace blink |
397 | 403 |
398 #endif | 404 #endif |
OLD | NEW |