| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 IntPoint(200, 250), | 99 IntPoint(200, 250), |
| 100 LeftButton, | 100 LeftButton, |
| 101 PlatformEvent::MouseReleased, | 101 PlatformEvent::MouseReleased, |
| 102 1, | 102 1, |
| 103 static_cast<PlatformEvent::Modifiers>(0), | 103 static_cast<PlatformEvent::Modifiers>(0), |
| 104 WTF::monotonicallyIncreasingTime()); | 104 WTF::monotonicallyIncreasingTime()); |
| 105 document().frame()->eventHandler().handleMouseReleaseEvent(mouseUpEvent); | 105 document().frame()->eventHandler().handleMouseReleaseEvent(mouseUpEvent); |
| 106 | 106 |
| 107 FrameSelection& selection = document().frame()->selection(); | 107 FrameSelection& selection = document().frame()->selection(); |
| 108 ASSERT_TRUE(selection.isRange()); | 108 ASSERT_TRUE(selection.isRange()); |
| 109 RefPtrWillBeRawPtr<Range> range = createRange(selection.selection().toNormal
izedEphemeralRange()); | 109 RawPtr<Range> range = createRange(selection.selection().toNormalizedEphemera
lRange()); |
| 110 ASSERT_TRUE(range.get()); | 110 ASSERT_TRUE(range.get()); |
| 111 EXPECT_EQ("Line 1\nLine 2", range->text()); | 111 EXPECT_EQ("Line 1\nLine 2", range->text()); |
| 112 } | 112 } |
| 113 | 113 |
| 114 TEST_F(EventHandlerTest, multiClickSelectionFromTap) | 114 TEST_F(EventHandlerTest, multiClickSelectionFromTap) |
| 115 { | 115 { |
| 116 setHtmlInnerHTML("<style> body { margin: 0px; } .line { display: block; widt
h: 300px; height: 30px; } </style>" | 116 setHtmlInnerHTML("<style> body { margin: 0px; } .line { display: block; widt
h: 300px; height: 30px; } </style>" |
| 117 "<body contenteditable='true'><span class='line' id='line'>One Two Three
</span></body>"); | 117 "<body contenteditable='true'><span class='line' id='line'>One Two Three
</span></body>"); |
| 118 | 118 |
| 119 FrameSelection& selection = document().frame()->selection(); | 119 FrameSelection& selection = document().frame()->selection(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 ASSERT_TRUE(selection.isCaret()); | 165 ASSERT_TRUE(selection.isCaret()); |
| 166 EXPECT_EQ(Position(line, 0), selection.start()); | 166 EXPECT_EQ(Position(line, 0), selection.start()); |
| 167 | 167 |
| 168 TapEventBuilder tripleTapEvent(IntPoint(0, 0), 3); | 168 TapEventBuilder tripleTapEvent(IntPoint(0, 0), 3); |
| 169 document().frame()->eventHandler().handleGestureEvent(tripleTapEvent); | 169 document().frame()->eventHandler().handleGestureEvent(tripleTapEvent); |
| 170 ASSERT_TRUE(selection.isCaret()); | 170 ASSERT_TRUE(selection.isCaret()); |
| 171 EXPECT_EQ(Position(line, 0), selection.start()); | 171 EXPECT_EQ(Position(line, 0), selection.start()); |
| 172 } | 172 } |
| 173 | 173 |
| 174 } // namespace blink | 174 } // namespace blink |
| OLD | NEW |