Part of <rdar://problem/
8945362>
Reviewed by Anders Carlsson.
Rename existing phase to momentumPhase.
../WebCore:
* platform/PlatformWheelEvent.h:
(WebCore::PlatformWheelEvent::PlatformWheelEvent):
(WebCore::PlatformWheelEvent::momentumPhase):
* platform/mac/ScrollAnimatorMac.mm:
(WebCore::ScrollAnimatorMac::handleWheelEvent):
(WebCore::ScrollAnimatorMac::smoothScrollWithEvent):
* platform/mac/WheelEventMac.mm:
(WebCore::momentumPhaseForEvent):
(WebCore::phaseForEvent):
(WebCore::PlatformWheelEvent::PlatformWheelEvent):
../WebKit2:
* Shared/WebEvent.h:
(WebKit::WebWheelEvent::momentumPhase):
* Shared/WebEventConversion.cpp:
(WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
* Shared/WebWheelEvent.cpp:
(WebKit::WebWheelEvent::WebWheelEvent):
(WebKit::WebWheelEvent::encode):
(WebKit::WebWheelEvent::decode):
* Shared/mac/WebEventFactory.mm:
(WebKit::phaseForEvent):
(WebKit::momentumPhaseForEvent):
(WebKit::WebEventFactory::createWebWheelEvent):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@79141
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2011-02-19 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Add phase in addition to momentumPhase to platform wheel events
+ Part of <rdar://problem/8945362>
+
+ Rename existing phase to momentumPhase.
+
+ * platform/PlatformWheelEvent.h:
+ (WebCore::PlatformWheelEvent::PlatformWheelEvent):
+ (WebCore::PlatformWheelEvent::momentumPhase):
+ * platform/mac/ScrollAnimatorMac.mm:
+ (WebCore::ScrollAnimatorMac::handleWheelEvent):
+ (WebCore::ScrollAnimatorMac::smoothScrollWithEvent):
+ * platform/mac/WheelEventMac.mm:
+ (WebCore::momentumPhaseForEvent):
+ (WebCore::phaseForEvent):
+ (WebCore::PlatformWheelEvent::PlatformWheelEvent):
+
2011-02-19 Gavin Barraclough <barraclough@apple.com>
Qt build fix.
#if PLATFORM(MAC)
, m_hasPreciseScrollingDeltas(false)
, m_phase(PlatformWheelEventPhaseNone)
+ , m_momentumPhase(PlatformWheelEventPhaseNone)
, m_timestamp(0)
#endif
{
#endif
PlatformWheelEventPhase phase() const { return m_phase; }
+ PlatformWheelEventPhase momentumPhase() const { return m_momentumPhase; }
bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; }
double timestamp() const { return m_timestamp; }
#endif
#if PLATFORM(MAC)
bool m_hasPreciseScrollingDeltas;
PlatformWheelEventPhase m_phase;
+ PlatformWheelEventPhase m_momentumPhase;
double m_timestamp;
#endif
};
wheelEvent.accept();
- bool isMometumScrollEvent = (wheelEvent.phase() != PlatformWheelEventPhaseNone);
+ bool isMometumScrollEvent = (wheelEvent.momentumPhase() != PlatformWheelEventPhaseNone);
if (m_ignoreMomentumScrolls && (isMometumScrollEvent || m_snapRubberBandTimer.isActive())) {
- if (wheelEvent.phase() == PlatformWheelEventPhaseEnded)
+ if (wheelEvent.momentumPhase() == PlatformWheelEventPhaseEnded)
m_ignoreMomentumScrolls = false;
return;
}
isHorizontallyStretched = stretchAmount.width();
isVerticallyStretched = stretchAmount.height();
- PlatformWheelEventPhase phase = wheelEvent.phase();
+ PlatformWheelEventPhase phase = wheelEvent.momentumPhase();
// If we are starting momentum scrolling then do some setup.
if (!m_momentumScrollInProgress && (phase == PlatformWheelEventPhaseBegan || phase == PlatformWheelEventPhaseChanged))
/*
- * Copyright (C) 2004, 2006, 2010 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2004, 2006, 2010, 2011 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
namespace WebCore {
-static PlatformWheelEventPhase phaseForEvent(NSEvent *event)
+static PlatformWheelEventPhase momentumPhaseForEvent(NSEvent *event)
{
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
uint32_t phase = PlatformWheelEventPhaseNone;
#endif
}
+static PlatformWheelEventPhase phaseForEvent(NSEvent *event)
+{
+#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
+ uint32_t phase = PlatformWheelEventPhaseNone;
+ if ([event phase] & NSEventPhaseBegan)
+ phase |= PlatformWheelEventPhaseBegan;
+ if ([event phase] & NSEventPhaseStationary)
+ phase |= PlatformWheelEventPhaseStationary;
+ if ([event phase] & NSEventPhaseChanged)
+ phase |= PlatformWheelEventPhaseChanged;
+ if ([event phase] & NSEventPhaseEnded)
+ phase |= PlatformWheelEventPhaseEnded;
+ if ([event phase] & NSEventPhaseCancelled)
+ phase |= PlatformWheelEventPhaseCancelled;
+ return static_cast<PlatformWheelEventPhase>(phase);
+#else
+ UNUSED_PARAM(event);
+ return PlatformWheelEventPhaseNone;
+#endif
+}
+
PlatformWheelEvent::PlatformWheelEvent(NSEvent* event, NSView *windowView)
: m_position(pointForEvent(event, windowView))
, m_globalPosition(globalPointForEvent(event))
, m_altKey([event modifierFlags] & NSAlternateKeyMask)
, m_metaKey([event modifierFlags] & NSCommandKeyMask)
, m_phase(phaseForEvent(event))
+ , m_momentumPhase(momentumPhaseForEvent(event))
, m_timestamp([event timestamp])
{
BOOL continuous;
-
wkGetWheelEventDeltas(event, &m_deltaX, &m_deltaY, &continuous);
if (continuous) {
m_wheelTicksX = m_deltaX / static_cast<float>(Scrollbar::pixelsPerLineStep());
+2011-02-19 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Anders Carlsson.
+
+ Add phase in addition to momentumPhase to platform wheel events
+ Part of <rdar://problem/8945362>
+
+ Rename existing phase to momentumPhase.
+
+ * Shared/WebEvent.h:
+ (WebKit::WebWheelEvent::momentumPhase):
+ * Shared/WebEventConversion.cpp:
+ (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
+ * Shared/WebWheelEvent.cpp:
+ (WebKit::WebWheelEvent::WebWheelEvent):
+ (WebKit::WebWheelEvent::encode):
+ (WebKit::WebWheelEvent::decode):
+ * Shared/mac/WebEventFactory.mm:
+ (WebKit::phaseForEvent):
+ (WebKit::momentumPhaseForEvent):
+ (WebKit::WebEventFactory::createWebWheelEvent):
+
2011-02-19 Anders Carlsson <andersca@apple.com>
Reviewed by Dan Bernstein.
WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, Modifiers, double timestamp);
#if PLATFORM(MAC)
- WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, Phase, bool hasPreciseScrollingDeltas, Modifiers, double timestamp);
+ WebWheelEvent(Type, const WebCore::IntPoint& position, const WebCore::IntPoint& globalPosition, const WebCore::FloatSize& delta, const WebCore::FloatSize& wheelTicks, Granularity, Phase phase, Phase momentumPhase,bool hasPreciseScrollingDeltas, Modifiers, double timestamp);
#endif
const WebCore::IntPoint position() const { return m_position; }
Granularity granularity() const { return static_cast<Granularity>(m_granularity); }
#if PLATFORM(MAC)
Phase phase() const { return static_cast<Phase>(m_phase); }
+ Phase momentumPhase() const { return static_cast<Phase>(m_momentumPhase); }
bool hasPreciseScrollingDeltas() const { return m_hasPreciseScrollingDeltas; }
#endif
uint32_t m_granularity; // Granularity
#if PLATFORM(MAC)
uint32_t m_phase; // Phase
+ uint32_t m_momentumPhase; // Phase
bool m_hasPreciseScrollingDeltas;
#endif
};
m_metaKey = webEvent.metaKey();
#if PLATFORM(MAC)
m_phase = static_cast<WebCore::PlatformWheelEventPhase>(webEvent.phase());
+ m_momentumPhase = static_cast<WebCore::PlatformWheelEventPhase>(webEvent.momentumPhase());
m_hasPreciseScrollingDeltas = webEvent.hasPreciseScrollingDeltas();
m_timestamp = webEvent.timestamp();
#endif
}
#if PLATFORM(MAC)
-WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Granularity granularity, Phase phase, bool hasPreciseScrollingDeltas, Modifiers modifiers, double timestamp)
+WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Granularity granularity, Phase phase, Phase momentumPhase, bool hasPreciseScrollingDeltas, Modifiers modifiers, double timestamp)
: WebEvent(type, modifiers, timestamp)
, m_position(position)
, m_globalPosition(globalPosition)
, m_wheelTicks(wheelTicks)
, m_granularity(granularity)
, m_phase(phase)
+ , m_momentumPhase(momentumPhase)
, m_hasPreciseScrollingDeltas(hasPreciseScrollingDeltas)
{
ASSERT(isWheelEventType(type));
encoder->encode(m_granularity);
#if PLATFORM(MAC)
encoder->encode(m_phase);
+ encoder->encode(m_momentumPhase);
encoder->encode(m_hasPreciseScrollingDeltas);
#endif
}
#if PLATFORM(MAC)
if (!decoder->decode(t.m_phase))
return false;
+ if (!decoder->decode(t.m_momentumPhase))
+ return false;
if (!decoder->decode(t.m_hasPreciseScrollingDeltas))
return false;
#endif
static WebWheelEvent::Phase phaseForEvent(NSEvent *event)
{
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+ uint32_t phase = WebWheelEvent::PhaseNone;
+ if ([event phase] & NSEventPhaseBegan)
+ phase |= WebWheelEvent::PhaseBegan;
+ if ([event phase] & NSEventPhaseStationary)
+ phase |= WebWheelEvent::PhaseStationary;
+ if ([event phase] & NSEventPhaseChanged)
+ phase |= WebWheelEvent::PhaseChanged;
+ if ([event phase] & NSEventPhaseEnded)
+ phase |= WebWheelEvent::PhaseEnded;
+ if ([event phase] & NSEventPhaseCancelled)
+ phase |= WebWheelEvent::PhaseCancelled;
+ return static_cast<WebWheelEvent::Phase>(phase);
+#else
+ return WebWheelEvent::PhaseNone;
+#endif
+}
+
+static WebWheelEvent::Phase momentumPhaseForEvent(NSEvent *event)
+{
#if !defined(BUILDING_ON_SNOW_LEOPARD)
uint32_t phase = WebWheelEvent::PhaseNone;
if ([event momentumPhase] & NSEventPhaseBegan)
}
WebWheelEvent::Phase phase = phaseForEvent(event);
+ WebWheelEvent::Phase momentumPhase = momentumPhaseForEvent(event);
bool hasPreciseScrollingDeltas = continuous;
WebEvent::Modifiers modifiers = modifiersForEvent(event);
double timestamp = [event timestamp];
- return WebWheelEvent(WebEvent::Wheel, IntPoint(position), IntPoint(globalPosition), FloatSize(deltaX, deltaY), FloatSize(wheelTicksX, wheelTicksY), granularity, phase, hasPreciseScrollingDeltas, modifiers, timestamp);
+ return WebWheelEvent(WebEvent::Wheel, IntPoint(position), IntPoint(globalPosition), FloatSize(deltaX, deltaY), FloatSize(wheelTicksX, wheelTicksY), granularity, phase, momentumPhase, hasPreciseScrollingDeltas, modifiers, timestamp);
}
WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(NSEvent *event, NSView *)