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

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

Issue 2394353003: Apply RuleSet changes for active stylesheet changes. (Closed)
Patch Set: 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/dom/StyleEngine.h" 5 #include "core/dom/StyleEngine.h"
6 6
7 #include "core/css/StyleSheetContents.h" 7 #include "core/css/StyleSheetContents.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/NodeComputedStyle.h" 9 #include "core/dom/NodeComputedStyle.h"
10 #include "core/dom/shadow/ShadowRootInit.h" 10 #include "core/dom/shadow/ShadowRootInit.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 void StyleEngineTest::SetUp() { 44 void StyleEngineTest::SetUp() {
45 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); 45 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
46 } 46 }
47 47
48 StyleEngineTest::RuleSetInvalidation 48 StyleEngineTest::RuleSetInvalidation
49 StyleEngineTest::scheduleInvalidationsForRules(TreeScope& treeScope, 49 StyleEngineTest::scheduleInvalidationsForRules(TreeScope& treeScope,
50 const String& cssText) { 50 const String& cssText) {
51 StyleSheetContents* sheet = 51 StyleSheetContents* sheet =
52 StyleSheetContents::create(CSSParserContext(HTMLStandardMode, nullptr)); 52 StyleSheetContents::create(CSSParserContext(HTMLStandardMode, nullptr));
53 sheet->parseString(cssText); 53 sheet->parseString(cssText);
54 HeapVector<Member<const RuleSet>> ruleSets; 54 HeapVector<Member<RuleSet>> ruleSets;
55 RuleSet& ruleSet = sheet->ensureRuleSet(MediaQueryEvaluator(), 55 RuleSet& ruleSet = sheet->ensureRuleSet(MediaQueryEvaluator(),
56 RuleHasDocumentSecurityOrigin); 56 RuleHasDocumentSecurityOrigin);
57 ruleSet.compactRulesIfNeeded(); 57 ruleSet.compactRulesIfNeeded();
58 if (ruleSet.needsFullRecalcForRuleSetInvalidation()) 58 if (ruleSet.needsFullRecalcForRuleSetInvalidation())
59 return RuleSetInvalidationFullRecalc; 59 return RuleSetInvalidationFullRecalc;
60 ruleSets.append(&ruleSet); 60 ruleSets.append(&ruleSet);
61 styleEngine().scheduleInvalidationsForRuleSets(treeScope, ruleSets); 61 styleEngine().scheduleInvalidationsForRuleSets(treeScope, ruleSets);
62 return RuleSetInvalidationsScheduled; 62 return RuleSetInvalidationsScheduled;
63 } 63 }
64 64
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 RuleSetInvalidationFullRecalc); 299 RuleSetInvalidationFullRecalc);
300 EXPECT_EQ(scheduleInvalidationsForRules( 300 EXPECT_EQ(scheduleInvalidationsForRules(
301 *shadowRoot, ".a /deep/ span { background: green}"), 301 *shadowRoot, ".a /deep/ span { background: green}"),
302 RuleSetInvalidationFullRecalc); 302 RuleSetInvalidationFullRecalc);
303 EXPECT_EQ(scheduleInvalidationsForRules( 303 EXPECT_EQ(scheduleInvalidationsForRules(
304 *shadowRoot, ".a::shadow span { background: green}"), 304 *shadowRoot, ".a::shadow span { background: green}"),
305 RuleSetInvalidationFullRecalc); 305 RuleSetInvalidationFullRecalc);
306 } 306 }
307 307
308 } // namespace blink 308 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698