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

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

Issue 220943002: Use invalidation sets for :hover, :active, and :focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added layout tests 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
Index: Source/core/css/HoverUpdateTest.cpp
diff --git a/Source/core/css/HoverUpdateTest.cpp b/Source/core/css/HoverUpdateTest.cpp
index ac60a2e5b78b41da70b1fc009cea7270d78c0d46..f82b14a5cb99320537e731995d8886a082765887 100644
--- a/Source/core/css/HoverUpdateTest.cpp
+++ b/Source/core/css/HoverUpdateTest.cpp
@@ -46,4 +46,32 @@ TEST(HoverUpdateTest, AffectedByHoverUpdate)
ASSERT_EQ(1U, accessCount);
}
+TEST(HoverUpdateTest, ChildrenAffectedByHoverUpdate)
+{
+ // Check that when hovering the div in the document below, you only get a
+ // style recalc for the hovered element and the class=a span. This requires
+ // supporting a descendant invalidation set for :hover.
+
+ OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
+ HTMLDocument* document = toHTMLDocument(&dummyPageHolder->document());
+ document->documentElement()->setInnerHTML("<style>div {width:100px;height:100px} div:hover .a { background-color: green }</style>"
+ "<div>"
+ "<span class='a'></span>"
+ "<span></span>"
+ "<span></span>"
+ "<span></span>"
+ "</div>", ASSERT_NO_EXCEPTION);
+
+ document->view()->updateLayoutAndStyleIfNeededRecursive();
+ unsigned startCount = document->styleEngine()->resolverAccessCount();
+
+ PlatformMouseEvent moveEvent(IntPoint(20, 20), IntPoint(20, 20), NoButton, PlatformEvent::MouseMoved, 0, false, false, false, false, currentTime());
+ document->frame()->eventHandler().handleMouseMoveEvent(moveEvent);
+ document->view()->updateLayoutAndStyleIfNeededRecursive();
+
+ unsigned accessCount = document->styleEngine()->resolverAccessCount() - startCount;
esprehn 2014/04/11 20:23:01 Can't this be a regular layout test now that we do
rune 2014/04/11 22:34:36 Will fix.
rune 2014/04/25 11:56:50 Done.
+
+ ASSERT_EQ(2U, accessCount);
+}
+
} // namespace

Powered by Google App Engine
This is Rietveld 408576698