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

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

Issue 2586133003: Remove PlatformWheelEvent and use WebMouseWheelEvent instead (Closed)
Patch Set: Adjust function name Created 3 years, 11 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 /* 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // between platforms here, we explicitly clear the button that is 203 // between platforms here, we explicitly clear the button that is
204 // in the process of being released. 204 // in the process of being released.
205 m_modifiers &= ~toPlatformModifierFrom(e.button); 205 m_modifiers &= ~toPlatformModifierFrom(e.button);
206 break; 206 break;
207 207
208 default: 208 default:
209 NOTREACHED(); 209 NOTREACHED();
210 } 210 }
211 } 211 }
212 212
213 // PlatformWheelEventBuilder -------------------------------------------------- 213 WebMouseWheelEvent TransformWebMouseWheelEvent(
214
215 PlatformWheelEventBuilder::PlatformWheelEventBuilder(
216 Widget* widget, 214 Widget* widget,
217 const WebMouseWheelEvent& e) { 215 const WebMouseWheelEvent& event) {
218 m_position = widget->convertFromRootFrame(flooredIntPoint( 216 WebMouseWheelEvent result = event;
219 convertHitPointToRootFrame(widget, FloatPoint(e.x, e.y)))); 217 result.setFrameScale(frameScale(widget));
220 m_globalPosition = IntPoint(e.globalX, e.globalY); 218 result.setFrameTranslate(frameTranslation(widget));
221 m_deltaX = scaleDeltaToWindow(widget, e.deltaX); 219 return result;
222 m_deltaY = scaleDeltaToWindow(widget, e.deltaY);
223 m_wheelTicksX = e.wheelTicksX;
224 m_wheelTicksY = e.wheelTicksY;
225 m_granularity =
226 e.scrollByPage ? ScrollByPageWheelEvent : ScrollByPixelWheelEvent;
227
228 m_type = PlatformEvent::Wheel;
229
230 m_timestamp = TimeTicks::FromSeconds(e.timeStampSeconds);
231 m_modifiers = e.modifiers;
232 m_dispatchType = toPlatformDispatchType(e.dispatchType);
233
234 m_hasPreciseScrollingDeltas = e.hasPreciseScrollingDeltas;
235 m_resendingPluginId = e.resendingPluginId;
236 m_railsMode = static_cast<PlatformEvent::RailsMode>(e.railsMode);
237 #if OS(MACOSX)
238 m_phase = static_cast<PlatformWheelEventPhase>(e.phase);
239 m_momentumPhase = static_cast<PlatformWheelEventPhase>(e.momentumPhase);
240 #endif
241 } 220 }
242 221
243 // PlatformGestureEventBuilder -----------------------------------------------
244
245 WebGestureEvent TransformWebGestureEvent(Widget* widget, 222 WebGestureEvent TransformWebGestureEvent(Widget* widget,
246 const WebGestureEvent& event) { 223 const WebGestureEvent& event) {
247 WebGestureEvent result = event; 224 WebGestureEvent result = event;
248 result.setFrameScale(frameScale(widget)); 225 result.setFrameScale(frameScale(widget));
249 result.setFrameTranslate(frameTranslation(widget)); 226 result.setFrameTranslate(frameTranslation(widget));
250 return result; 227 return result;
251 } 228 }
252 229
253 inline PlatformEvent::EventType toPlatformTouchEventType( 230 inline PlatformEvent::EventType toPlatformTouchEventType(
254 const WebInputEvent::Type type) { 231 const WebInputEvent::Type type) {
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 clickCount = (type == MouseDown || type == MouseUp); 454 clickCount = (type == MouseDown || type == MouseUp);
478 455
479 IntPoint localPoint = convertAbsoluteLocationForLayoutObjectInt( 456 IntPoint localPoint = convertAbsoluteLocationForLayoutObjectInt(
480 DoublePoint(touch->absoluteLocation()), layoutItem); 457 DoublePoint(touch->absoluteLocation()), layoutItem);
481 x = localPoint.x(); 458 x = localPoint.x();
482 y = localPoint.y(); 459 y = localPoint.y();
483 460
484 pointerType = WebPointerProperties::PointerType::Touch; 461 pointerType = WebPointerProperties::PointerType::Touch;
485 } 462 }
486 463
487 WebMouseWheelEventBuilder::WebMouseWheelEventBuilder(
488 const Widget* widget,
489 const LayoutItem layoutItem,
490 const WheelEvent& event) {
491 if (event.type() != EventTypeNames::wheel &&
492 event.type() != EventTypeNames::mousewheel)
493 return;
494 type = WebInputEvent::MouseWheel;
495 updateWebMouseEventFromCoreMouseEvent(event, widget, layoutItem, *this);
496 deltaX = -event.deltaX();
497 deltaY = -event.deltaY();
498 wheelTicksX = event.ticksX();
499 wheelTicksY = event.ticksY();
500 scrollByPage = event.deltaMode() == WheelEvent::kDomDeltaPage;
501 resendingPluginId = event.resendingPluginId();
502 railsMode = static_cast<RailsMode>(event.getRailsMode());
503 hasPreciseScrollingDeltas = event.hasPreciseScrollingDeltas();
504 dispatchType = event.cancelable() ? WebInputEvent::Blocking
505 : WebInputEvent::EventNonBlocking;
506 #if OS(MACOSX)
507 phase = static_cast<Phase>(event.phase());
508 momentumPhase = static_cast<Phase>(event.momentumPhase());
509 #endif
510 }
511
512 WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) { 464 WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) {
513 if (const WebKeyboardEvent* webEvent = event.keyEvent()) { 465 if (const WebKeyboardEvent* webEvent = event.keyEvent()) {
514 *static_cast<WebKeyboardEvent*>(this) = *webEvent; 466 *static_cast<WebKeyboardEvent*>(this) = *webEvent;
515 467
516 // TODO(dtapuska): DOM KeyboardEvents converted back to WebInputEvents 468 // TODO(dtapuska): DOM KeyboardEvents converted back to WebInputEvents
517 // drop the Raw behaviour. Figure out if this is actually really needed. 469 // drop the Raw behaviour. Figure out if this is actually really needed.
518 if (type == RawKeyDown) 470 if (type == RawKeyDown)
519 type = KeyDown; 471 type = KeyDown;
520 return; 472 return;
521 } 473 }
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 Vector<PlatformTouchEvent> result; 597 Vector<PlatformTouchEvent> result;
646 for (const auto& event : coalescedEvents) { 598 for (const auto& event : coalescedEvents) {
647 DCHECK(WebInputEvent::isTouchEventType(event->type)); 599 DCHECK(WebInputEvent::isTouchEventType(event->type));
648 result.append(PlatformTouchEventBuilder( 600 result.append(PlatformTouchEventBuilder(
649 widget, static_cast<const WebTouchEvent&>(*event))); 601 widget, static_cast<const WebTouchEvent&>(*event)));
650 } 602 }
651 return result; 603 return result;
652 } 604 }
653 605
654 } // namespace blink 606 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/WebInputEventConversion.h ('k') | third_party/WebKit/Source/web/WebPluginContainerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698