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

Unified Diff: Source/core/dom/DocumentTest.cpp

Issue 1333193004: Increment style version for all style changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Increment style version in scheduleLayoutTreeUpdate Created 5 years, 3 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 | « Source/core/dom/Document.cpp ('k') | Source/core/dom/Node.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/DocumentTest.cpp
diff --git a/Source/core/dom/DocumentTest.cpp b/Source/core/dom/DocumentTest.cpp
index 76f953ff806ec168d4c964eeb4ebec6393433272..6cf14d3437a471a5fa88f45e1dfe78406bee296a 100644
--- a/Source/core/dom/DocumentTest.cpp
+++ b/Source/core/dom/DocumentTest.cpp
@@ -324,4 +324,33 @@ TEST_F(DocumentTest, OutgoingReferrerWithUniqueOrigin)
EXPECT_EQ(String(), document().outgoingReferrer());
}
+TEST_F(DocumentTest, StyleVersion)
+{
+ setHtmlInnerHTML(
+ "<style>"
+ " .a * { color: green }"
+ " .b .c { color: green }"
+ "</style>"
+ "<div id='x'><span class='c'></span></div>");
+
+ Element* element = document().getElementById("x");
+ EXPECT_TRUE(element);
+
+ uint64_t previousStyleVersion = document().styleVersion();
+ element->setAttribute(blink::HTMLNames::classAttr, "notfound");
+ EXPECT_EQ(previousStyleVersion, document().styleVersion());
+
+ document().view()->updateAllLifecyclePhases();
+
+ previousStyleVersion = document().styleVersion();
+ element->setAttribute(blink::HTMLNames::classAttr, "a");
+ EXPECT_NE(previousStyleVersion, document().styleVersion());
+
+ document().view()->updateAllLifecyclePhases();
+
+ previousStyleVersion = document().styleVersion();
+ element->setAttribute(blink::HTMLNames::classAttr, "a b");
+ EXPECT_NE(previousStyleVersion, document().styleVersion());
+}
+
} // namespace blink
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/dom/Node.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698