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 <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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 361 | 361 |
| 362 LongPressEventBuilder longPressEvent(IntPoint(200, 200)); | 362 LongPressEventBuilder longPressEvent(IntPoint(200, 200)); |
| 363 document().frame()->eventHandler().handleGestureEvent(longPressEvent); | 363 document().frame()->eventHandler().handleGestureEvent(longPressEvent); |
| 364 | 364 |
| 365 ASSERT_TRUE( | 365 ASSERT_TRUE( |
| 366 selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret()); | 366 selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret()); |
| 367 ASSERT_TRUE(selection().isHandleVisible()); | 367 ASSERT_TRUE(selection().isHandleVisible()); |
| 368 } | 368 } |
| 369 | 369 |
| 370 TEST_F(EventHandlerTest, ClearHandleAfterTap) { | 370 TEST_F(EventHandlerTest, ClearHandleAfterTap) { |
| 371 setHtmlInnerHTML("<textarea cols=50 rows=50>Enter text</textarea>"); | 371 setHtmlInnerHTML( |
| 372 "<textarea cols=50 rows=10>Enter text</textarea>" | |
| 373 "<div style='height: 1000px; width: 1000px;'></div>"); | |
|
hugoh_UTC2
2017/03/15 01:48:09
I think we should fix that tapping on <body> gives
| |
| 372 | 374 |
| 373 // Show handle | 375 // Show handle |
| 374 LongPressEventBuilder longPressEvent(IntPoint(200, 200)); | 376 LongPressEventBuilder longPressEvent(IntPoint(200, 10)); |
| 375 document().frame()->eventHandler().handleGestureEvent(longPressEvent); | 377 document().frame()->eventHandler().handleGestureEvent(longPressEvent); |
| 376 | 378 |
| 377 ASSERT_TRUE( | 379 ASSERT_TRUE( |
| 378 selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret()); | 380 selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret()); |
| 379 ASSERT_TRUE(selection().isHandleVisible()); | 381 ASSERT_TRUE(selection().isHandleVisible()); |
| 380 | 382 |
| 381 // Tap away from text area should clear handle | 383 // Tap away from text area should clear handle |
| 382 TapEventBuilder singleTapEvent(IntPoint(700, 700), 1); | 384 TapEventBuilder singleTapEvent(IntPoint(200, 350), 1); |
| 383 document().frame()->eventHandler().handleGestureEvent(singleTapEvent); | 385 document().frame()->eventHandler().handleGestureEvent(singleTapEvent); |
| 384 | 386 |
| 385 ASSERT_TRUE( | |
| 386 selection().computeVisibleSelectionInDOMTreeDeprecated().isNone()); | |
| 387 ASSERT_FALSE(selection().isHandleVisible()); | 387 ASSERT_FALSE(selection().isHandleVisible()); |
| 388 } | 388 } |
| 389 | 389 |
| 390 TEST_F(EventHandlerTest, HandleNotShownOnMouseEvents) { | 390 TEST_F(EventHandlerTest, HandleNotShownOnMouseEvents) { |
| 391 setHtmlInnerHTML("<textarea cols=50 rows=50>Enter text</textarea>"); | 391 setHtmlInnerHTML("<textarea cols=50 rows=50>Enter text</textarea>"); |
| 392 | 392 |
| 393 MousePressEventBuilder leftMousePressEvent( | 393 MousePressEventBuilder leftMousePressEvent( |
| 394 IntPoint(200, 200), 1, WebPointerProperties::Button::Left); | 394 IntPoint(200, 200), 1, WebPointerProperties::Button::Left); |
| 395 document().frame()->eventHandler().handleMousePressEvent(leftMousePressEvent); | 395 document().frame()->eventHandler().handleMousePressEvent(leftMousePressEvent); |
| 396 | 396 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 516 WebInputEvent::MouseLeave, WebFloatPoint(0, 0), WebFloatPoint(0, 0), | 516 WebInputEvent::MouseLeave, WebFloatPoint(0, 0), WebFloatPoint(0, 0), |
| 517 WebPointerProperties::Button::NoButton, 0, WebInputEvent::NoModifiers, | 517 WebPointerProperties::Button::NoButton, 0, WebInputEvent::NoModifiers, |
| 518 TimeTicks::Now().InSeconds()); | 518 TimeTicks::Now().InSeconds()); |
| 519 mouseLeaveEvent.setFrameScale(1); | 519 mouseLeaveEvent.setFrameScale(1); |
| 520 document().frame()->eventHandler().handleMouseLeaveEvent(mouseLeaveEvent); | 520 document().frame()->eventHandler().handleMouseLeaveEvent(mouseLeaveEvent); |
| 521 | 521 |
| 522 EXPECT_EQ(WTF::String(), lastToolTip()); | 522 EXPECT_EQ(WTF::String(), lastToolTip()); |
| 523 } | 523 } |
| 524 | 524 |
| 525 } // namespace blink | 525 } // namespace blink |
| OLD | NEW |