Chromium Code Reviews| 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 .build()); | 249 .build()); |
| 250 PlatformMouseEvent mouseDownEvent( | 250 PlatformMouseEvent mouseDownEvent( |
| 251 IntPoint(0, 0), IntPoint(100, 200), WebPointerProperties::Button::Right, | 251 IntPoint(0, 0), IntPoint(100, 200), WebPointerProperties::Button::Right, |
| 252 PlatformEvent::MousePressed, 1, PlatformEvent::Modifiers::RightButtonDown, | 252 PlatformEvent::MousePressed, 1, PlatformEvent::Modifiers::RightButtonDown, |
| 253 TimeTicks::Now()); | 253 TimeTicks::Now()); |
| 254 EXPECT_EQ( | 254 EXPECT_EQ( |
| 255 WebInputEventResult::HandledApplication, | 255 WebInputEventResult::HandledApplication, |
| 256 document().frame()->eventHandler().sendContextMenuEvent(mouseDownEvent)); | 256 document().frame()->eventHandler().sendContextMenuEvent(mouseDownEvent)); |
| 257 } | 257 } |
| 258 | 258 |
| 259 TEST_F(EventHandlerTest, dragEndInNewDrag) { | |
| 260 setHtmlInnerHTML( | |
| 261 "<style>.box { width: 100px; height: 100px; display: block; }</style>" | |
| 262 "<a class='box' href=''>Drag me</a>"); | |
| 263 | |
| 264 PlatformMouseEvent mouseDownEvent( | |
| 265 IntPoint(50, 50), IntPoint(50, 50), WebPointerProperties::Button::Left, | |
| 266 PlatformEvent::MousePressed, 1, PlatformEvent::Modifiers::LeftButtonDown, | |
| 267 TimeTicks::Now()); | |
| 268 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent); | |
| 269 | |
| 270 PlatformMouseEvent mouseMoveEvent( | |
| 271 IntPoint(51, 50), IntPoint(51, 50), WebPointerProperties::Button::Left, | |
| 272 PlatformEvent::MouseMoved, 1, PlatformEvent::Modifiers::LeftButtonDown, | |
| 273 TimeTicks::Now()); | |
| 274 document().frame()->eventHandler().handleMouseMoveEvent( | |
| 275 mouseMoveEvent, Vector<PlatformMouseEvent>()); | |
| 276 | |
| 277 // This reproduces what might be the conditions of http://crbug.com/677916 | |
| 278 // Given the current code, it is unclear how the dragSourceEndedAt() call | |
| 279 // could occur before a drag operation is started. | |
|
dcheng
2017/01/17 22:24:11
Let's file a followup bug for this (or make sure w
pwnall
2017/01/18 00:17:49
Done.
I'll also monitor the crash metrics to make
| |
| 280 | |
| 281 PlatformMouseEvent mouseUpEvent( | |
| 282 IntPoint(100, 50), IntPoint(200, 250), WebPointerProperties::Button::Left, | |
| 283 PlatformEvent::MouseReleased, 1, static_cast<PlatformEvent::Modifiers>(0), | |
| 284 TimeTicks::Now()); | |
| 285 document().frame()->eventHandler().dragSourceEndedAt(mouseUpEvent, | |
| 286 DragOperationNone); | |
| 287 | |
| 288 // This test passes if it doesn't crash. | |
| 289 } | |
| 290 | |
| 259 } // namespace blink | 291 } // namespace blink |
| OLD | NEW |