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

Side by Side Diff: Source/web/WebInputEventConversion.cpp

Issue 1308313005: Modify gesture event types for WebView-tag scroll bubbling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix test expectation. Created 5 years, 3 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 | Annotate | Revision Log
OLDNEW
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
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_resendSource = e.resendSource;
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_resendSource = e.resendSource;
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_resendSource = e.resendSource;
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_resendSource = e.resendSource;
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
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 resendSource = event.resendSource();
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 else if (event.type() == EventTypeNames::gesturescrollend)
749 type = GestureScrollEnd; 756 type = GestureScrollEnd;
750 else if (event.type() == EventTypeNames::gesturescrollupdate) { 757 else if (event.type() == EventTypeNames::gesturescrollupdate) {
751 type = GestureScrollUpdate; 758 type = GestureScrollUpdate;
752 data.scrollUpdate.deltaX = event.deltaX(); 759 data.scrollUpdate.deltaX = event.deltaX();
753 data.scrollUpdate.deltaY = event.deltaY(); 760 data.scrollUpdate.deltaY = event.deltaY();
761 data.scrollUpdate.inertial = event.inertial();
762 } else if (event.type() == EventTypeNames::gestureflingstart) {
763 type = GestureFlingStart;
764 data.flingStart.velocityX = event.velocityX();
765 data.flingStart.velocityY = event.velocityY();
754 } else if (event.type() == EventTypeNames::gesturetap) { 766 } else if (event.type() == EventTypeNames::gesturetap) {
755 type = GestureTap; 767 type = GestureTap;
756 data.tap.tapCount = 1; 768 data.tap.tapCount = 1;
757 } 769 }
758 770
759 timeStampSeconds = event.timeStamp() / millisPerSecond; 771 timeStampSeconds = event.timeStamp() / millisPerSecond;
760 modifiers = getWebInputModifiers(event); 772 modifiers = getWebInputModifiers(event);
761 773
762 globalX = event.screenX(); 774 globalX = event.screenX();
763 globalY = event.screenY(); 775 globalY = event.screenY();
764 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL ocation(), *layoutObject); 776 IntPoint localPoint = convertAbsoluteLocationForLayoutObject(event.absoluteL ocation(), *layoutObject);
765 x = localPoint.x(); 777 x = localPoint.x();
766 y = localPoint.y(); 778 y = localPoint.y();
779 resendSource = event.resendSource();
767 } 780 }
768 781
769 } // namespace blink 782 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698