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

Unified Diff: third_party/WebKit/Source/core/events/WheelEvent.cpp

Issue 2586133003: Remove PlatformWheelEvent and use WebMouseWheelEvent instead (Closed)
Patch Set: Address comments Created 3 years, 12 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/events/WheelEvent.cpp
diff --git a/third_party/WebKit/Source/core/events/WheelEvent.cpp b/third_party/WebKit/Source/core/events/WheelEvent.cpp
index 40ee82efa910f306292d79421d8aee762fb91376..dd00d2b856f90b9ad7cf3065d423b070397fc76c 100644
--- a/third_party/WebKit/Source/core/events/WheelEvent.cpp
+++ b/third_party/WebKit/Source/core/events/WheelEvent.cpp
@@ -25,49 +25,32 @@
#include "core/clipboard/DataTransfer.h"
#include "platform/PlatformMouseEvent.h"
-#include "platform/PlatformWheelEvent.h"
namespace blink {
-inline static unsigned convertDeltaMode(const PlatformWheelEvent& event) {
- return event.granularity() == ScrollByPageWheelEvent
- ? WheelEvent::kDomDeltaPage
- : WheelEvent::kDomDeltaPixel;
+namespace {
+
+unsigned convertDeltaMode(const WebMouseWheelEvent& event) {
+ return event.scrollByPage ? WheelEvent::kDomDeltaPage
+ : WheelEvent::kDomDeltaPixel;
}
// Negate a long value without integer overflow.
-inline static long negateIfPossible(long value) {
+long negateIfPossible(long value) {
if (value == LONG_MIN)
return value;
return -value;
}
-WheelEvent* WheelEvent::create(const PlatformWheelEvent& event,
+} // namespace
+
+WheelEvent* WheelEvent::create(const WebMouseWheelEvent& event,
AbstractView* view) {
- return new WheelEvent(
- FloatPoint(event.wheelTicksX(), event.wheelTicksY()),
- FloatPoint(event.deltaX(), event.deltaY()), convertDeltaMode(event), view,
- event.globalPosition(), event.position(), event.getModifiers(),
- MouseEvent::platformModifiersToButtons(event.getModifiers()),
- event.timestamp(), event.resendingPluginId(),
- event.hasPreciseScrollingDeltas(),
- static_cast<Event::RailsMode>(event.getRailsMode()), event.cancelable()
-#if OS(MACOSX)
- ,
- static_cast<WheelEventPhase>(event.phase()),
- static_cast<WheelEventPhase>(event.momentumPhase())
-#endif
- );
+ return new WheelEvent(event, view);
}
WheelEvent::WheelEvent()
- : m_deltaX(0),
- m_deltaY(0),
- m_deltaZ(0),
- m_deltaMode(kDomDeltaPixel),
- m_resendingPluginId(-1),
- m_hasPreciseScrollingDeltas(false),
- m_railsMode(RailsModeFree) {}
+ : m_deltaX(0), m_deltaY(0), m_deltaZ(0), m_deltaMode(kDomDeltaPixel) {}
WheelEvent::WheelEvent(const AtomicString& type,
const WheelEventInit& initializer)
@@ -83,120 +66,26 @@ WheelEvent::WheelEvent(const AtomicString& type,
? initializer.deltaY()
: negateIfPossible(initializer.wheelDeltaY())),
m_deltaZ(initializer.deltaZ()),
- m_deltaMode(initializer.deltaMode()),
- m_resendingPluginId(-1),
- m_hasPreciseScrollingDeltas(false),
- m_railsMode(RailsModeFree)
-#if OS(MACOSX)
- ,
- m_phase(WheelEventPhaseNone),
- m_momentumPhase(WheelEventPhaseNone)
-#endif
-{
-}
-
-WheelEvent::WheelEvent(const FloatPoint& wheelTicks,
- const FloatPoint& rawDelta,
- unsigned deltaMode,
- AbstractView* view,
- const IntPoint& screenLocation,
- const IntPoint& windowLocation,
- PlatformEvent::Modifiers modifiers,
- unsigned short buttons,
- TimeTicks platformTimeStamp,
- int resendingPluginId,
- bool hasPreciseScrollingDeltas,
- RailsMode railsMode,
- bool cancelable)
- : MouseEvent(EventTypeNames::wheel,
- true,
- cancelable,
- view,
- 0,
- screenLocation.x(),
- screenLocation.y(),
- windowLocation.x(),
- windowLocation.y(),
- 0,
- 0,
- modifiers,
- 0,
- buttons,
- nullptr,
- platformTimeStamp,
- PlatformMouseEvent::RealOrIndistinguishable,
- // TODO(zino): Should support canvas hit region because the
- // wheel event is a kind of mouse event. Please see
- // http://crbug.com/594075
- String(),
- nullptr),
- m_wheelDelta(wheelTicks.x() * TickMultiplier,
- wheelTicks.y() * TickMultiplier),
- m_deltaX(-rawDelta.x()),
- m_deltaY(-rawDelta.y()),
- m_deltaZ(0),
- m_deltaMode(deltaMode),
- m_resendingPluginId(resendingPluginId),
- m_hasPreciseScrollingDeltas(hasPreciseScrollingDeltas),
- m_railsMode(railsMode)
-#if OS(MACOSX)
- ,
- m_phase(WheelEventPhaseNone),
- m_momentumPhase(WheelEventPhaseNone)
-#endif
-{
-}
+ m_deltaMode(initializer.deltaMode()) {}
-#if OS(MACOSX)
-WheelEvent::WheelEvent(const FloatPoint& wheelTicks,
- const FloatPoint& rawDelta,
- unsigned deltaMode,
- AbstractView* view,
- const IntPoint& screenLocation,
- const IntPoint& windowLocation,
- PlatformEvent::Modifiers modifiers,
- unsigned short buttons,
- TimeTicks platformTimeStamp,
- int resendingPluginId,
- bool hasPreciseScrollingDeltas,
- RailsMode railsMode,
- bool cancelable,
- WheelEventPhase phase,
- WheelEventPhase momentumPhase)
+WheelEvent::WheelEvent(const WebMouseWheelEvent& event, AbstractView* view)
: MouseEvent(EventTypeNames::wheel,
true,
- cancelable,
+ event.cancelable(),
view,
- 0,
- screenLocation.x(),
- screenLocation.y(),
- windowLocation.x(),
- windowLocation.y(),
- 0,
- 0,
- modifiers,
- 0,
- buttons,
- nullptr,
- platformTimeStamp,
PlatformMouseEvent::RealOrIndistinguishable,
// TODO(zino): Should support canvas hit region because the
// wheel event is a kind of mouse event. Please see
// http://crbug.com/594075
String(),
- nullptr),
- m_wheelDelta(wheelTicks.x() * TickMultiplier,
- wheelTicks.y() * TickMultiplier),
- m_deltaX(-rawDelta.x()),
- m_deltaY(-rawDelta.y()),
+ event),
+ m_wheelDelta(event.wheelTicksX * TickMultiplier,
+ event.wheelTicksY * TickMultiplier),
+ m_deltaX(-event.deltaXInRootFrame()),
+ m_deltaY(-event.deltaYInRootFrame()),
m_deltaZ(0),
- m_deltaMode(deltaMode),
- m_resendingPluginId(resendingPluginId),
- m_hasPreciseScrollingDeltas(hasPreciseScrollingDeltas),
- m_railsMode(railsMode),
- m_phase(phase),
- m_momentumPhase(momentumPhase) {}
-#endif
+ m_deltaMode(convertDeltaMode(event)),
+ m_nativeEvent(event) {}
const AtomicString& WheelEvent::interfaceName() const {
return EventNames::WheelEvent;

Powered by Google App Engine
This is Rietveld 408576698