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

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

Issue 2749273004: Remove incorrect styleResolver() checks. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/StyleEngine.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 60f4c1671c138878a8ebe05345e1aa8342fe60a5..097aeee00eaa482fad8be66b3495111d88ab4265 100644
--- a/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp
+++ b/third_party/WebKit/Source/core/dom/StyleEngineTest.cpp
@@ -450,4 +450,40 @@ TEST_F(StyleEngineTest, ModifyStyleRuleMatchedPropertiesCache) {
t1->computedStyle()->visitedDependentColor(CSSPropertyColor));
}
+TEST_F(StyleEngineTest, ScheduleInvaldationAfterSubtreeRecalc) {
+ document().body()->setInnerHTML(
+ "<style>"
+ " .t1 span { color: green }x"
+ " .t2 span { color: green }"
+ "</style>"
+ "<div id='t1'></div>"
+ "<div id='t2'></div>");
+ document().view()->updateAllLifecyclePhases();
+
+ Element* t1 = document().getElementById("t1");
+ Element* t2 = document().getElementById("t1");
+ ASSERT_TRUE(t1);
+ ASSERT_TRUE(t2);
+
+ // Sanity test.
+ t1->setAttribute(blink::HTMLNames::classAttr, "t1");
+ EXPECT_FALSE(document().needsStyleInvalidation());
+ EXPECT_TRUE(document().childNeedsStyleInvalidation());
+
+ document().view()->updateAllLifecyclePhases();
+
+ // platformColorsChanged() triggers SubtreeStyleChange on document(). If that
+ // for some reason should change, this test will start failing and the
+ // SubtreeStyleChange must be set another way.
+ // Calling setNeedsStyleRecalc() explicitly with an arbitrary reason instead
+ // requires us to CORE_EXPORT the reason strings.
+ styleEngine().platformColorsChanged();
+
+ // Check that no invalidations sets are scheduled when the document node is
+ // already SubtreeStyleChange.
+ t2->setAttribute(blink::HTMLNames::classAttr, "t2");
+ EXPECT_FALSE(document().needsStyleInvalidation());
+ EXPECT_FALSE(document().childNeedsStyleInvalidation());
+}
+
} // namespace blink
« 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