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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 document().frame()->eventHandler().handleGestureEvent(doubleTapEvent); | 164 document().frame()->eventHandler().handleGestureEvent(doubleTapEvent); |
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 TEST_F(EventHandlerTest, draggedInlinePositionTest) | |
175 { | |
176 setHtmlInnerHTML( | |
177 "<style>" | |
178 "[draggable] {-moz-user-select: none; -khtml-user-select: none; -webkit- user-select: none;" | |
fs
2016/02/23 17:27:45
Including the -moz-* and -khtml-* seems a bit exce
hyunjunekim2
2016/02/24 13:06:36
Done.
| |
179 "user-select: none; -webkit-user-drag: element; }" | |
180 "</style>" | |
181 "<div style='width: 300px; height: 100px;'>" | |
182 "<span style='background: blue; width: 50px; height: 50px; margin-left: 250px; font-size: 50px;' draggable='true'>abcd</span>" | |
183 "</div>"); | |
184 PlatformMouseEvent mouseDownEvent1( | |
fs
2016/02/23 17:27:45
Why the '1' at the end?
hyunjunekim2
2016/02/24 13:06:36
Done.
| |
185 IntPoint(262, 29), | |
186 IntPoint(329, 167), | |
187 LeftButton, | |
188 PlatformEvent::MousePressed, | |
189 1, | |
190 PlatformEvent::Modifiers::LeftButtonDown, | |
191 WTF::monotonicallyIncreasingTime()); | |
192 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent1); | |
193 | |
194 PlatformMouseEvent mouseMoveEvent( | |
195 IntPoint(618, 298), | |
196 IntPoint(685, 436), | |
197 LeftButton, | |
198 PlatformEvent::MouseMoved, | |
199 1, | |
200 PlatformEvent::Modifiers::LeftButtonDown, | |
201 WTF::monotonicallyIncreasingTime()); | |
202 document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent); | |
203 | |
204 EXPECT_EQ(IntPoint(4, 21), document().frame()->eventHandler().dragDataTransf erLocation()); | |
205 } | |
206 | |
207 TEST_F(EventHandlerTest, draggedSVGImagePositionTest) | |
208 { | |
209 setHtmlInnerHTML( | |
210 "<style>" | |
211 "[draggable] {-moz-user-select: none; -khtml-user-select: none; -webkit- user-select: none;" | |
fs
2016/02/23 17:27:45
Same as above.
hyunjunekim2
2016/02/24 13:06:36
Done.
| |
212 "user-select: none; -webkit-user-drag: element; }" | |
213 "</style>" | |
214 "<div style='width: 300px; height: 100px;'>" | |
215 "<svg width='500' height='500'>" | |
216 "<rect x='100' y='100' width='100px' height='100px' fill='blue' draggabl e='true'/>" | |
217 "</svg>" | |
218 "</div>"); | |
219 PlatformMouseEvent mouseDownEvent1( | |
fs
2016/02/23 17:27:46
Same as above.
hyunjunekim2
2016/02/24 13:06:36
Done.
| |
220 IntPoint(145, 144), | |
221 IntPoint(212, 282), | |
222 LeftButton, | |
223 PlatformEvent::MousePressed, | |
224 1, | |
225 PlatformEvent::Modifiers::LeftButtonDown, | |
226 WTF::monotonicallyIncreasingTime()); | |
227 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent1); | |
228 | |
229 PlatformMouseEvent mouseMoveEvent( | |
230 IntPoint(618, 298), | |
231 IntPoint(685, 436), | |
232 LeftButton, | |
233 PlatformEvent::MouseMoved, | |
234 1, | |
235 PlatformEvent::Modifiers::LeftButtonDown, | |
236 WTF::monotonicallyIncreasingTime()); | |
237 document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent); | |
238 | |
239 EXPECT_EQ(IntPoint(37, 36), document().frame()->eventHandler().dragDataTrans ferLocation()); | |
240 } | |
241 | |
174 } // namespace blink | 242 } // namespace blink |
OLD | NEW |