Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: third_party/WebKit/Source/core/dom/TreeScopeStyleSheetCollection.cpp

Issue 2882983002: Avoid synchronous stylesheet update on html import loaded. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 17 matching lines...) Expand all
28 28
29 #include "core/dom/TreeScopeStyleSheetCollection.h" 29 #include "core/dom/TreeScopeStyleSheetCollection.h"
30 30
31 #include "core/css/ActiveStyleSheets.h" 31 #include "core/css/ActiveStyleSheets.h"
32 #include "core/css/CSSStyleSheet.h" 32 #include "core/css/CSSStyleSheet.h"
33 #include "core/css/StyleRuleImport.h" 33 #include "core/css/StyleRuleImport.h"
34 #include "core/css/StyleSheetContents.h" 34 #include "core/css/StyleSheetContents.h"
35 #include "core/css/resolver/StyleResolver.h" 35 #include "core/css/resolver/StyleResolver.h"
36 #include "core/dom/Element.h" 36 #include "core/dom/Element.h"
37 #include "core/dom/StyleEngine.h" 37 #include "core/dom/StyleEngine.h"
38 #include "core/dom/StyleSheetCandidate.h"
38 #include "core/html/HTMLLinkElement.h" 39 #include "core/html/HTMLLinkElement.h"
39 #include "core/html/HTMLStyleElement.h" 40 #include "core/html/HTMLStyleElement.h"
40 41
41 namespace blink { 42 namespace blink {
42 43
43 TreeScopeStyleSheetCollection::TreeScopeStyleSheetCollection( 44 TreeScopeStyleSheetCollection::TreeScopeStyleSheetCollection(
44 TreeScope& tree_scope) 45 TreeScope& tree_scope)
45 : tree_scope_(tree_scope) {} 46 : tree_scope_(tree_scope) {}
46 47
47 void TreeScopeStyleSheetCollection::AddStyleSheetCandidateNode(Node& node) { 48 void TreeScopeStyleSheetCollection::AddStyleSheetCandidateNode(Node& node) {
(...skipping 14 matching lines...) Expand all
62 } 63 }
63 64
64 void TreeScopeStyleSheetCollection::ApplyActiveStyleSheetChanges( 65 void TreeScopeStyleSheetCollection::ApplyActiveStyleSheetChanges(
65 StyleSheetCollection& new_collection) { 66 StyleSheetCollection& new_collection) {
66 GetDocument().GetStyleEngine().ApplyRuleSetChanges( 67 GetDocument().GetStyleEngine().ApplyRuleSetChanges(
67 GetTreeScope(), ActiveAuthorStyleSheets(), 68 GetTreeScope(), ActiveAuthorStyleSheets(),
68 new_collection.ActiveAuthorStyleSheets()); 69 new_collection.ActiveAuthorStyleSheets());
69 new_collection.Swap(*this); 70 new_collection.Swap(*this);
70 } 71 }
71 72
73 bool TreeScopeStyleSheetCollection::HasStyleSheets() const {
74 for (Node* node : style_sheet_candidate_nodes_) {
75 StyleSheetCandidate candidate(*node);
76 if (candidate.Sheet() || candidate.IsEnabledAndLoading())
77 return true;
78 }
79 return false;
80 }
81
72 DEFINE_TRACE(TreeScopeStyleSheetCollection) { 82 DEFINE_TRACE(TreeScopeStyleSheetCollection) {
73 visitor->Trace(tree_scope_); 83 visitor->Trace(tree_scope_);
74 visitor->Trace(style_sheet_candidate_nodes_); 84 visitor->Trace(style_sheet_candidate_nodes_);
75 StyleSheetCollection::Trace(visitor); 85 StyleSheetCollection::Trace(visitor);
76 } 86 }
77 87
78 } // namespace blink 88 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698