| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/input/EventHandler.h" | 5 #include "core/input/EventHandler.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/Range.h" | 8 #include "core/dom/Range.h" |
| 9 #include "core/editing/Editor.h" | 9 #include "core/editing/Editor.h" |
| 10 #include "core/editing/FrameSelection.h" | 10 #include "core/editing/FrameSelection.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 PlatformMouseEvent mouseDownEvent( | 78 PlatformMouseEvent mouseDownEvent( |
| 79 IntPoint(0, 0), IntPoint(100, 200), WebPointerProperties::Button::Left, | 79 IntPoint(0, 0), IntPoint(100, 200), WebPointerProperties::Button::Left, |
| 80 PlatformEvent::MousePressed, 1, PlatformEvent::Modifiers::LeftButtonDown, | 80 PlatformEvent::MousePressed, 1, PlatformEvent::Modifiers::LeftButtonDown, |
| 81 WTF::monotonicallyIncreasingTime()); | 81 WTF::monotonicallyIncreasingTime()); |
| 82 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent); | 82 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent); |
| 83 | 83 |
| 84 PlatformMouseEvent mouseMoveEvent( | 84 PlatformMouseEvent mouseMoveEvent( |
| 85 IntPoint(100, 50), IntPoint(200, 250), WebPointerProperties::Button::Left, | 85 IntPoint(100, 50), IntPoint(200, 250), WebPointerProperties::Button::Left, |
| 86 PlatformEvent::MouseMoved, 1, PlatformEvent::Modifiers::LeftButtonDown, | 86 PlatformEvent::MouseMoved, 1, PlatformEvent::Modifiers::LeftButtonDown, |
| 87 WTF::monotonicallyIncreasingTime()); | 87 WTF::monotonicallyIncreasingTime()); |
| 88 document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent); | 88 document().frame()->eventHandler().handleMouseMoveEvent( |
| 89 mouseMoveEvent, Vector<PlatformMouseEvent>()); |
| 89 | 90 |
| 90 page().autoscrollController().animate(WTF::monotonicallyIncreasingTime()); | 91 page().autoscrollController().animate(WTF::monotonicallyIncreasingTime()); |
| 91 page().animator().serviceScriptedAnimations( | 92 page().animator().serviceScriptedAnimations( |
| 92 WTF::monotonicallyIncreasingTime()); | 93 WTF::monotonicallyIncreasingTime()); |
| 93 | 94 |
| 94 PlatformMouseEvent mouseUpEvent( | 95 PlatformMouseEvent mouseUpEvent( |
| 95 IntPoint(100, 50), IntPoint(200, 250), WebPointerProperties::Button::Left, | 96 IntPoint(100, 50), IntPoint(200, 250), WebPointerProperties::Button::Left, |
| 96 PlatformEvent::MouseReleased, 1, static_cast<PlatformEvent::Modifiers>(0), | 97 PlatformEvent::MouseReleased, 1, static_cast<PlatformEvent::Modifiers>(0), |
| 97 WTF::monotonicallyIncreasingTime()); | 98 WTF::monotonicallyIncreasingTime()); |
| 98 document().frame()->eventHandler().handleMouseReleaseEvent(mouseUpEvent); | 99 document().frame()->eventHandler().handleMouseReleaseEvent(mouseUpEvent); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 IntPoint(262, 29), IntPoint(329, 67), WebPointerProperties::Button::Left, | 183 IntPoint(262, 29), IntPoint(329, 67), WebPointerProperties::Button::Left, |
| 183 PlatformEvent::MousePressed, 1, PlatformEvent::Modifiers::LeftButtonDown, | 184 PlatformEvent::MousePressed, 1, PlatformEvent::Modifiers::LeftButtonDown, |
| 184 WTF::monotonicallyIncreasingTime()); | 185 WTF::monotonicallyIncreasingTime()); |
| 185 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent); | 186 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent); |
| 186 | 187 |
| 187 PlatformMouseEvent mouseMoveEvent(IntPoint(618, 298), IntPoint(685, 436), | 188 PlatformMouseEvent mouseMoveEvent(IntPoint(618, 298), IntPoint(685, 436), |
| 188 WebPointerProperties::Button::Left, | 189 WebPointerProperties::Button::Left, |
| 189 PlatformEvent::MouseMoved, 1, | 190 PlatformEvent::MouseMoved, 1, |
| 190 PlatformEvent::Modifiers::LeftButtonDown, | 191 PlatformEvent::Modifiers::LeftButtonDown, |
| 191 WTF::monotonicallyIncreasingTime()); | 192 WTF::monotonicallyIncreasingTime()); |
| 192 document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent); | 193 document().frame()->eventHandler().handleMouseMoveEvent( |
| 194 mouseMoveEvent, Vector<PlatformMouseEvent>()); |
| 193 | 195 |
| 194 EXPECT_EQ( | 196 EXPECT_EQ( |
| 195 IntPoint(12, 29), | 197 IntPoint(12, 29), |
| 196 document().frame()->eventHandler().dragDataTransferLocationForTesting()); | 198 document().frame()->eventHandler().dragDataTransferLocationForTesting()); |
| 197 } | 199 } |
| 198 | 200 |
| 199 TEST_F(EventHandlerTest, draggedSVGImagePositionTest) { | 201 TEST_F(EventHandlerTest, draggedSVGImagePositionTest) { |
| 200 setHtmlInnerHTML( | 202 setHtmlInnerHTML( |
| 201 "<style>" | 203 "<style>" |
| 202 "body { margin: 0px; }" | 204 "body { margin: 0px; }" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 215 PlatformEvent::MousePressed, 1, | 217 PlatformEvent::MousePressed, 1, |
| 216 PlatformEvent::Modifiers::LeftButtonDown, | 218 PlatformEvent::Modifiers::LeftButtonDown, |
| 217 WTF::monotonicallyIncreasingTime()); | 219 WTF::monotonicallyIncreasingTime()); |
| 218 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent); | 220 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent); |
| 219 | 221 |
| 220 PlatformMouseEvent mouseMoveEvent(IntPoint(618, 298), IntPoint(685, 436), | 222 PlatformMouseEvent mouseMoveEvent(IntPoint(618, 298), IntPoint(685, 436), |
| 221 WebPointerProperties::Button::Left, | 223 WebPointerProperties::Button::Left, |
| 222 PlatformEvent::MouseMoved, 1, | 224 PlatformEvent::MouseMoved, 1, |
| 223 PlatformEvent::Modifiers::LeftButtonDown, | 225 PlatformEvent::Modifiers::LeftButtonDown, |
| 224 WTF::monotonicallyIncreasingTime()); | 226 WTF::monotonicallyIncreasingTime()); |
| 225 document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent); | 227 document().frame()->eventHandler().handleMouseMoveEvent( |
| 228 mouseMoveEvent, Vector<PlatformMouseEvent>()); |
| 226 | 229 |
| 227 EXPECT_EQ( | 230 EXPECT_EQ( |
| 228 IntPoint(45, 44), | 231 IntPoint(45, 44), |
| 229 document().frame()->eventHandler().dragDataTransferLocationForTesting()); | 232 document().frame()->eventHandler().dragDataTransferLocationForTesting()); |
| 230 } | 233 } |
| 231 | 234 |
| 232 // Regression test for http://crbug.com/641403 to verify we use up-to-date | 235 // Regression test for http://crbug.com/641403 to verify we use up-to-date |
| 233 // layout tree for dispatching "contextmenu" event. | 236 // layout tree for dispatching "contextmenu" event. |
| 234 TEST_F(EventHandlerTest, sendContextMenuEventWithHover) { | 237 TEST_F(EventHandlerTest, sendContextMenuEventWithHover) { |
| 235 setHtmlInnerHTML( | 238 setHtmlInnerHTML( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 249 PlatformMouseEvent mouseDownEvent( | 252 PlatformMouseEvent mouseDownEvent( |
| 250 IntPoint(0, 0), IntPoint(100, 200), WebPointerProperties::Button::Right, | 253 IntPoint(0, 0), IntPoint(100, 200), WebPointerProperties::Button::Right, |
| 251 PlatformEvent::MousePressed, 1, PlatformEvent::Modifiers::RightButtonDown, | 254 PlatformEvent::MousePressed, 1, PlatformEvent::Modifiers::RightButtonDown, |
| 252 WTF::monotonicallyIncreasingTime()); | 255 WTF::monotonicallyIncreasingTime()); |
| 253 EXPECT_EQ( | 256 EXPECT_EQ( |
| 254 WebInputEventResult::HandledApplication, | 257 WebInputEventResult::HandledApplication, |
| 255 document().frame()->eventHandler().sendContextMenuEvent(mouseDownEvent)); | 258 document().frame()->eventHandler().sendContextMenuEvent(mouseDownEvent)); |
| 256 } | 259 } |
| 257 | 260 |
| 258 } // namespace blink | 261 } // namespace blink |
| OLD | NEW |