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

Unified Diff: third_party/WebKit/Source/core/input/EventHandlerTest.cpp

Issue 1716023002: Fix draggable elements are painted at incorrect position (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove comment. Created 4 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/input/EventHandlerTest.cpp
diff --git a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
index 11ba2c8e64f6c51c2eebd0ba145f4f0cfa5e52cc..83f688eae8f23187ea55301b851d7b0430236e47 100644
--- a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
@@ -171,4 +171,73 @@ TEST_F(EventHandlerTest, multiClickSelectionFromTapDisabledIfNotEditable)
EXPECT_EQ(Position(line, 0), selection.start());
}
+TEST_F(EventHandlerTest, draggedInlinePositionTest)
+{
+ setHtmlInnerHTML(
+ "<style>"
+ "body { margin: 0px; }"
+ ".line { font-family: sans-serif; background: blue; width: 300px; height: 30px; font-size: 40px; margin-left: 250px; }"
+ "</style>"
+ "<div style='width: 300px; height: 100px;'>"
+ "<span class='line' draggable='true'>abcd</span>"
+ "</div>");
+ PlatformMouseEvent mouseDownEvent1(
+ IntPoint(262, 29),
+ IntPoint(329, 67),
+ LeftButton,
+ PlatformEvent::MousePressed,
+ 1,
+ PlatformEvent::Modifiers::LeftButtonDown,
+ WTF::monotonicallyIncreasingTime());
+ document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent1);
+
+ PlatformMouseEvent mouseMoveEvent(
+ IntPoint(618, 298),
+ IntPoint(685, 436),
+ LeftButton,
+ PlatformEvent::MouseMoved,
+ 1,
+ PlatformEvent::Modifiers::LeftButtonDown,
+ WTF::monotonicallyIncreasingTime());
+ document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent);
+
+ EXPECT_EQ(IntPoint(12, 29), document().frame()->eventHandler().dragDataTransferLocationForTesting());
+}
+
+TEST_F(EventHandlerTest, draggedSVGImagePositionTest)
+{
+ setHtmlInnerHTML(
+ "<style>"
+ "body { margin: 0px; }"
+ "[draggable] {"
+ "-webkit-user-select: none; user-select: none; -webkit-user-drag: element; }"
+ "</style>"
+ "<div style='width: 300px; height: 100px;'>"
+ "<svg width='500' height='500'>"
+ "<rect x='100' y='100' width='100px' height='100px' fill='blue' draggable='true'/>"
+ "</svg>"
+ "</div>");
+ PlatformMouseEvent mouseDownEvent1(
+ IntPoint(145, 144),
+ IntPoint(212, 282),
+ LeftButton,
+ PlatformEvent::MousePressed,
+ 1,
+ PlatformEvent::Modifiers::LeftButtonDown,
+ WTF::monotonicallyIncreasingTime());
+ document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent1);
+
+ PlatformMouseEvent mouseMoveEvent(
+ IntPoint(618, 298),
+ IntPoint(685, 436),
+ LeftButton,
+ PlatformEvent::MouseMoved,
+ 1,
+ PlatformEvent::Modifiers::LeftButtonDown,
+ WTF::monotonicallyIncreasingTime());
+ document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent);
+
+ EXPECT_EQ(IntPoint(45, 44), document().frame()->eventHandler().dragDataTransferLocationForTesting());
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698