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 |