OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 211 |
212 PlatformTouchEventBuilder platformTouchBuilder(view, webTouchEvent); | 212 PlatformTouchEventBuilder platformTouchBuilder(view, webTouchEvent); |
213 EXPECT_EQ(10, platformTouchBuilder.touchPoints()[0].screenPos().x()); | 213 EXPECT_EQ(10, platformTouchBuilder.touchPoints()[0].screenPos().x()); |
214 EXPECT_EQ(10, platformTouchBuilder.touchPoints()[0].screenPos().y()); | 214 EXPECT_EQ(10, platformTouchBuilder.touchPoints()[0].screenPos().y()); |
215 EXPECT_EQ(5, platformTouchBuilder.touchPoints()[0].pos().x()); | 215 EXPECT_EQ(5, platformTouchBuilder.touchPoints()[0].pos().x()); |
216 EXPECT_EQ(5, platformTouchBuilder.touchPoints()[0].pos().y()); | 216 EXPECT_EQ(5, platformTouchBuilder.touchPoints()[0].pos().y()); |
217 EXPECT_EQ(5, platformTouchBuilder.touchPoints()[0].radiusX()); | 217 EXPECT_EQ(5, platformTouchBuilder.touchPoints()[0].radiusX()); |
218 EXPECT_EQ(5, platformTouchBuilder.touchPoints()[0].radiusY()); | 218 EXPECT_EQ(5, platformTouchBuilder.touchPoints()[0].radiusY()); |
219 } | 219 } |
220 | 220 |
| 221 // Reverse builders should *not* go back to physical pixels, as they are use
d for plugins |
| 222 // which expect CSS pixel coordinates. |
221 { | 223 { |
222 PlatformMouseEvent platformMouseEvent(IntPoint(10, 10), IntPoint(10, 10)
, LeftButton, PlatformEvent::MouseMoved, 1, false, false, false, false, 0); | 224 PlatformMouseEvent platformMouseEvent(IntPoint(10, 10), IntPoint(10, 10)
, LeftButton, PlatformEvent::MouseMoved, 1, false, false, false, false, 0); |
223 RefPtr<MouseEvent> mouseEvent = MouseEvent::create(WebCore::eventNames()
.mousemoveEvent, domWindow, platformMouseEvent, 0, document); | 225 RefPtr<MouseEvent> mouseEvent = MouseEvent::create(WebCore::eventNames()
.mousemoveEvent, domWindow, platformMouseEvent, 0, document); |
224 WebMouseEventBuilder webMouseBuilder(view, docRenderer, *mouseEvent); | 226 WebMouseEventBuilder webMouseBuilder(view, docRenderer, *mouseEvent); |
225 | 227 |
226 EXPECT_EQ(20, webMouseBuilder.x); | 228 EXPECT_EQ(10, webMouseBuilder.x); |
227 EXPECT_EQ(20, webMouseBuilder.y); | 229 EXPECT_EQ(10, webMouseBuilder.y); |
228 EXPECT_EQ(10, webMouseBuilder.globalX); | 230 EXPECT_EQ(10, webMouseBuilder.globalX); |
229 EXPECT_EQ(10, webMouseBuilder.globalY); | 231 EXPECT_EQ(10, webMouseBuilder.globalY); |
230 EXPECT_EQ(20, webMouseBuilder.windowX); | 232 EXPECT_EQ(10, webMouseBuilder.windowX); |
231 EXPECT_EQ(20, webMouseBuilder.windowY); | 233 EXPECT_EQ(10, webMouseBuilder.windowY); |
232 } | 234 } |
233 | 235 |
234 { | 236 { |
235 PlatformGestureEvent platformGestureEvent(PlatformEvent::GestureScrollUp
date, IntPoint(10, 10), IntPoint(10, 10), 0, IntSize(10, 10), FloatPoint(10, 10)
, false, false, false, false); | 237 PlatformGestureEvent platformGestureEvent(PlatformEvent::GestureScrollUp
date, IntPoint(10, 10), IntPoint(10, 10), 0, IntSize(10, 10), FloatPoint(10, 10)
, false, false, false, false); |
236 RefPtr<GestureEvent> gestureEvent = GestureEvent::create(domWindow, plat
formGestureEvent); | 238 RefPtr<GestureEvent> gestureEvent = GestureEvent::create(domWindow, plat
formGestureEvent); |
237 WebGestureEventBuilder webGestureBuilder(view, docRenderer, *gestureEven
t); | 239 WebGestureEventBuilder webGestureBuilder(view, docRenderer, *gestureEven
t); |
238 | 240 |
239 EXPECT_EQ(20, webGestureBuilder.x); | 241 EXPECT_EQ(10, webGestureBuilder.x); |
240 EXPECT_EQ(20, webGestureBuilder.y); | 242 EXPECT_EQ(10, webGestureBuilder.y); |
241 EXPECT_EQ(10, webGestureBuilder.globalX); | 243 EXPECT_EQ(10, webGestureBuilder.globalX); |
242 EXPECT_EQ(10, webGestureBuilder.globalY); | 244 EXPECT_EQ(10, webGestureBuilder.globalY); |
243 EXPECT_EQ(20, webGestureBuilder.data.scrollUpdate.deltaX); | 245 EXPECT_EQ(10, webGestureBuilder.data.scrollUpdate.deltaX); |
244 EXPECT_EQ(20, webGestureBuilder.data.scrollUpdate.deltaY); | 246 EXPECT_EQ(10, webGestureBuilder.data.scrollUpdate.deltaY); |
245 } | 247 } |
246 | 248 |
247 { | 249 { |
248 RefPtr<Touch> touch = Touch::create(webViewImpl->page()->mainFrame(), do
cument.get(), 0, 10, 10, 10, 10, 10, 10, 0, 0); | 250 RefPtr<Touch> touch = Touch::create(webViewImpl->page()->mainFrame(), do
cument.get(), 0, 10, 10, 10, 10, 10, 10, 0, 0); |
249 RefPtr<TouchList> touchList = TouchList::create(); | 251 RefPtr<TouchList> touchList = TouchList::create(); |
250 touchList->append(touch); | 252 touchList->append(touch); |
251 RefPtr<TouchEvent> touchEvent = TouchEvent::create(touchList.get(), touc
hList.get(), touchList.get(), WebCore::eventNames().touchmoveEvent, domWindow, 1
0, 10, 10, 10, false, false, false, false); | 253 RefPtr<TouchEvent> touchEvent = TouchEvent::create(touchList.get(), touc
hList.get(), touchList.get(), WebCore::eventNames().touchmoveEvent, domWindow, 1
0, 10, 10, 10, false, false, false, false); |
252 | 254 |
253 WebTouchEventBuilder webTouchBuilder(view, docRenderer, *touchEvent); | 255 WebTouchEventBuilder webTouchBuilder(view, docRenderer, *touchEvent); |
254 ASSERT_EQ(1u, webTouchBuilder.touchesLength); | 256 ASSERT_EQ(1u, webTouchBuilder.touchesLength); |
255 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.x); | 257 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.x); |
256 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.y); | 258 EXPECT_EQ(10, webTouchBuilder.touches[0].screenPosition.y); |
257 EXPECT_EQ(20, webTouchBuilder.touches[0].position.x); | 259 EXPECT_EQ(10, webTouchBuilder.touches[0].position.x); |
258 EXPECT_EQ(20, webTouchBuilder.touches[0].position.y); | 260 EXPECT_EQ(10, webTouchBuilder.touches[0].position.y); |
259 EXPECT_EQ(20, webTouchBuilder.touches[0].radiusX); | 261 EXPECT_EQ(10, webTouchBuilder.touches[0].radiusX); |
260 EXPECT_EQ(20, webTouchBuilder.touches[0].radiusY); | 262 EXPECT_EQ(10, webTouchBuilder.touches[0].radiusY); |
261 } | 263 } |
262 | 264 |
263 webViewImpl->close(); | 265 webViewImpl->close(); |
264 } | 266 } |
265 | 267 |
266 } // anonymous namespace | 268 } // anonymous namespace |
OLD | NEW |