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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 m_wheelTicksY = e.wheelTicksY; | 190 m_wheelTicksY = e.wheelTicksY; |
191 m_granularity = e.scrollByPage ? | 191 m_granularity = e.scrollByPage ? |
192 ScrollByPageWheelEvent : ScrollByPixelWheelEvent; | 192 ScrollByPageWheelEvent : ScrollByPixelWheelEvent; |
193 | 193 |
194 m_type = PlatformEvent::Wheel; | 194 m_type = PlatformEvent::Wheel; |
195 | 195 |
196 m_modifiers = toPlatformMouseEventModifiers(e.modifiers); | 196 m_modifiers = toPlatformMouseEventModifiers(e.modifiers); |
197 | 197 |
198 m_hasPreciseScrollingDeltas = e.hasPreciseScrollingDeltas; | 198 m_hasPreciseScrollingDeltas = e.hasPreciseScrollingDeltas; |
199 m_canScroll = e.canScroll; | 199 m_canScroll = e.canScroll; |
| 200 m_resendingPluginId = e.resendingPluginId; |
200 m_railsMode = static_cast<PlatformEvent::RailsMode>(e.railsMode); | 201 m_railsMode = static_cast<PlatformEvent::RailsMode>(e.railsMode); |
201 #if OS(MACOSX) | 202 #if OS(MACOSX) |
202 m_phase = static_cast<PlatformWheelEventPhase>(e.phase); | 203 m_phase = static_cast<PlatformWheelEventPhase>(e.phase); |
203 m_momentumPhase = static_cast<PlatformWheelEventPhase>(e.momentumPhase); | 204 m_momentumPhase = static_cast<PlatformWheelEventPhase>(e.momentumPhase); |
204 m_timestamp = e.timeStampSeconds; | 205 m_timestamp = e.timeStampSeconds; |
205 m_canRubberbandLeft = e.canRubberbandLeft; | 206 m_canRubberbandLeft = e.canRubberbandLeft; |
206 m_canRubberbandRight = e.canRubberbandRight; | 207 m_canRubberbandRight = e.canRubberbandRight; |
207 #endif | 208 #endif |
208 } | 209 } |
209 | 210 |
210 // PlatformGestureEventBuilder -------------------------------------------------
- | 211 // PlatformGestureEventBuilder -------------------------------------------------
- |
211 | 212 |
212 PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W
ebGestureEvent& e) | 213 PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W
ebGestureEvent& e) |
213 { | 214 { |
214 switch (e.type) { | 215 switch (e.type) { |
215 case WebInputEvent::GestureScrollBegin: | 216 case WebInputEvent::GestureScrollBegin: |
216 m_type = PlatformEvent::GestureScrollBegin; | 217 m_type = PlatformEvent::GestureScrollBegin; |
| 218 m_data.m_scroll.m_resendingPluginId = e.resendingPluginId; |
217 break; | 219 break; |
218 case WebInputEvent::GestureScrollEnd: | 220 case WebInputEvent::GestureScrollEnd: |
219 m_type = PlatformEvent::GestureScrollEnd; | 221 m_type = PlatformEvent::GestureScrollEnd; |
| 222 m_data.m_scroll.m_resendingPluginId = e.resendingPluginId; |
220 break; | 223 break; |
221 case WebInputEvent::GestureFlingStart: | 224 case WebInputEvent::GestureFlingStart: |
222 m_type = PlatformEvent::GestureFlingStart; | 225 m_type = PlatformEvent::GestureFlingStart; |
| 226 m_data.m_scroll.m_velocityX = e.data.flingStart.velocityX; |
| 227 m_data.m_scroll.m_velocityY = e.data.flingStart.velocityY; |
223 break; | 228 break; |
224 case WebInputEvent::GestureScrollUpdate: | 229 case WebInputEvent::GestureScrollUpdate: |
225 m_type = PlatformEvent::GestureScrollUpdate; | 230 m_type = PlatformEvent::GestureScrollUpdate; |
| 231 m_data.m_scroll.m_resendingPluginId = e.resendingPluginId; |
226 m_data.m_scroll.m_deltaX = scaleDeltaToWindow(widget, e.data.scrollUpdat
e.deltaX); | 232 m_data.m_scroll.m_deltaX = scaleDeltaToWindow(widget, e.data.scrollUpdat
e.deltaX); |
227 m_data.m_scroll.m_deltaY = scaleDeltaToWindow(widget, e.data.scrollUpdat
e.deltaY); | 233 m_data.m_scroll.m_deltaY = scaleDeltaToWindow(widget, e.data.scrollUpdat
e.deltaY); |
228 m_data.m_scroll.m_velocityX = e.data.scrollUpdate.velocityX; | 234 m_data.m_scroll.m_velocityX = e.data.scrollUpdate.velocityX; |
229 m_data.m_scroll.m_velocityY = e.data.scrollUpdate.velocityY; | 235 m_data.m_scroll.m_velocityY = e.data.scrollUpdate.velocityY; |
230 m_data.m_scroll.m_preventPropagation = e.data.scrollUpdate.preventPropag
ation; | 236 m_data.m_scroll.m_preventPropagation = e.data.scrollUpdate.preventPropag
ation; |
231 m_data.m_scroll.m_inertial = e.data.scrollUpdate.inertial; | 237 m_data.m_scroll.m_inertial = e.data.scrollUpdate.inertial; |
232 break; | 238 break; |
233 case WebInputEvent::GestureTap: | 239 case WebInputEvent::GestureTap: |
234 m_type = PlatformEvent::GestureTap; | 240 m_type = PlatformEvent::GestureTap; |
235 m_area = expandedIntSize(scaleSizeToWindow(widget, FloatSize(e.data.tap.
width, e.data.tap.height))); | 241 m_area = expandedIntSize(scaleSizeToWindow(widget, FloatSize(e.data.tap.
width, e.data.tap.height))); |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 if (event.type() != EventTypeNames::wheel && event.type() != EventTypeNames:
:mousewheel) | 605 if (event.type() != EventTypeNames::wheel && event.type() != EventTypeNames:
:mousewheel) |
600 return; | 606 return; |
601 type = WebInputEvent::MouseWheel; | 607 type = WebInputEvent::MouseWheel; |
602 updateWebMouseEventFromCoreMouseEvent(event, widget, *layoutObject, *this); | 608 updateWebMouseEventFromCoreMouseEvent(event, widget, *layoutObject, *this); |
603 deltaX = -event.deltaX(); | 609 deltaX = -event.deltaX(); |
604 deltaY = -event.deltaY(); | 610 deltaY = -event.deltaY(); |
605 wheelTicksX = event.ticksX(); | 611 wheelTicksX = event.ticksX(); |
606 wheelTicksY = event.ticksY(); | 612 wheelTicksY = event.ticksY(); |
607 scrollByPage = event.deltaMode() == WheelEvent::DOM_DELTA_PAGE; | 613 scrollByPage = event.deltaMode() == WheelEvent::DOM_DELTA_PAGE; |
608 canScroll = event.canScroll(); | 614 canScroll = event.canScroll(); |
| 615 resendingPluginId = event.resendingPluginId(); |
609 railsMode = static_cast<RailsMode>(event.railsMode()); | 616 railsMode = static_cast<RailsMode>(event.railsMode()); |
610 } | 617 } |
611 | 618 |
612 WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) | 619 WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) |
613 { | 620 { |
614 if (event.type() == EventTypeNames::keydown) | 621 if (event.type() == EventTypeNames::keydown) |
615 type = KeyDown; | 622 type = KeyDown; |
616 else if (event.type() == EventTypeNames::keyup) | 623 else if (event.type() == EventTypeNames::keyup) |
617 type = WebInputEvent::KeyUp; | 624 type = WebInputEvent::KeyUp; |
618 else if (event.type() == EventTypeNames::keypress) | 625 else if (event.type() == EventTypeNames::keypress) |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 touches[i] = toWebTouchPoint(event.touches()->item(i), layoutObject, Web
TouchPoint::StateStationary); | 737 touches[i] = toWebTouchPoint(event.touches()->item(i), layoutObject, Web
TouchPoint::StateStationary); |
731 ++touchesLength; | 738 ++touchesLength; |
732 } | 739 } |
733 // If any existing points are also in the change list, we should update | 740 // If any existing points are also in the change list, we should update |
734 // their state, otherwise just add the new points. | 741 // their state, otherwise just add the new points. |
735 addTouchPointsUpdateStateIfNecessary(toWebTouchPointState(event.type()), eve
nt.changedTouches(), touches, &touchesLength, layoutObject); | 742 addTouchPointsUpdateStateIfNecessary(toWebTouchPointState(event.type()), eve
nt.changedTouches(), touches, &touchesLength, layoutObject); |
736 } | 743 } |
737 | 744 |
738 WebGestureEventBuilder::WebGestureEventBuilder(const LayoutObject* layoutObject,
const GestureEvent& event) | 745 WebGestureEventBuilder::WebGestureEventBuilder(const LayoutObject* layoutObject,
const GestureEvent& event) |
739 { | 746 { |
740 if (event.type() == EventTypeNames::gestureshowpress) | 747 if (event.type() == EventTypeNames::gestureshowpress) { |
741 type = GestureShowPress; | 748 type = GestureShowPress; |
742 else if (event.type() == EventTypeNames::gesturelongpress) | 749 } else if (event.type() == EventTypeNames::gesturelongpress) { |
743 type = GestureLongPress; | 750 type = GestureLongPress; |
744 else if (event.type() == EventTypeNames::gesturetapdown) | 751 } else if (event.type() == EventTypeNames::gesturetapdown) { |
745 type = GestureTapDown; | 752 type = GestureTapDown; |
746 else if (event.type() == EventTypeNames::gesturescrollstart) | 753 } else if (event.type() == EventTypeNames::gesturescrollstart) { |
747 type = GestureScrollBegin; | 754 type = GestureScrollBegin; |
748 else if (event.type() == EventTypeNames::gesturescrollend) | 755 resendingPluginId = event.resendingPluginId(); |
| 756 } else if (event.type() == EventTypeNames::gesturescrollend) { |
749 type = GestureScrollEnd; | 757 type = GestureScrollEnd; |
750 else if (event.type() == EventTypeNames::gesturescrollupdate) { | 758 resendingPluginId = event.resendingPluginId(); |
| 759 } else if (event.type() == EventTypeNames::gesturescrollupdate) { |
751 type = GestureScrollUpdate; | 760 type = GestureScrollUpdate; |
752 data.scrollUpdate.deltaX = event.deltaX(); | 761 data.scrollUpdate.deltaX = event.deltaX(); |
753 data.scrollUpdate.deltaY = event.deltaY(); | 762 data.scrollUpdate.deltaY = event.deltaY(); |
| 763 data.scrollUpdate.inertial = event.inertial(); |
| 764 resendingPluginId = event.resendingPluginId(); |
| 765 } else if (event.type() == EventTypeNames::gestureflingstart) { |
| 766 type = GestureFlingStart; |
| 767 data.flingStart.velocityX = event.velocityX(); |
| 768 data.flingStart.velocityY = event.velocityY(); |
754 } else if (event.type() == EventTypeNames::gesturetap) { | 769 } else if (event.type() == EventTypeNames::gesturetap) { |
755 type = GestureTap; | 770 type = GestureTap; |
756 data.tap.tapCount = 1; | 771 data.tap.tapCount = 1; |
757 } | 772 } |
758 | 773 |
759 timeStampSeconds = event.timeStamp() / millisPerSecond; | 774 timeStampSeconds = event.timeStamp() / millisPerSecond; |
760 modifiers = getWebInputModifiers(event); | 775 modifiers = getWebInputModifiers(event); |
761 | 776 |
762 globalX = event.screenX(); | 777 globalX = event.screenX(); |
763 globalY = event.screenY(); | 778 globalY = event.screenY(); |
764 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL
ocation(), *layoutObject); | 779 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL
ocation(), *layoutObject); |
765 x = localPoint.x(); | 780 x = localPoint.x(); |
766 y = localPoint.y(); | 781 y = localPoint.y(); |
767 } | 782 } |
768 | 783 |
769 } // namespace blink | 784 } // namespace blink |
OLD | NEW |