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

Unified Diff: Source/core/css/AffectedByFocusTest.cpp

Issue 220943002: Use invalidation sets for :hover, :active, and :focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove unnecessary seenCombinator handling. Created 6 years, 8 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/core.gypi ('k') | Source/core/css/HoverUpdateTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/AffectedByFocusTest.cpp
diff --git a/Source/core/css/AffectedByFocusTest.cpp b/Source/core/css/AffectedByFocusTest.cpp
index c12f07c7a8fb0f0aa1329f1e09967e3c068ced9d..de9dc0aebdc049573a7a9e05e3151763475ccb88 100644
--- a/Source/core/css/AffectedByFocusTest.cpp
+++ b/Source/core/css/AffectedByFocusTest.cpp
@@ -250,4 +250,67 @@ TEST_F(AffectedByFocusTest, ChildrenAffectedByFocusUpdate)
ASSERT_EQ(11U, accessCount);
}
+TEST_F(AffectedByFocusTest, InvalidationSetFocusUpdate)
+{
+ // Check that when focussing the outer div in the document below, you get a
+ // style recalc for the outer div and the class=a div only.
+
+ setHtmlInnerHTML("<style>:focus .a { border: 1px solid lime; }</style>"
+ "<div id=d tabIndex=1>"
+ "<div></div>"
+ "<div></div>"
+ "<div></div>"
+ "<div></div>"
+ "<div></div>"
+ "<div></div>"
+ "<div></div>"
+ "<div></div>"
+ "<div></div>"
+ "<div class='a'></div>"
+ "</div>");
+
+ document().view()->updateLayoutAndStyleIfNeededRecursive();
+
+ unsigned startCount = document().styleEngine()->resolverAccessCount();
+
+ document().getElementById("d")->focus();
+ document().view()->updateLayoutAndStyleIfNeededRecursive();
+
+ unsigned accessCount = document().styleEngine()->resolverAccessCount() - startCount;
+
+ ASSERT_EQ(2U, accessCount);
+}
+
+TEST_F(AffectedByFocusTest, NoInvalidationSetFocusUpdate)
+{
+ // Check that when focussing the outer div in the document below, you get a
+ // style recalc for the outer div only. The invalidation set for :focus will
+ // include 'a', but the id=d div should be affectedByFocus, not childrenAffectedByFocus.
+
+ setHtmlInnerHTML("<style>#nomatch:focus .a { border: 1px solid lime; }</style>"
+ "<div id=d tabIndex=1>"
+ "<div></div>"
+ "<div></div>"
+ "<div></div>"
+ "<div></div>"
+ "<div></div>"
+ "<div></div>"
+ "<div></div>"
+ "<div></div>"
+ "<div></div>"
+ "<div class='a'></div>"
+ "</div>");
+
+ document().view()->updateLayoutAndStyleIfNeededRecursive();
+
+ unsigned startCount = document().styleEngine()->resolverAccessCount();
+
+ document().getElementById("d")->focus();
+ document().view()->updateLayoutAndStyleIfNeededRecursive();
+
+ unsigned accessCount = document().styleEngine()->resolverAccessCount() - startCount;
+
+ ASSERT_EQ(1U, accessCount);
+}
+
} // namespace
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/css/HoverUpdateTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698