OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 #include "core/layout/api/LayoutItem.h" | 43 #include "core/layout/api/LayoutItem.h" |
44 #include "core/page/ChromeClient.h" | 44 #include "core/page/ChromeClient.h" |
45 #include "core/page/Page.h" | 45 #include "core/page/Page.h" |
46 #include "platform/KeyboardCodes.h" | 46 #include "platform/KeyboardCodes.h" |
47 #include "platform/Widget.h" | 47 #include "platform/Widget.h" |
48 #include "public/platform/Platform.h" | 48 #include "public/platform/Platform.h" |
49 | 49 |
50 namespace blink { | 50 namespace blink { |
51 | 51 |
52 namespace { | 52 namespace { |
53 float scaleDeltaToWindow(const Widget* widget, float delta) { | 53 float frameScale(const Widget* widget) { |
54 float scale = 1; | 54 float scale = 1.0f; |
majidvp
2016/12/15 17:40:46
nit: I believe .0f is not needed according to Blin
dtapuska
2016/12/15 21:29:39
Done.
| |
55 if (widget) { | 55 if (widget) { |
56 FrameView* rootView = toFrameView(widget->root()); | 56 FrameView* rootView = toFrameView(widget->root()); |
57 if (rootView) | 57 if (rootView) |
58 scale = rootView->inputEventsScaleFactor(); | 58 scale = rootView->inputEventsScaleFactor(); |
59 } | 59 } |
60 return delta / scale; | 60 return scale; |
61 } | |
62 | |
63 FloatPoint frameTranslation(const Widget* widget) { | |
64 float scale = 1; | |
65 FloatSize offset; | |
66 IntPoint visualViewport; | |
67 FloatSize overscrollOffset; | |
68 if (widget) { | |
69 FrameView* rootView = toFrameView(widget->root()); | |
70 if (rootView) { | |
71 scale = rootView->inputEventsScaleFactor(); | |
72 offset = FloatSize(rootView->inputEventsOffsetForEmulation()); | |
73 visualViewport = flooredIntPoint(rootView->page() | |
74 ->frameHost() | |
75 .visualViewport() | |
76 .visibleRect() | |
77 .location()); | |
78 overscrollOffset = | |
79 rootView->page()->frameHost().chromeClient().elasticOverscroll(); | |
80 } | |
81 } | |
82 return FloatPoint( | |
83 -offset.width() / scale + visualViewport.x() + overscrollOffset.width(), | |
84 -offset.height() / scale + visualViewport.y() + | |
85 overscrollOffset.height()); | |
86 } | |
87 | |
88 float scaleDeltaToWindow(const Widget* widget, float delta) { | |
89 return delta / frameScale(widget); | |
61 } | 90 } |
62 | 91 |
63 FloatSize scaleSizeToWindow(const Widget* widget, FloatSize size) { | 92 FloatSize scaleSizeToWindow(const Widget* widget, FloatSize size) { |
64 return FloatSize(scaleDeltaToWindow(widget, size.width()), | 93 return FloatSize(scaleDeltaToWindow(widget, size.width()), |
65 scaleDeltaToWindow(widget, size.height())); | 94 scaleDeltaToWindow(widget, size.height())); |
66 } | 95 } |
67 | 96 |
68 // This method converts from the renderer's coordinate space into Blink's root | 97 // This method converts from the renderer's coordinate space into Blink's root |
69 // frame coordinate space. It's somewhat unique in that it takes into account | 98 // frame coordinate space. It's somewhat unique in that it takes into account |
70 // DevTools emulation, which applies a scale and offset in the root layer (see | 99 // DevTools emulation, which applies a scale and offset in the root layer (see |
(...skipping 17 matching lines...) Expand all Loading... | |
88 .visualViewport() | 117 .visualViewport() |
89 .visibleRect() | 118 .visibleRect() |
90 .location()); | 119 .location()); |
91 overscrollOffset = | 120 overscrollOffset = |
92 rootView->page()->frameHost().chromeClient().elasticOverscroll(); | 121 rootView->page()->frameHost().chromeClient().elasticOverscroll(); |
93 } | 122 } |
94 } | 123 } |
95 return FloatPoint((pointInRendererViewport.x() - offset.width()) / scale + | 124 return FloatPoint((pointInRendererViewport.x() - offset.width()) / scale + |
96 visualViewport.x() + overscrollOffset.width(), | 125 visualViewport.x() + overscrollOffset.width(), |
97 (pointInRendererViewport.y() - offset.height()) / scale + | 126 (pointInRendererViewport.y() - offset.height()) / scale + |
98 visualViewport.y() + overscrollOffset.height()); | 127 visualViewport.y() + overscrollOffset.height()); |
majidvp
2016/12/15 17:40:46
I guess the reason that we cannot re-use |frameTra
| |
99 } | 128 } |
100 | 129 |
101 PlatformEvent::DispatchType toPlatformDispatchType( | 130 PlatformEvent::DispatchType toPlatformDispatchType( |
102 WebInputEvent::DispatchType type) { | 131 WebInputEvent::DispatchType type) { |
103 static_assert(PlatformEvent::DispatchType::Blocking == | 132 static_assert(PlatformEvent::DispatchType::Blocking == |
104 static_cast<PlatformEvent::DispatchType>( | 133 static_cast<PlatformEvent::DispatchType>( |
105 WebInputEvent::DispatchType::Blocking), | 134 WebInputEvent::DispatchType::Blocking), |
106 "Dispatch Types not equal"); | 135 "Dispatch Types not equal"); |
107 static_assert(PlatformEvent::DispatchType::EventNonBlocking == | 136 static_assert(PlatformEvent::DispatchType::EventNonBlocking == |
108 static_cast<PlatformEvent::DispatchType>( | 137 static_cast<PlatformEvent::DispatchType>( |
(...skipping 18 matching lines...) Expand all Loading... | |
127 if (button == WebMouseEvent::Button::NoButton) | 156 if (button == WebMouseEvent::Button::NoButton) |
128 return 0; | 157 return 0; |
129 | 158 |
130 unsigned webMouseButtonToPlatformModifier[] = { | 159 unsigned webMouseButtonToPlatformModifier[] = { |
131 PlatformEvent::LeftButtonDown, PlatformEvent::MiddleButtonDown, | 160 PlatformEvent::LeftButtonDown, PlatformEvent::MiddleButtonDown, |
132 PlatformEvent::RightButtonDown}; | 161 PlatformEvent::RightButtonDown}; |
133 | 162 |
134 return webMouseButtonToPlatformModifier[static_cast<int>(button)]; | 163 return webMouseButtonToPlatformModifier[static_cast<int>(button)]; |
135 } | 164 } |
136 | 165 |
137 ScrollGranularity toPlatformScrollGranularity( | |
138 WebGestureEvent::ScrollUnits units) { | |
139 switch (units) { | |
140 case WebGestureEvent::ScrollUnits::PrecisePixels: | |
141 return ScrollGranularity::ScrollByPrecisePixel; | |
142 case WebGestureEvent::ScrollUnits::Pixels: | |
143 return ScrollGranularity::ScrollByPixel; | |
144 case WebGestureEvent::ScrollUnits::Page: | |
145 return ScrollGranularity::ScrollByPage; | |
146 default: | |
147 NOTREACHED(); | |
148 return ScrollGranularity::ScrollByPrecisePixel; | |
149 } | |
150 } | |
151 | |
152 ScrollInertialPhase toPlatformScrollInertialPhase( | |
153 WebGestureEvent::InertialPhaseState state) { | |
154 static_assert( | |
155 ScrollInertialPhaseUnknown == static_cast<ScrollInertialPhase>( | |
156 WebGestureEvent::UnknownMomentumPhase), | |
157 "Inertial phases not equal"); | |
158 static_assert( | |
159 ScrollInertialPhaseNonMomentum == | |
160 static_cast<ScrollInertialPhase>(WebGestureEvent::NonMomentumPhase), | |
161 "Inertial phases not equal"); | |
162 static_assert( | |
163 ScrollInertialPhaseMomentum == | |
164 static_cast<ScrollInertialPhase>(WebGestureEvent::MomentumPhase), | |
165 "Inertial phases not equal"); | |
166 | |
167 return static_cast<ScrollInertialPhase>(state); | |
168 } | |
169 | |
170 WebGestureEvent::InertialPhaseState toWebGestureInertialPhaseState( | |
171 ScrollInertialPhase state) { | |
172 return static_cast<WebGestureEvent::InertialPhaseState>(state); | |
173 } | |
174 | |
175 WebGestureEvent::ScrollUnits toWebGestureScrollUnits( | |
176 ScrollGranularity granularity) { | |
177 switch (granularity) { | |
178 case ScrollGranularity::ScrollByPrecisePixel: | |
179 return WebGestureEvent::ScrollUnits::PrecisePixels; | |
180 case ScrollGranularity::ScrollByPixel: | |
181 return WebGestureEvent::ScrollUnits::Pixels; | |
182 case ScrollGranularity::ScrollByPage: | |
183 return WebGestureEvent::ScrollUnits::Page; | |
184 default: | |
185 NOTREACHED(); | |
186 return WebGestureEvent::ScrollUnits::PrecisePixels; | |
187 } | |
188 } | |
189 | |
190 } // namespace | 166 } // namespace |
191 | 167 |
192 // MakePlatformMouseEvent ----------------------------------------------------- | 168 // MakePlatformMouseEvent ----------------------------------------------------- |
193 | 169 |
194 // TODO(mustaq): Add tests for this. | 170 // TODO(mustaq): Add tests for this. |
195 PlatformMouseEventBuilder::PlatformMouseEventBuilder(Widget* widget, | 171 PlatformMouseEventBuilder::PlatformMouseEventBuilder(Widget* widget, |
196 const WebMouseEvent& e) { | 172 const WebMouseEvent& e) { |
197 // FIXME: Widget is always toplevel, unless it's a popup. We may be able | 173 // FIXME: Widget is always toplevel, unless it's a popup. We may be able |
198 // to get rid of this once we abstract popups into a WebKit API. | 174 // to get rid of this once we abstract popups into a WebKit API. |
199 m_position = widget->convertFromRootFrame( | 175 m_position = widget->convertFromRootFrame( |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
259 m_resendingPluginId = e.resendingPluginId; | 235 m_resendingPluginId = e.resendingPluginId; |
260 m_railsMode = static_cast<PlatformEvent::RailsMode>(e.railsMode); | 236 m_railsMode = static_cast<PlatformEvent::RailsMode>(e.railsMode); |
261 #if OS(MACOSX) | 237 #if OS(MACOSX) |
262 m_phase = static_cast<PlatformWheelEventPhase>(e.phase); | 238 m_phase = static_cast<PlatformWheelEventPhase>(e.phase); |
263 m_momentumPhase = static_cast<PlatformWheelEventPhase>(e.momentumPhase); | 239 m_momentumPhase = static_cast<PlatformWheelEventPhase>(e.momentumPhase); |
264 #endif | 240 #endif |
265 } | 241 } |
266 | 242 |
267 // PlatformGestureEventBuilder ----------------------------------------------- | 243 // PlatformGestureEventBuilder ----------------------------------------------- |
268 | 244 |
269 PlatformGestureEventBuilder::PlatformGestureEventBuilder( | 245 WebGestureEvent ScaleWebGestureEvent(Widget* widget, |
270 Widget* widget, | 246 const WebGestureEvent& event) { |
271 const WebGestureEvent& e) { | 247 WebGestureEvent result = event; |
272 switch (e.type) { | 248 result.frameScale = frameScale(widget); |
273 case WebInputEvent::GestureScrollBegin: | 249 FloatPoint translate = frameTranslation(widget); |
274 m_type = PlatformEvent::GestureScrollBegin; | 250 result.frameTranslate.x = translate.x(); |
275 m_data.m_scroll.m_resendingPluginId = e.resendingPluginId; | 251 result.frameTranslate.y = translate.y(); |
276 m_data.m_scroll.m_deltaX = e.data.scrollBegin.deltaXHint; | 252 return result; |
277 m_data.m_scroll.m_deltaY = e.data.scrollBegin.deltaYHint; | |
278 m_data.m_scroll.m_deltaUnits = | |
279 toPlatformScrollGranularity(e.data.scrollBegin.deltaHintUnits); | |
280 m_data.m_scroll.m_inertialPhase = | |
281 toPlatformScrollInertialPhase(e.data.scrollBegin.inertialPhase); | |
282 m_data.m_scroll.m_synthetic = e.data.scrollBegin.synthetic; | |
283 break; | |
284 case WebInputEvent::GestureScrollEnd: | |
285 m_type = PlatformEvent::GestureScrollEnd; | |
286 m_data.m_scroll.m_resendingPluginId = e.resendingPluginId; | |
287 m_data.m_scroll.m_deltaUnits = | |
288 toPlatformScrollGranularity(e.data.scrollEnd.deltaUnits); | |
289 m_data.m_scroll.m_inertialPhase = | |
290 toPlatformScrollInertialPhase(e.data.scrollEnd.inertialPhase); | |
291 m_data.m_scroll.m_synthetic = e.data.scrollEnd.synthetic; | |
292 break; | |
293 case WebInputEvent::GestureFlingStart: | |
294 m_type = PlatformEvent::GestureFlingStart; | |
295 m_data.m_scroll.m_velocityX = e.data.flingStart.velocityX; | |
296 m_data.m_scroll.m_velocityY = e.data.flingStart.velocityY; | |
297 break; | |
298 case WebInputEvent::GestureScrollUpdate: | |
299 m_type = PlatformEvent::GestureScrollUpdate; | |
300 m_data.m_scroll.m_resendingPluginId = e.resendingPluginId; | |
301 m_data.m_scroll.m_deltaX = | |
302 scaleDeltaToWindow(widget, e.data.scrollUpdate.deltaX); | |
303 m_data.m_scroll.m_deltaY = | |
304 scaleDeltaToWindow(widget, e.data.scrollUpdate.deltaY); | |
305 m_data.m_scroll.m_velocityX = e.data.scrollUpdate.velocityX; | |
306 m_data.m_scroll.m_velocityY = e.data.scrollUpdate.velocityY; | |
307 m_data.m_scroll.m_preventPropagation = | |
308 e.data.scrollUpdate.preventPropagation; | |
309 m_data.m_scroll.m_inertialPhase = | |
310 toPlatformScrollInertialPhase(e.data.scrollUpdate.inertialPhase); | |
311 m_data.m_scroll.m_deltaUnits = | |
312 toPlatformScrollGranularity(e.data.scrollUpdate.deltaUnits); | |
313 break; | |
314 case WebInputEvent::GestureTap: | |
315 m_type = PlatformEvent::GestureTap; | |
316 m_area = expandedIntSize(scaleSizeToWindow( | |
317 widget, FloatSize(e.data.tap.width, e.data.tap.height))); | |
318 m_data.m_tap.m_tapCount = e.data.tap.tapCount; | |
319 break; | |
320 case WebInputEvent::GestureTapUnconfirmed: | |
321 m_type = PlatformEvent::GestureTapUnconfirmed; | |
322 m_area = expandedIntSize(scaleSizeToWindow( | |
323 widget, FloatSize(e.data.tap.width, e.data.tap.height))); | |
324 break; | |
325 case WebInputEvent::GestureTapDown: | |
326 m_type = PlatformEvent::GestureTapDown; | |
327 m_area = expandedIntSize(scaleSizeToWindow( | |
328 widget, FloatSize(e.data.tapDown.width, e.data.tapDown.height))); | |
329 break; | |
330 case WebInputEvent::GestureShowPress: | |
331 m_type = PlatformEvent::GestureShowPress; | |
332 m_area = expandedIntSize(scaleSizeToWindow( | |
333 widget, FloatSize(e.data.showPress.width, e.data.showPress.height))); | |
334 break; | |
335 case WebInputEvent::GestureTapCancel: | |
336 m_type = PlatformEvent::GestureTapDownCancel; | |
337 break; | |
338 case WebInputEvent::GestureDoubleTap: | |
339 // DoubleTap gesture is now handled as PlatformEvent::GestureTap with | |
340 // tap_count = 2. So no need to convert to a Platfrom DoubleTap gesture. | |
341 // But in WebViewImpl::handleGestureEvent all WebGestureEvent are | |
342 // converted to PlatformGestureEvent, for completeness and not reach the | |
343 // NOTREACHED() at the end, convert the DoubleTap to a NoType. | |
344 m_type = PlatformEvent::NoType; | |
345 break; | |
346 case WebInputEvent::GestureTwoFingerTap: | |
347 m_type = PlatformEvent::GestureTwoFingerTap; | |
348 m_area = expandedIntSize(scaleSizeToWindow( | |
349 widget, FloatSize(e.data.twoFingerTap.firstFingerWidth, | |
350 e.data.twoFingerTap.firstFingerHeight))); | |
351 break; | |
352 case WebInputEvent::GestureLongPress: | |
353 m_type = PlatformEvent::GestureLongPress; | |
354 m_area = expandedIntSize(scaleSizeToWindow( | |
355 widget, FloatSize(e.data.longPress.width, e.data.longPress.height))); | |
356 break; | |
357 case WebInputEvent::GestureLongTap: | |
358 m_type = PlatformEvent::GestureLongTap; | |
359 m_area = expandedIntSize(scaleSizeToWindow( | |
360 widget, FloatSize(e.data.longPress.width, e.data.longPress.height))); | |
361 break; | |
362 case WebInputEvent::GesturePinchBegin: | |
363 m_type = PlatformEvent::GesturePinchBegin; | |
364 break; | |
365 case WebInputEvent::GesturePinchEnd: | |
366 m_type = PlatformEvent::GesturePinchEnd; | |
367 break; | |
368 case WebInputEvent::GesturePinchUpdate: | |
369 m_type = PlatformEvent::GesturePinchUpdate; | |
370 m_data.m_pinchUpdate.m_scale = e.data.pinchUpdate.scale; | |
371 break; | |
372 default: | |
373 NOTREACHED(); | |
374 } | |
375 m_position = widget->convertFromRootFrame(flooredIntPoint( | |
376 convertHitPointToRootFrame(widget, FloatPoint(e.x, e.y)))); | |
377 m_globalPosition = IntPoint(e.globalX, e.globalY); | |
378 m_timestamp = TimeTicks::FromSeconds(e.timeStampSeconds); | |
379 m_modifiers = e.modifiers; | |
380 switch (e.sourceDevice) { | |
381 case WebGestureDeviceTouchpad: | |
382 m_source = PlatformGestureSourceTouchpad; | |
383 break; | |
384 case WebGestureDeviceTouchscreen: | |
385 m_source = PlatformGestureSourceTouchscreen; | |
386 break; | |
387 case WebGestureDeviceUninitialized: | |
388 NOTREACHED(); | |
389 } | |
390 | |
391 m_uniqueTouchEventId = e.uniqueTouchEventId; | |
392 } | 253 } |
393 | 254 |
394 inline PlatformEvent::EventType toPlatformTouchEventType( | 255 inline PlatformEvent::EventType toPlatformTouchEventType( |
395 const WebInputEvent::Type type) { | 256 const WebInputEvent::Type type) { |
396 switch (type) { | 257 switch (type) { |
397 case WebInputEvent::TouchStart: | 258 case WebInputEvent::TouchStart: |
398 return PlatformEvent::TouchStart; | 259 return PlatformEvent::TouchStart; |
399 case WebInputEvent::TouchMove: | 260 case WebInputEvent::TouchMove: |
400 return PlatformEvent::TouchMove; | 261 return PlatformEvent::TouchMove; |
401 case WebInputEvent::TouchEnd: | 262 case WebInputEvent::TouchEnd: |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
762 WebTouchPoint::StateStationary, event.pointerType()); | 623 WebTouchPoint::StateStationary, event.pointerType()); |
763 ++touchesLength; | 624 ++touchesLength; |
764 } | 625 } |
765 // If any existing points are also in the change list, we should update | 626 // If any existing points are also in the change list, we should update |
766 // their state, otherwise just add the new points. | 627 // their state, otherwise just add the new points. |
767 addTouchPointsUpdateStateIfNecessary( | 628 addTouchPointsUpdateStateIfNecessary( |
768 toWebTouchPointState(event.type()), event.changedTouches(), touches, | 629 toWebTouchPointState(event.type()), event.changedTouches(), touches, |
769 &touchesLength, layoutItem, event.pointerType()); | 630 &touchesLength, layoutItem, event.pointerType()); |
770 } | 631 } |
771 | 632 |
772 WebGestureEventBuilder::WebGestureEventBuilder(const LayoutItem layoutItem, | |
773 const GestureEvent& event) { | |
774 if (event.type() == EventTypeNames::gestureshowpress) { | |
775 type = GestureShowPress; | |
776 } else if (event.type() == EventTypeNames::gesturelongpress) { | |
777 type = GestureLongPress; | |
778 } else if (event.type() == EventTypeNames::gesturetapdown) { | |
779 type = GestureTapDown; | |
780 } else if (event.type() == EventTypeNames::gesturescrollstart) { | |
781 type = GestureScrollBegin; | |
782 resendingPluginId = event.resendingPluginId(); | |
783 data.scrollBegin.deltaXHint = event.deltaX(); | |
784 data.scrollBegin.deltaYHint = event.deltaY(); | |
785 data.scrollBegin.deltaHintUnits = | |
786 toWebGestureScrollUnits(event.deltaUnits()); | |
787 data.scrollBegin.inertialPhase = | |
788 toWebGestureInertialPhaseState(event.inertialPhase()); | |
789 data.scrollBegin.synthetic = event.synthetic(); | |
790 } else if (event.type() == EventTypeNames::gesturescrollend) { | |
791 type = GestureScrollEnd; | |
792 resendingPluginId = event.resendingPluginId(); | |
793 data.scrollEnd.deltaUnits = toWebGestureScrollUnits(event.deltaUnits()); | |
794 data.scrollEnd.inertialPhase = | |
795 toWebGestureInertialPhaseState(event.inertialPhase()); | |
796 data.scrollEnd.synthetic = event.synthetic(); | |
797 } else if (event.type() == EventTypeNames::gesturescrollupdate) { | |
798 type = GestureScrollUpdate; | |
799 data.scrollUpdate.deltaUnits = toWebGestureScrollUnits(event.deltaUnits()); | |
800 data.scrollUpdate.deltaX = event.deltaX(); | |
801 data.scrollUpdate.deltaY = event.deltaY(); | |
802 data.scrollUpdate.inertialPhase = | |
803 toWebGestureInertialPhaseState(event.inertialPhase()); | |
804 resendingPluginId = event.resendingPluginId(); | |
805 } else if (event.type() == EventTypeNames::gestureflingstart) { | |
806 type = GestureFlingStart; | |
807 data.flingStart.velocityX = event.velocityX(); | |
808 data.flingStart.velocityY = event.velocityY(); | |
809 } else if (event.type() == EventTypeNames::gesturetap) { | |
810 type = GestureTap; | |
811 data.tap.tapCount = 1; | |
812 } | |
813 | |
814 timeStampSeconds = event.platformTimeStamp().InSeconds(); | |
815 modifiers = event.modifiers(); | |
816 | |
817 globalX = event.screenX(); | |
818 globalY = event.screenY(); | |
819 IntPoint localPoint = convertAbsoluteLocationForLayoutObjectInt( | |
820 event.absoluteLocation(), layoutItem); | |
821 x = localPoint.x(); | |
822 y = localPoint.y(); | |
823 | |
824 switch (event.source()) { | |
825 case GestureSourceTouchpad: | |
826 sourceDevice = WebGestureDeviceTouchpad; | |
827 break; | |
828 case GestureSourceTouchscreen: | |
829 sourceDevice = WebGestureDeviceTouchscreen; | |
830 break; | |
831 case GestureSourceUninitialized: | |
832 NOTREACHED(); | |
833 } | |
834 } | |
835 | |
836 Vector<PlatformMouseEvent> createPlatformMouseEventVector( | 633 Vector<PlatformMouseEvent> createPlatformMouseEventVector( |
837 Widget* widget, | 634 Widget* widget, |
838 const std::vector<const WebInputEvent*>& coalescedEvents) { | 635 const std::vector<const WebInputEvent*>& coalescedEvents) { |
839 Vector<PlatformMouseEvent> result; | 636 Vector<PlatformMouseEvent> result; |
840 for (const auto& event : coalescedEvents) { | 637 for (const auto& event : coalescedEvents) { |
841 DCHECK(WebInputEvent::isMouseEventType(event->type)); | 638 DCHECK(WebInputEvent::isMouseEventType(event->type)); |
842 result.append(PlatformMouseEventBuilder( | 639 result.append(PlatformMouseEventBuilder( |
843 widget, static_cast<const WebMouseEvent&>(*event))); | 640 widget, static_cast<const WebMouseEvent&>(*event))); |
844 } | 641 } |
845 return result; | 642 return result; |
846 } | 643 } |
847 | 644 |
848 Vector<PlatformTouchEvent> createPlatformTouchEventVector( | 645 Vector<PlatformTouchEvent> createPlatformTouchEventVector( |
849 Widget* widget, | 646 Widget* widget, |
850 const std::vector<const WebInputEvent*>& coalescedEvents) { | 647 const std::vector<const WebInputEvent*>& coalescedEvents) { |
851 Vector<PlatformTouchEvent> result; | 648 Vector<PlatformTouchEvent> result; |
852 for (const auto& event : coalescedEvents) { | 649 for (const auto& event : coalescedEvents) { |
853 DCHECK(WebInputEvent::isTouchEventType(event->type)); | 650 DCHECK(WebInputEvent::isTouchEventType(event->type)); |
854 result.append(PlatformTouchEventBuilder( | 651 result.append(PlatformTouchEventBuilder( |
855 widget, static_cast<const WebTouchEvent&>(*event))); | 652 widget, static_cast<const WebTouchEvent&>(*event))); |
856 } | 653 } |
857 return result; | 654 return result; |
858 } | 655 } |
859 | 656 |
860 } // namespace blink | 657 } // namespace blink |
OLD | NEW |