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

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandlerTest.cpp

Issue 2227563003: Refactoring button field and its type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix new instances Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 "<span class='line'>Line 1</span><span class='line'>Line 2</span><span c lass='line'>Line 3</span><span class='line'>Line 4</span><span class='line'>Line 5</span>" 67 "<span class='line'>Line 1</span><span class='line'>Line 2</span><span c lass='line'>Line 3</span><span class='line'>Line 4</span><span class='line'>Line 5</span>"
68 "<span class='line'>Line 6</span><span class='line'>Line 7</span><span c lass='line'>Line 8</span><span class='line'>Line 9</span><span class='line'>Line 10</span>" 68 "<span class='line'>Line 6</span><span class='line'>Line 7</span><span c lass='line'>Line 8</span><span class='line'>Line 9</span><span class='line'>Line 10</span>"
69 "</div>"); 69 "</div>");
70 70
71 FrameView* frameView = document().view(); 71 FrameView* frameView = document().view();
72 frameView->setScrollPosition(DoublePoint(0, 400), ProgrammaticScroll); 72 frameView->setScrollPosition(DoublePoint(0, 400), ProgrammaticScroll);
73 73
74 PlatformMouseEvent mouseDownEvent( 74 PlatformMouseEvent mouseDownEvent(
75 IntPoint(0, 0), 75 IntPoint(0, 0),
76 IntPoint(100, 200), 76 IntPoint(100, 200),
77 LeftButton, 77 WebPointerProperties::Button::Left,
78 PlatformEvent::MousePressed, 78 PlatformEvent::MousePressed,
79 1, 79 1,
80 PlatformEvent::Modifiers::LeftButtonDown, 80 PlatformEvent::Modifiers::LeftButtonDown,
81 WTF::monotonicallyIncreasingTime()); 81 WTF::monotonicallyIncreasingTime());
82 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent); 82 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent);
83 83
84 PlatformMouseEvent mouseMoveEvent( 84 PlatformMouseEvent mouseMoveEvent(
85 IntPoint(100, 50), 85 IntPoint(100, 50),
86 IntPoint(200, 250), 86 IntPoint(200, 250),
87 LeftButton, 87 WebPointerProperties::Button::Left,
88 PlatformEvent::MouseMoved, 88 PlatformEvent::MouseMoved,
89 1, 89 1,
90 PlatformEvent::Modifiers::LeftButtonDown, 90 PlatformEvent::Modifiers::LeftButtonDown,
91 WTF::monotonicallyIncreasingTime()); 91 WTF::monotonicallyIncreasingTime());
92 document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent); 92 document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent);
93 93
94 page().autoscrollController().animate(WTF::monotonicallyIncreasingTime()); 94 page().autoscrollController().animate(WTF::monotonicallyIncreasingTime());
95 page().animator().serviceScriptedAnimations(WTF::monotonicallyIncreasingTime ()); 95 page().animator().serviceScriptedAnimations(WTF::monotonicallyIncreasingTime ());
96 96
97 PlatformMouseEvent mouseUpEvent( 97 PlatformMouseEvent mouseUpEvent(
98 IntPoint(100, 50), 98 IntPoint(100, 50),
99 IntPoint(200, 250), 99 IntPoint(200, 250),
100 LeftButton, 100 WebPointerProperties::Button::Left,
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 Range* range = createRange(selection.selection().toNormalizedEphemeralRange( )); 109 Range* range = createRange(selection.selection().toNormalizedEphemeralRange( ));
110 ASSERT_TRUE(range); 110 ASSERT_TRUE(range);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 "<style>" 177 "<style>"
178 "body { margin: 0px; }" 178 "body { margin: 0px; }"
179 ".line { font-family: sans-serif; background: blue; width: 300px; height : 30px; font-size: 40px; margin-left: 250px; }" 179 ".line { font-family: sans-serif; background: blue; width: 300px; height : 30px; font-size: 40px; margin-left: 250px; }"
180 "</style>" 180 "</style>"
181 "<div style='width: 300px; height: 100px;'>" 181 "<div style='width: 300px; height: 100px;'>"
182 "<span class='line' draggable='true'>abcd</span>" 182 "<span class='line' draggable='true'>abcd</span>"
183 "</div>"); 183 "</div>");
184 PlatformMouseEvent mouseDownEvent( 184 PlatformMouseEvent mouseDownEvent(
185 IntPoint(262, 29), 185 IntPoint(262, 29),
186 IntPoint(329, 67), 186 IntPoint(329, 67),
187 LeftButton, 187 WebPointerProperties::Button::Left,
188 PlatformEvent::MousePressed, 188 PlatformEvent::MousePressed,
189 1, 189 1,
190 PlatformEvent::Modifiers::LeftButtonDown, 190 PlatformEvent::Modifiers::LeftButtonDown,
191 WTF::monotonicallyIncreasingTime()); 191 WTF::monotonicallyIncreasingTime());
192 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent); 192 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent);
193 193
194 PlatformMouseEvent mouseMoveEvent( 194 PlatformMouseEvent mouseMoveEvent(
195 IntPoint(618, 298), 195 IntPoint(618, 298),
196 IntPoint(685, 436), 196 IntPoint(685, 436),
197 LeftButton, 197 WebPointerProperties::Button::Left,
198 PlatformEvent::MouseMoved, 198 PlatformEvent::MouseMoved,
199 1, 199 1,
200 PlatformEvent::Modifiers::LeftButtonDown, 200 PlatformEvent::Modifiers::LeftButtonDown,
201 WTF::monotonicallyIncreasingTime()); 201 WTF::monotonicallyIncreasingTime());
202 document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent); 202 document().frame()->eventHandler().handleMouseMoveEvent(mouseMoveEvent);
203 203
204 EXPECT_EQ(IntPoint(12, 29), document().frame()->eventHandler().dragDataTrans ferLocationForTesting()); 204 EXPECT_EQ(IntPoint(12, 29), document().frame()->eventHandler().dragDataTrans ferLocationForTesting());
205 } 205 }
206 206
207 TEST_F(EventHandlerTest, draggedSVGImagePositionTest) 207 TEST_F(EventHandlerTest, draggedSVGImagePositionTest)
208 { 208 {
209 setHtmlInnerHTML( 209 setHtmlInnerHTML(
210 "<style>" 210 "<style>"
211 "body { margin: 0px; }" 211 "body { margin: 0px; }"
212 "[draggable] {" 212 "[draggable] {"
213 "-webkit-user-select: none; user-select: none; -webkit-user-drag: elemen t; }" 213 "-webkit-user-select: none; user-select: none; -webkit-user-drag: elemen t; }"
214 "</style>" 214 "</style>"
215 "<div style='width: 300px; height: 100px;'>" 215 "<div style='width: 300px; height: 100px;'>"
216 "<svg width='500' height='500'>" 216 "<svg width='500' height='500'>"
217 "<rect x='100' y='100' width='100px' height='100px' fill='blue' draggabl e='true'/>" 217 "<rect x='100' y='100' width='100px' height='100px' fill='blue' draggabl e='true'/>"
218 "</svg>" 218 "</svg>"
219 "</div>"); 219 "</div>");
220 PlatformMouseEvent mouseDownEvent( 220 PlatformMouseEvent mouseDownEvent(
221 IntPoint(145, 144), 221 IntPoint(145, 144),
222 IntPoint(212, 282), 222 IntPoint(212, 282),
223 LeftButton, 223 WebPointerProperties::Button::Left,
224 PlatformEvent::MousePressed, 224 PlatformEvent::MousePressed,
225 1, 225 1,
226 PlatformEvent::Modifiers::LeftButtonDown, 226 PlatformEvent::Modifiers::LeftButtonDown,
227 WTF::monotonicallyIncreasingTime()); 227 WTF::monotonicallyIncreasingTime());
228 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent); 228 document().frame()->eventHandler().handleMousePressEvent(mouseDownEvent);
229 229
230 PlatformMouseEvent mouseMoveEvent( 230 PlatformMouseEvent mouseMoveEvent(
231 IntPoint(618, 298), 231 IntPoint(618, 298),
232 IntPoint(685, 436), 232 IntPoint(685, 436),
233 LeftButton, 233 WebPointerProperties::Button::Left,
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/input/EventHandler.cpp ('k') | third_party/WebKit/Source/core/input/GestureManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698