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

Side by Side Diff: third_party/WebKit/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp

Issue 2361733004: Adding @keyframes rules only affects TreeScope plus host. (Closed)
Patch Set: Moved scope check to CSSAnimations Created 4 years, 2 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) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 10 matching lines...) Expand all
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "core/css/invalidation/StyleSheetInvalidationAnalysis.h" 26 #include "core/css/invalidation/StyleSheetInvalidationAnalysis.h"
27 27
28 #include "core/css/CSSSelectorList.h" 28 #include "core/css/CSSSelectorList.h"
29 #include "core/css/StyleRuleImport.h" 29 #include "core/css/StyleRuleImport.h"
30 #include "core/css/StyleSheetContents.h" 30 #include "core/css/StyleSheetContents.h"
31 #include "core/css/resolver/ScopedStyleResolver.h"
31 #include "core/dom/ContainerNode.h" 32 #include "core/dom/ContainerNode.h"
32 #include "core/dom/Document.h" 33 #include "core/dom/Document.h"
33 #include "core/dom/ElementTraversal.h" 34 #include "core/dom/ElementTraversal.h"
34 #include "core/dom/StyleChangeReason.h" 35 #include "core/dom/StyleChangeReason.h"
35 #include "core/dom/StyleEngine.h" 36 #include "core/dom/StyleEngine.h"
36 #include "core/dom/TreeScope.h" 37 #include "core/dom/TreeScope.h"
37 #include "core/dom/shadow/ShadowRoot.h" 38 #include "core/dom/shadow/ShadowRoot.h"
38 #include "core/html/HTMLStyleElement.h" 39 #include "core/html/HTMLStyleElement.h"
39 40
40 namespace blink { 41 namespace blink {
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return true; 160 return true;
160 } 161 }
161 return false; 162 return false;
162 } 163 }
163 164
164 void StyleSheetInvalidationAnalysis::invalidateStyle() 165 void StyleSheetInvalidationAnalysis::invalidateStyle()
165 { 166 {
166 ASSERT(!m_dirtiesAllStyle); 167 ASSERT(!m_dirtiesAllStyle);
167 168
168 if (m_addsKeyframes) 169 if (m_addsKeyframes)
169 m_treeScope->document().styleEngine().keyframesRulesAdded(); 170 ScopedStyleResolver::keyframesRulesAdded(*m_treeScope);
170 171
171 if (m_treeScope->rootNode().isShadowRoot()) { 172 if (m_treeScope->rootNode().isShadowRoot()) {
172 ContainerNode& shadowHost = toShadowRoot(m_treeScope->rootNode()).host() ; 173 ContainerNode& shadowHost = toShadowRoot(m_treeScope->rootNode()).host() ;
173 shadowHost.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForT racing::create(StyleChangeReason::StyleSheetChange)); 174 shadowHost.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForT racing::create(StyleChangeReason::StyleSheetChange));
174 return; 175 return;
175 } 176 }
176 177
177 if (m_idScopes.isEmpty() && m_classScopes.isEmpty()) 178 if (m_idScopes.isEmpty() && m_classScopes.isEmpty())
178 return; 179 return;
179 Element* element = ElementTraversal::firstWithin(m_treeScope->document()); 180 Element* element = ElementTraversal::firstWithin(m_treeScope->document());
180 while (element) { 181 while (element) {
181 if (elementMatchesSelectorScopes(element, m_idScopes, m_classScopes)) { 182 if (elementMatchesSelectorScopes(element, m_idScopes, m_classScopes)) {
182 element->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonFo rTracing::create(StyleChangeReason::StyleSheetChange)); 183 element->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonFo rTracing::create(StyleChangeReason::StyleSheetChange));
183 // The whole subtree is now invalidated, we can skip to the next sib ling. 184 // The whole subtree is now invalidated, we can skip to the next sib ling.
184 element = ElementTraversal::nextSkippingChildren(*element); 185 element = ElementTraversal::nextSkippingChildren(*element);
185 continue; 186 continue;
186 } 187 }
187 element = ElementTraversal::next(*element); 188 element = ElementTraversal::next(*element);
188 } 189 }
189 } 190 }
190 191
191 } // namespace blink 192 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698