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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 PlatformMouseEvent mouseDownEvent( | 79 PlatformMouseEvent mouseDownEvent( |
80 IntPoint(0, 0), IntPoint(100, 200), WebPointerProperties::Button::Left, | 80 IntPoint(0, 0), IntPoint(100, 200), WebPointerProperties::Button::Left, |
81 PlatformEvent::MousePressed, 1, PlatformEvent::Modifiers::LeftButtonDown, | 81 PlatformEvent::MousePressed, 1, PlatformEvent::Modifiers::LeftButtonDown, |
82 WTF::monotonicallyIncreasingTime()); | 82 WTF::monotonicallyIncreasingTime()); |
83 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent); | 83 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent); |
84 | 84 |
85 PlatformMouseEvent mouseMoveEvent( | 85 PlatformMouseEvent mouseMoveEvent( |
86 IntPoint(100, 50), IntPoint(200, 250), WebPointerProperties::Button::Left, | 86 IntPoint(100, 50), IntPoint(200, 250), WebPointerProperties::Button::Left, |
87 PlatformEvent::MouseMoved, 1, PlatformEvent::Modifiers::LeftButtonDown, | 87 PlatformEvent::MouseMoved, 1, PlatformEvent::Modifiers::LeftButtonDown, |
88 WTF::monotonicallyIncreasingTime()); | 88 WTF::monotonicallyIncreasingTime()); |
89 document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent); | 89 document().frame()->eventHandler().handleMouseMoveEvent( |
| 90 mouseMoveEvent, Vector<PlatformMouseEvent>()); |
90 | 91 |
91 page().autoscrollController().animate(WTF::monotonicallyIncreasingTime()); | 92 page().autoscrollController().animate(WTF::monotonicallyIncreasingTime()); |
92 page().animator().serviceScriptedAnimations( | 93 page().animator().serviceScriptedAnimations( |
93 WTF::monotonicallyIncreasingTime()); | 94 WTF::monotonicallyIncreasingTime()); |
94 | 95 |
95 PlatformMouseEvent mouseUpEvent( | 96 PlatformMouseEvent mouseUpEvent( |
96 IntPoint(100, 50), IntPoint(200, 250), WebPointerProperties::Button::Left, | 97 IntPoint(100, 50), IntPoint(200, 250), WebPointerProperties::Button::Left, |
97 PlatformEvent::MouseReleased, 1, static_cast<PlatformEvent::Modifiers>(0), | 98 PlatformEvent::MouseReleased, 1, static_cast<PlatformEvent::Modifiers>(0), |
98 WTF::monotonicallyIncreasingTime()); | 99 WTF::monotonicallyIncreasingTime()); |
99 document().frame()->eventHandler().handleMouseReleaseEvent(mouseUpEvent); | 100 document().frame()->eventHandler().handleMouseReleaseEvent(mouseUpEvent); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 IntPoint(262, 29), IntPoint(329, 67), WebPointerProperties::Button::Left, | 184 IntPoint(262, 29), IntPoint(329, 67), WebPointerProperties::Button::Left, |
184 PlatformEvent::MousePressed, 1, PlatformEvent::Modifiers::LeftButtonDown, | 185 PlatformEvent::MousePressed, 1, PlatformEvent::Modifiers::LeftButtonDown, |
185 WTF::monotonicallyIncreasingTime()); | 186 WTF::monotonicallyIncreasingTime()); |
186 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent); | 187 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent); |
187 | 188 |
188 PlatformMouseEvent mouseMoveEvent(IntPoint(618, 298), IntPoint(685, 436), | 189 PlatformMouseEvent mouseMoveEvent(IntPoint(618, 298), IntPoint(685, 436), |
189 WebPointerProperties::Button::Left, | 190 WebPointerProperties::Button::Left, |
190 PlatformEvent::MouseMoved, 1, | 191 PlatformEvent::MouseMoved, 1, |
191 PlatformEvent::Modifiers::LeftButtonDown, | 192 PlatformEvent::Modifiers::LeftButtonDown, |
192 WTF::monotonicallyIncreasingTime()); | 193 WTF::monotonicallyIncreasingTime()); |
193 document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent); | 194 document().frame()->eventHandler().handleMouseMoveEvent( |
| 195 mouseMoveEvent, Vector<PlatformMouseEvent>()); |
194 | 196 |
195 EXPECT_EQ( | 197 EXPECT_EQ( |
196 IntPoint(12, 29), | 198 IntPoint(12, 29), |
197 document().frame()->eventHandler().dragDataTransferLocationForTesting()); | 199 document().frame()->eventHandler().dragDataTransferLocationForTesting()); |
198 } | 200 } |
199 | 201 |
200 TEST_F(EventHandlerTest, draggedSVGImagePositionTest) { | 202 TEST_F(EventHandlerTest, draggedSVGImagePositionTest) { |
201 setHtmlInnerHTML( | 203 setHtmlInnerHTML( |
202 "<style>" | 204 "<style>" |
203 "body { margin: 0px; }" | 205 "body { margin: 0px; }" |
(...skipping 12 matching lines...) Expand all Loading... |
216 PlatformEvent::MousePressed, 1, | 218 PlatformEvent::MousePressed, 1, |
217 PlatformEvent::Modifiers::LeftButtonDown, | 219 PlatformEvent::Modifiers::LeftButtonDown, |
218 WTF::monotonicallyIncreasingTime()); | 220 WTF::monotonicallyIncreasingTime()); |
219 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent); | 221 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent); |
220 | 222 |
221 PlatformMouseEvent mouseMoveEvent(IntPoint(618, 298), IntPoint(685, 436), | 223 PlatformMouseEvent mouseMoveEvent(IntPoint(618, 298), IntPoint(685, 436), |
222 WebPointerProperties::Button::Left, | 224 WebPointerProperties::Button::Left, |
223 PlatformEvent::MouseMoved, 1, | 225 PlatformEvent::MouseMoved, 1, |
224 PlatformEvent::Modifiers::LeftButtonDown, | 226 PlatformEvent::Modifiers::LeftButtonDown, |
225 WTF::monotonicallyIncreasingTime()); | 227 WTF::monotonicallyIncreasingTime()); |
226 document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent); | 228 document().frame()->eventHandler().handleMouseMoveEvent( |
| 229 mouseMoveEvent, Vector<PlatformMouseEvent>()); |
227 | 230 |
228 EXPECT_EQ( | 231 EXPECT_EQ( |
229 IntPoint(45, 44), | 232 IntPoint(45, 44), |
230 document().frame()->eventHandler().dragDataTransferLocationForTesting()); | 233 document().frame()->eventHandler().dragDataTransferLocationForTesting()); |
231 } | 234 } |
232 | 235 |
233 // Regression test for http://crbug.com/641403 to verify we use up-to-date | 236 // Regression test for http://crbug.com/641403 to verify we use up-to-date |
234 // layout tree for dispatching "contextmenu" event. | 237 // layout tree for dispatching "contextmenu" event. |
235 TEST_F(EventHandlerTest, sendContextMenuEventWithHover) { | 238 TEST_F(EventHandlerTest, sendContextMenuEventWithHover) { |
236 setHtmlInnerHTML( | 239 setHtmlInnerHTML( |
(...skipping 14 matching lines...) Expand all Loading... |
251 PlatformMouseEvent mouseDownEvent( | 254 PlatformMouseEvent mouseDownEvent( |
252 IntPoint(0, 0), IntPoint(100, 200), WebPointerProperties::Button::Right, | 255 IntPoint(0, 0), IntPoint(100, 200), WebPointerProperties::Button::Right, |
253 PlatformEvent::MousePressed, 1, PlatformEvent::Modifiers::RightButtonDown, | 256 PlatformEvent::MousePressed, 1, PlatformEvent::Modifiers::RightButtonDown, |
254 WTF::monotonicallyIncreasingTime()); | 257 WTF::monotonicallyIncreasingTime()); |
255 EXPECT_EQ( | 258 EXPECT_EQ( |
256 WebInputEventResult::HandledApplication, | 259 WebInputEventResult::HandledApplication, |
257 document().frame()->eventHandler().sendContextMenuEvent(mouseDownEvent)); | 260 document().frame()->eventHandler().sendContextMenuEvent(mouseDownEvent)); |
258 } | 261 } |
259 | 262 |
260 } // namespace blink | 263 } // namespace blink |
OLD | NEW |