OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |