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

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

Issue 2700943003: Invalidate custom pseudo elements for RuleSet invalidations. (Closed)
Patch Set: Created 3 years, 10 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/css/RuleFeatureSetTest.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/CSSRuleList.h" 7 #include "core/css/CSSRuleList.h"
8 #include "core/css/CSSStyleRule.h" 8 #include "core/css/CSSStyleRule.h"
9 #include "core/css/CSSStyleSheet.h" 9 #include "core/css/CSSStyleSheet.h"
10 #include "core/css/StyleSheetContents.h" 10 #include "core/css/StyleSheetContents.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 177
178 beforeCount = styleEngine().styleForElementCount(); 178 beforeCount = styleEngine().styleForElementCount();
179 EXPECT_EQ( 179 EXPECT_EQ(
180 RuleSetInvalidationsScheduled, 180 RuleSetInvalidationsScheduled,
181 scheduleInvalidationsForRules(document(), "#i b { background: green}")); 181 scheduleInvalidationsForRules(document(), "#i b { background: green}"));
182 document().view()->updateAllLifecyclePhases(); 182 document().view()->updateAllLifecyclePhases();
183 afterCount = styleEngine().styleForElementCount(); 183 afterCount = styleEngine().styleForElementCount();
184 EXPECT_EQ(1u, afterCount - beforeCount); 184 EXPECT_EQ(1u, afterCount - beforeCount);
185 } 185 }
186 186
187 TEST_F(StyleEngineTest, RuleSetInvalidationCustomPseudo) {
188 document().body()->setInnerHTML(
189 "<style>progress { -webkit-appearance:none }</style>"
190 "<progress></progress>"
191 "<div></div><div></div><div></div><div></div><div></div><div></div>");
192
193 document().view()->updateAllLifecyclePhases();
194
195 unsigned beforeCount = styleEngine().styleForElementCount();
196 EXPECT_EQ(scheduleInvalidationsForRules(
197 document(), "::-webkit-progress-bar { background: green }"),
198 RuleSetInvalidationsScheduled);
199 document().view()->updateAllLifecyclePhases();
200 unsigned afterCount = styleEngine().styleForElementCount();
201 EXPECT_EQ(3u, afterCount - beforeCount);
202 }
203
187 TEST_F(StyleEngineTest, RuleSetInvalidationHost) { 204 TEST_F(StyleEngineTest, RuleSetInvalidationHost) {
188 document().body()->setInnerHTML("<div id=nohost></div><div id=host></div>"); 205 document().body()->setInnerHTML("<div id=nohost></div><div id=host></div>");
189 Element* host = document().getElementById("host"); 206 Element* host = document().getElementById("host");
190 ASSERT_TRUE(host); 207 ASSERT_TRUE(host);
191 208
192 ShadowRootInit init; 209 ShadowRootInit init;
193 init.setMode("open"); 210 init.setMode("open");
194 ShadowRoot* shadowRoot = host->attachShadow( 211 ShadowRoot* shadowRoot = host->attachShadow(
195 ScriptState::forMainWorld(document().frame()), init, ASSERT_NO_EXCEPTION); 212 ScriptState::forMainWorld(document().frame()), init, ASSERT_NO_EXCEPTION);
196 ASSERT_TRUE(shadowRoot); 213 ASSERT_TRUE(shadowRoot);
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 444
428 styleRule->style()->setProperty("color", "green", "", ASSERT_NO_EXCEPTION); 445 styleRule->style()->setProperty("color", "green", "", ASSERT_NO_EXCEPTION);
429 document().view()->updateAllLifecyclePhases(); 446 document().view()->updateAllLifecyclePhases();
430 447
431 ASSERT_TRUE(t1->computedStyle()); 448 ASSERT_TRUE(t1->computedStyle());
432 EXPECT_EQ(makeRGB(0, 128, 0), 449 EXPECT_EQ(makeRGB(0, 128, 0),
433 t1->computedStyle()->visitedDependentColor(CSSPropertyColor)); 450 t1->computedStyle()->visitedDependentColor(CSSPropertyColor));
434 } 451 }
435 452
436 } // namespace blink 453 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/RuleFeatureSetTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698