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

Unified Diff: third_party/WebKit/Source/core/css/DragUpdateTest.cpp

Issue 1459553002: Use invalidation sets for :-webkit-drag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | « no previous file | third_party/WebKit/Source/core/css/RuleFeature.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/DragUpdateTest.cpp
diff --git a/third_party/WebKit/Source/core/css/DragUpdateTest.cpp b/third_party/WebKit/Source/core/css/DragUpdateTest.cpp
index 63685dd69621b3c1294197aeacae222ea7737427..0cbe2869f5813b5c05e79d806a49d79ed6291ae7 100644
--- a/third_party/WebKit/Source/core/css/DragUpdateTest.cpp
+++ b/third_party/WebKit/Source/core/css/DragUpdateTest.cpp
@@ -40,18 +40,18 @@ TEST(DragUpdateTest, AffectedByDragUpdate)
ASSERT_EQ(1U, accessCount);
}
-TEST(DragUpdateTest, ChildrenOrSiblingsAffectedByDragUpdate)
+TEST(DragUpdateTest, ChildAffectedByDragUpdate)
{
// Check that when dragging the div in the document below, you get a
- // full subtree style recalc.
+ // single element style recalc.
OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
HTMLDocument& document = toHTMLDocument(dummyPageHolder->document());
- document.documentElement()->setInnerHTML("<style>div {width:100px;height:100px} div:-webkit-drag span { background-color: green }</style>"
+ document.documentElement()->setInnerHTML("<style>div {width:100px;height:100px} div:-webkit-drag .drag { background-color: green }</style>"
"<div>"
"<span></span>"
"<span></span>"
- "<span></span>"
+ "<span class='drag'></span>"
"<span></span>"
"</div>", ASSERT_NO_EXCEPTION);
@@ -63,7 +63,34 @@ TEST(DragUpdateTest, ChildrenOrSiblingsAffectedByDragUpdate)
unsigned accessCount = document.styleEngine().resolverAccessCount() - startCount;
- ASSERT_EQ(5U, accessCount);
+ ASSERT_EQ(1U, accessCount);
+}
+
+TEST(DragUpdateTest, SiblingAffectedByDragUpdate)
+{
+ // Check that when dragging the div in the document below, you get a
+ // single element style recalc.
+
+ OwnPtr<DummyPageHolder> dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
+ HTMLDocument& document = toHTMLDocument(dummyPageHolder->document());
+ document.documentElement()->setInnerHTML("<style>div {width:100px;height:100px} div:-webkit-drag + .drag { background-color: green }</style>"
+ "<div>"
+ "<span></span>"
+ "<span></span>"
+ "<span></span>"
+ "<span></span>"
+ "</div>"
+ "<span class='drag'></span>", ASSERT_NO_EXCEPTION);
+
+ document.updateLayout();
+ unsigned startCount = document.styleEngine().resolverAccessCount();
+
+ document.documentElement()->layoutObject()->updateDragState(true);
+ document.updateLayout();
+
+ unsigned accessCount = document.styleEngine().resolverAccessCount() - startCount;
+
+ ASSERT_EQ(1U, accessCount);
}
} // namespace blink
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/RuleFeature.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698