Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Unified Diff: third_party/WebKit/Source/core/input/EventHandlerTest.cpp

Issue 2704123003: Expand FrameSeleciton::isCaret() to increase chances of hoisting update layout (Closed)
Patch Set: 2017-02-21T12:50:46 Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/input/EventHandlerTest.cpp
diff --git a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
index f2646b81383d95a16de6278b3eefabff8c681747..9e03c33fc7b400621f0945fa7446647546b33200 100644
--- a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
@@ -153,7 +153,8 @@ TEST_F(EventHandlerTest, multiClickSelectionFromTap) {
TapEventBuilder singleTapEvent(IntPoint(0, 0), 1);
document().frame()->eventHandler().handleGestureEvent(singleTapEvent);
- ASSERT_TRUE(selection().isCaret());
+ ASSERT_TRUE(
+ selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret());
EXPECT_EQ(Position(line, 0), selection().start());
// Multi-tap events on editable elements should trigger selection, just
@@ -188,18 +189,21 @@ TEST_F(EventHandlerTest, multiClickSelectionFromTapDisabledIfNotEditable) {
TapEventBuilder singleTapEvent(IntPoint(0, 0), 1);
document().frame()->eventHandler().handleGestureEvent(singleTapEvent);
- ASSERT_TRUE(selection().isCaret());
+ ASSERT_TRUE(
+ selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret());
EXPECT_EQ(Position(line, 0), selection().start());
// As the text is readonly, multi-tap events should not trigger selection.
TapEventBuilder doubleTapEvent(IntPoint(0, 0), 2);
document().frame()->eventHandler().handleGestureEvent(doubleTapEvent);
- ASSERT_TRUE(selection().isCaret());
+ ASSERT_TRUE(
+ selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret());
EXPECT_EQ(Position(line, 0), selection().start());
TapEventBuilder tripleTapEvent(IntPoint(0, 0), 3);
document().frame()->eventHandler().handleGestureEvent(tripleTapEvent);
- ASSERT_TRUE(selection().isCaret());
+ ASSERT_TRUE(
+ selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret());
EXPECT_EQ(Position(line, 0), selection().start());
}
@@ -304,7 +308,8 @@ TEST_F(EventHandlerTest, EmptyTextfieldInsertionOnTap) {
TapEventBuilder singleTapEvent(IntPoint(200, 200), 1);
document().frame()->eventHandler().handleGestureEvent(singleTapEvent);
- ASSERT_TRUE(selection().isCaret());
+ ASSERT_TRUE(
+ selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret());
ASSERT_FALSE(selection().isHandleVisible());
}
@@ -314,7 +319,8 @@ TEST_F(EventHandlerTest, NonEmptyTextfieldInsertionOnTap) {
TapEventBuilder singleTapEvent(IntPoint(200, 200), 1);
document().frame()->eventHandler().handleGestureEvent(singleTapEvent);
- ASSERT_TRUE(selection().isCaret());
+ ASSERT_TRUE(
+ selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret());
ASSERT_TRUE(selection().isHandleVisible());
}
@@ -324,14 +330,16 @@ TEST_F(EventHandlerTest, EmptyTextfieldInsertionOnLongPress) {
LongPressEventBuilder longPressEvent(IntPoint(200, 200));
document().frame()->eventHandler().handleGestureEvent(longPressEvent);
- ASSERT_TRUE(selection().isCaret());
+ ASSERT_TRUE(
+ selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret());
ASSERT_TRUE(selection().isHandleVisible());
// Single Tap on an empty edit field should clear insertion handle
TapEventBuilder singleTapEvent(IntPoint(200, 200), 1);
document().frame()->eventHandler().handleGestureEvent(singleTapEvent);
- ASSERT_TRUE(selection().isCaret());
+ ASSERT_TRUE(
+ selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret());
ASSERT_FALSE(selection().isHandleVisible());
}
@@ -341,7 +349,8 @@ TEST_F(EventHandlerTest, NonEmptyTextfieldInsertionOnLongPress) {
LongPressEventBuilder longPressEvent(IntPoint(200, 200));
document().frame()->eventHandler().handleGestureEvent(longPressEvent);
- ASSERT_TRUE(selection().isCaret());
+ ASSERT_TRUE(
+ selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret());
ASSERT_TRUE(selection().isHandleVisible());
}
@@ -352,7 +361,8 @@ TEST_F(EventHandlerTest, ClearHandleAfterTap) {
LongPressEventBuilder longPressEvent(IntPoint(200, 200));
document().frame()->eventHandler().handleGestureEvent(longPressEvent);
- ASSERT_TRUE(selection().isCaret());
+ ASSERT_TRUE(
+ selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret());
ASSERT_TRUE(selection().isHandleVisible());
// Tap away from text area should clear handle
@@ -370,7 +380,8 @@ TEST_F(EventHandlerTest, HandleNotShownOnMouseEvents) {
IntPoint(200, 200), 1, WebPointerProperties::Button::Left);
document().frame()->eventHandler().handleMousePressEvent(leftMousePressEvent);
- ASSERT_TRUE(selection().isCaret());
+ ASSERT_TRUE(
+ selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret());
ASSERT_FALSE(selection().isHandleVisible());
MousePressEventBuilder rightMousePressEvent(
@@ -378,7 +389,8 @@ TEST_F(EventHandlerTest, HandleNotShownOnMouseEvents) {
document().frame()->eventHandler().handleMousePressEvent(
rightMousePressEvent);
- ASSERT_TRUE(selection().isCaret());
+ ASSERT_TRUE(
+ selection().computeVisibleSelectionInDOMTreeDeprecated().isCaret());
ASSERT_FALSE(selection().isHandleVisible());
MousePressEventBuilder doubleClickMousePressEvent(

Powered by Google App Engine
This is Rietveld 408576698