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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 PlatformEvent::MouseMoved, | 234 PlatformEvent::MouseMoved, |
235 1, | 235 1, |
236 PlatformEvent::Modifiers::LeftButtonDown, | 236 PlatformEvent::Modifiers::LeftButtonDown, |
237 WTF::monotonicallyIncreasingTime()); | 237 WTF::monotonicallyIncreasingTime()); |
238 document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent); | 238 document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent); |
239 | 239 |
240 EXPECT_EQ(IntPoint(45, 44), document().frame()->eventHandler().dragDataTrans
ferLocationForTesting()); | 240 EXPECT_EQ(IntPoint(45, 44), document().frame()->eventHandler().dragDataTrans
ferLocationForTesting()); |
241 } | 241 } |
242 | 242 |
243 } // namespace blink | 243 } // namespace blink |
OLD | NEW |