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

Unified Diff: third_party/WebKit/Source/core/dom/StyleEngineTest.cpp

Issue 2683373003: RuleSet invalidations on single feature only, including tags. (Closed)
Patch Set: Trace type ruleset invalidation 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/StyleEngineTest.cpp
diff --git a/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp b/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp
index e62026ec9a2d63c9b05fdea6e2d35cd0caf23a9e..dce66ba0d1990ac457d707a2fbed0fb6ba93f9fc 100644
--- a/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp
+++ b/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp
@@ -144,7 +144,13 @@ TEST_F(StyleEngineTest, RuleSetInvalidationTypeSelectors) {
"<div>"
" <span></span>"
" <div></div>"
- "</div>");
+ "</div>"
+ "<b></b><b></b><b></b><b></b>"
+ "<i id=i>"
+ " <i>"
+ " <b></b>"
+ " </i>"
+ "</i>");
document().view()->updateAllLifecyclePhases();
@@ -167,6 +173,43 @@ TEST_F(StyleEngineTest, RuleSetInvalidationTypeSelectors) {
EXPECT_EQ(
scheduleInvalidationsForRules(document(), "div * { background: green}"),
RuleSetInvalidationFullRecalc);
+ document().view()->updateAllLifecyclePhases();
+
+ beforeCount = styleEngine().styleForElementCount();
+ EXPECT_EQ(
+ scheduleInvalidationsForRules(document(), "#i b { background: green}"),
+ RuleSetInvalidationsScheduled);
+ document().view()->updateAllLifecyclePhases();
+ afterCount = styleEngine().styleForElementCount();
+ EXPECT_EQ(1u, afterCount - beforeCount);
+}
+
+TEST_F(StyleEngineTest, RuleSetInvalidationClass) {
+ document().body()->setInnerHTML(
+ "<div class='container'>"
+ " <div class='x'></div>"
+ "</div>"
+ "<div class='x'></div>"
+ "<div class='x'></div>"
+ "<div class='x'></div>");
+
+ document().view()->updateAllLifecyclePhases();
+
+ unsigned beforeCount = styleEngine().styleForElementCount();
+ EXPECT_EQ(
+ scheduleInvalidationsForRules(document(), ".x { background: green }"),
+ RuleSetInvalidationsScheduled);
+ document().view()->updateAllLifecyclePhases();
+ unsigned afterCount = styleEngine().styleForElementCount();
+ EXPECT_EQ(4u, afterCount - beforeCount);
+
+ beforeCount = afterCount;
+ EXPECT_EQ(scheduleInvalidationsForRules(
+ document(), ".container .x { background: green }"),
+ RuleSetInvalidationsScheduled);
+ document().view()->updateAllLifecyclePhases();
+ afterCount = styleEngine().styleForElementCount();
+ EXPECT_EQ(1u, afterCount - beforeCount);
}
TEST_F(StyleEngineTest, RuleSetInvalidationHost) {
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.cpp ('k') | third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698