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 |