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

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: Rebased. Created 6 years, 9 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>"
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

Powered by Google App Engine
This is Rietveld 408576698