| 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 <memory> | 7 #include <memory> |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/dom/Range.h" | 9 #include "core/dom/Range.h" |
| 10 #include "core/editing/Editor.h" | 10 #include "core/editing/Editor.h" |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 MousePressEventBuilder triple_click_mouse_press_event( | 455 MousePressEventBuilder triple_click_mouse_press_event( |
| 456 IntPoint(200, 200), 3, WebPointerProperties::Button::kLeft); | 456 IntPoint(200, 200), 3, WebPointerProperties::Button::kLeft); |
| 457 GetDocument().GetFrame()->GetEventHandler().HandleMousePressEvent( | 457 GetDocument().GetFrame()->GetEventHandler().HandleMousePressEvent( |
| 458 triple_click_mouse_press_event); | 458 triple_click_mouse_press_event); |
| 459 | 459 |
| 460 ASSERT_TRUE( | 460 ASSERT_TRUE( |
| 461 Selection().ComputeVisibleSelectionInDOMTreeDeprecated().IsRange()); | 461 Selection().ComputeVisibleSelectionInDOMTreeDeprecated().IsRange()); |
| 462 ASSERT_FALSE(Selection().IsHandleVisible()); | 462 ASSERT_FALSE(Selection().IsHandleVisible()); |
| 463 } | 463 } |
| 464 | 464 |
| 465 TEST_F(EventHandlerTest, MisspellingContextMenuEvent) { |
| 466 if (GetDocument() |
| 467 .GetFrame() |
| 468 ->GetEditor() |
| 469 .Behavior() |
| 470 .ShouldSelectOnContextualMenuClick()) |
| 471 return; |
| 472 |
| 473 SetHtmlInnerHTML("<textarea cols=50 rows=50>Mispellinggg</textarea>"); |
| 474 |
| 475 TapEventBuilder single_tap_event(IntPoint(10, 10), 1); |
| 476 GetDocument().GetFrame()->GetEventHandler().HandleGestureEvent( |
| 477 single_tap_event); |
| 478 |
| 479 ASSERT_TRUE( |
| 480 Selection().ComputeVisibleSelectionInDOMTreeDeprecated().IsCaret()); |
| 481 ASSERT_TRUE(Selection().IsHandleVisible()); |
| 482 |
| 483 GetDocument().GetFrame()->GetEventHandler().ShowNonLocatedContextMenu( |
| 484 nullptr, kMenuSourceTouchHandle); |
| 485 |
| 486 ASSERT_TRUE( |
| 487 Selection().ComputeVisibleSelectionInDOMTreeDeprecated().IsCaret()); |
| 488 ASSERT_TRUE(Selection().IsHandleVisible()); |
| 489 } |
| 490 |
| 465 TEST_F(EventHandlerTest, dragEndInNewDrag) { | 491 TEST_F(EventHandlerTest, dragEndInNewDrag) { |
| 466 SetHtmlInnerHTML( | 492 SetHtmlInnerHTML( |
| 467 "<style>.box { width: 100px; height: 100px; display: block; }</style>" | 493 "<style>.box { width: 100px; height: 100px; display: block; }</style>" |
| 468 "<a class='box' href=''>Drag me</a>"); | 494 "<a class='box' href=''>Drag me</a>"); |
| 469 | 495 |
| 470 WebMouseEvent mouse_down_event( | 496 WebMouseEvent mouse_down_event( |
| 471 WebInputEvent::kMouseDown, WebFloatPoint(50, 50), WebFloatPoint(50, 50), | 497 WebInputEvent::kMouseDown, WebFloatPoint(50, 50), WebFloatPoint(50, 50), |
| 472 WebPointerProperties::Button::kLeft, 1, | 498 WebPointerProperties::Button::kLeft, 1, |
| 473 WebInputEvent::Modifiers::kLeftButtonDown, TimeTicks::Now().InSeconds()); | 499 WebInputEvent::Modifiers::kLeftButtonDown, TimeTicks::Now().InSeconds()); |
| 474 mouse_down_event.SetFrameScale(1); | 500 mouse_down_event.SetFrameScale(1); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 WebPointerProperties::Button::kNoButton, 0, WebInputEvent::kNoModifiers, | 580 WebPointerProperties::Button::kNoButton, 0, WebInputEvent::kNoModifiers, |
| 555 TimeTicks::Now().InSeconds()); | 581 TimeTicks::Now().InSeconds()); |
| 556 mouse_leave_event.SetFrameScale(1); | 582 mouse_leave_event.SetFrameScale(1); |
| 557 GetDocument().GetFrame()->GetEventHandler().HandleMouseLeaveEvent( | 583 GetDocument().GetFrame()->GetEventHandler().HandleMouseLeaveEvent( |
| 558 mouse_leave_event); | 584 mouse_leave_event); |
| 559 | 585 |
| 560 EXPECT_EQ(WTF::String(), LastToolTip()); | 586 EXPECT_EQ(WTF::String(), LastToolTip()); |
| 561 } | 587 } |
| 562 | 588 |
| 563 } // namespace blink | 589 } // namespace blink |
| OLD | NEW |