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>" |
esprehn
2014/04/04 22:48:27
Why not a regular layout test like we did for all
rune
2014/04/08 16:28:25
Because hover/active/focus changes are synchronous
rune
2014/04/10 12:42:12
I've landed removal of the synchronous update for
|
+ "<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; |
+ |
+ ASSERT_EQ(2U, accessCount); |
+} |
+ |
} // namespace |