[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

weinig at apple.com weinig at apple.com
Sun Feb 20 22:53:34 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 7791a801df99ea1e492f302965d6b64503a6c5aa
Author: weinig at apple.com <weinig at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 13 01:25:56 2011 +0000

    https://bugs.webkit.org/show_bug.cgi?id=52337
    PlatformWheelEvent should know about the scroll phase on the Mac
    
    Reviewed by Anders Carlsson.
    
    Source/WebCore:
    
    Add a phase parameter on Mac PlatformWheelEvents.
    
    * platform/PlatformWheelEvent.h:
    (WebCore::PlatformWheelEvent::PlatformWheelEvent):
    (WebCore::PlatformWheelEvent::phase):
    * platform/mac/WheelEventMac.mm:
    (WebCore::phaseForEvent):
    (WebCore::PlatformWheelEvent::PlatformWheelEvent):
    
    WebKit2:
    
    Add a phase parameter on Mac WebWheelEvent and pipe it down to PlatformWheelEvent.
    
    * Shared/WebEvent.h:
    (WebKit::WebWheelEvent::phase):
    * 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::WebEventFactory::createWebWheelEvent):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75661 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index bffed42..af1be07 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2011-01-12  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Anders Carlsson.
+
+        https://bugs.webkit.org/show_bug.cgi?id=52337
+        PlatformWheelEvent should know about the scroll phase on the Mac
+
+        Add a phase parameter on Mac PlatformWheelEvents.
+
+        * platform/PlatformWheelEvent.h:
+        (WebCore::PlatformWheelEvent::PlatformWheelEvent):
+        (WebCore::PlatformWheelEvent::phase):
+        * platform/mac/WheelEventMac.mm:
+        (WebCore::phaseForEvent):
+        (WebCore::PlatformWheelEvent::PlatformWheelEvent):
+
 2011-01-12  Chris Marrin  <cmarrin at apple.com>
 
         Unreviewed.
diff --git a/Source/WebCore/platform/PlatformWheelEvent.h b/Source/WebCore/platform/PlatformWheelEvent.h
index 6747392..1e5cd53 100644
--- a/Source/WebCore/platform/PlatformWheelEvent.h
+++ b/Source/WebCore/platform/PlatformWheelEvent.h
@@ -68,8 +68,22 @@ namespace WebCore {
     // and synthesized in other cases where platforms generate line-by-line scrolling events.
     // The ScrollByPageWheelEvent indicates that the wheel event should scroll an entire page.  In this case WebCore's built in paging behavior is used to page
     // up and down (you get the same behavior as if the user was clicking in a scrollbar track to page up or page down).  Page scrolling only works in the vertical direction.
-    enum PlatformWheelEventGranularity { ScrollByPageWheelEvent, ScrollByPixelWheelEvent };
-    
+    enum PlatformWheelEventGranularity {
+        ScrollByPageWheelEvent,
+        ScrollByPixelWheelEvent
+    };
+
+#if PLATFORM(MAC)
+    enum PlatformWheelEventPhase {
+        PlatformWheelEventPhaseNone        = 0,
+        PlatformWheelEventPhaseBegan       = 1 << 1,
+        PlatformWheelEventPhaseStationary  = 1 << 2,
+        PlatformWheelEventPhaseChanged     = 1 << 3,
+        PlatformWheelEventPhaseEnded       = 1 << 4,
+        PlatformWheelEventPhaseCancelled   = 1 << 5,
+    };
+#endif
+
     class PlatformWheelEvent {
     public:
         PlatformWheelEvent()
@@ -83,6 +97,9 @@ namespace WebCore {
             , m_ctrlKey(false)
             , m_altKey(false)
             , m_metaKey(false)
+#if PLATFORM(MAC)
+            , m_phase(PlatformWheelEventPhaseNone)
+#endif
         {
         }
 
@@ -128,10 +145,14 @@ namespace WebCore {
         PlatformWheelEvent(const Evas_Event_Mouse_Wheel*);
 #endif
 
-#if PLATFORM(MAC) && defined(__OBJC__)
+#if PLATFORM(MAC)
+#if defined(__OBJC__)
         PlatformWheelEvent(NSEvent *, NSView *windowView);
 #endif
 
+        PlatformWheelEventPhase phase() const { return m_phase; }
+#endif
+
 #if PLATFORM(QT)
         PlatformWheelEvent(QWheelEvent*);
         PlatformWheelEvent(QGraphicsSceneWheelEvent*);
@@ -164,6 +185,9 @@ namespace WebCore {
         bool m_ctrlKey;
         bool m_altKey;
         bool m_metaKey;
+#if PLATFORM(MAC)
+        PlatformWheelEventPhase m_phase;
+#endif
     };
 
 } // namespace WebCore
diff --git a/Source/WebCore/platform/mac/WheelEventMac.mm b/Source/WebCore/platform/mac/WheelEventMac.mm
index d9663b9..f1b0612 100644
--- a/Source/WebCore/platform/mac/WheelEventMac.mm
+++ b/Source/WebCore/platform/mac/WheelEventMac.mm
@@ -32,6 +32,26 @@
 
 namespace WebCore {
 
+static PlatformWheelEventPhase phaseForEvent(NSEvent *event)
+{
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+    uint32_t phase = PlatformWheelEventPhaseNone; 
+    if ([event momentumPhase] & NSEventPhaseBegan)
+        phase |= PlatformWheelEventPhaseBegan;
+    if ([event momentumPhase] & NSEventPhaseStationary)
+        phase |= PlatformWheelEventPhaseStationary;
+    if ([event momentumPhase] & NSEventPhaseChanged)
+        phase |= PlatformWheelEventPhaseChanged;
+    if ([event momentumPhase] & NSEventPhaseEnded)
+        phase |= PlatformWheelEventPhaseEnded;
+    if ([event momentumPhase] & NSEventPhaseCancelled)
+        phase |= PlatformWheelEventPhaseCancelled;
+    return static_cast<PlatformWheelEventPhase>(phase);
+#else
+    return PlatformWheelEventPhaseNone;
+#endif
+}
+
 PlatformWheelEvent::PlatformWheelEvent(NSEvent* event, NSView *windowView)
     : m_position(pointForEvent(event, windowView))
     , m_globalPosition(globalPointForEvent(event))
@@ -41,9 +61,10 @@ PlatformWheelEvent::PlatformWheelEvent(NSEvent* event, NSView *windowView)
     , m_ctrlKey([event modifierFlags] & NSControlKeyMask)
     , m_altKey([event modifierFlags] & NSAlternateKeyMask)
     , m_metaKey([event modifierFlags] & NSCommandKeyMask)
+    , m_phase(phaseForEvent(event))
 {
     BOOL continuous;
-    
+
     wkGetWheelEventDeltas(event, &m_deltaX, &m_deltaY, &continuous);
     if (continuous) {
         m_wheelTicksX = m_deltaX / static_cast<float>(Scrollbar::pixelsPerLineStep());
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 9c99e77..fbc8cf7 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,24 @@
+2011-01-12  Sam Weinig  <sam at webkit.org>
+
+        Reviewed by Anders Carlsson.
+
+        https://bugs.webkit.org/show_bug.cgi?id=52337
+        PlatformWheelEvent should know about the scroll phase on the Mac
+
+        Add a phase parameter on Mac WebWheelEvent and pipe it down to PlatformWheelEvent.
+
+        * Shared/WebEvent.h:
+        (WebKit::WebWheelEvent::phase):
+        * 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::WebEventFactory::createWebWheelEvent):
+
 2011-01-12  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit2/Shared/WebEvent.h b/WebKit2/Shared/WebEvent.h
index b17cc38..d4af992 100644
--- a/WebKit2/Shared/WebEvent.h
+++ b/WebKit2/Shared/WebEvent.h
@@ -151,15 +151,30 @@ public:
         ScrollByPixelWheelEvent
     };
 
+#if PLATFORM(MAC)
+    enum Phase {
+        PhaseNone        = 0,
+        PhaseBegan       = 1 << 1,
+        PhaseStationary  = 1 << 2,
+        PhaseChanged     = 1 << 3,
+        PhaseEnded       = 1 << 4,
+        PhaseCancelled   = 1 << 5,
+    };
+#endif
+
     WebWheelEvent() { }
 
     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, Modifiers, double timestamp);
+#endif
 
     const WebCore::IntPoint position() const { return m_position; }
     const WebCore::IntPoint globalPosition() const { return m_globalPosition; }
     const WebCore::FloatSize delta() const { return m_delta; }
     const WebCore::FloatSize wheelTicks() const { return m_wheelTicks; }
     Granularity granularity() const { return static_cast<Granularity>(m_granularity); }
+    Phase phase() const { return static_cast<Phase>(m_phase); }
 
     void encode(CoreIPC::ArgumentEncoder*) const;
     static bool decode(CoreIPC::ArgumentDecoder*, WebWheelEvent&);
@@ -172,6 +187,9 @@ private:
     WebCore::FloatSize m_delta;
     WebCore::FloatSize m_wheelTicks;
     uint32_t m_granularity; // Granularity
+#if PLATFORM(MAC)
+    uint32_t m_phase; // Phase
+#endif
 };
 
 // FIXME: Move this class to its own header file.
diff --git a/WebKit2/Shared/WebEventConversion.cpp b/WebKit2/Shared/WebEventConversion.cpp
index 69e197d..14c51b7 100644
--- a/WebKit2/Shared/WebEventConversion.cpp
+++ b/WebKit2/Shared/WebEventConversion.cpp
@@ -110,6 +110,9 @@ public:
         m_ctrlKey = webEvent.controlKey();
         m_altKey = webEvent.altKey();
         m_metaKey = webEvent.metaKey();
+#if PLATFORM(MAC)
+        m_phase = static_cast<WebCore::PlatformWheelEventPhase>(webEvent.phase());
+#endif
     }
 };
 
diff --git a/WebKit2/Shared/WebWheelEvent.cpp b/WebKit2/Shared/WebWheelEvent.cpp
index 635c075..570b8e0 100644
--- a/WebKit2/Shared/WebWheelEvent.cpp
+++ b/WebKit2/Shared/WebWheelEvent.cpp
@@ -43,19 +43,53 @@ WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint
     ASSERT(isWheelEventType(type));
 }
 
+#if PLATFORM(MAC)
+WebWheelEvent::WebWheelEvent(Type type, const IntPoint& position, const IntPoint& globalPosition, const FloatSize& delta, const FloatSize& wheelTicks, Granularity granularity, Phase phase, Modifiers modifiers, double timestamp)
+    : WebEvent(type, modifiers, timestamp)
+    , m_position(position)
+    , m_globalPosition(globalPosition)
+    , m_delta(delta)
+    , m_wheelTicks(wheelTicks)
+    , m_granularity(granularity)
+    , m_phase(phase)
+{
+    ASSERT(isWheelEventType(type));
+}
+#endif
+
 void WebWheelEvent::encode(CoreIPC::ArgumentEncoder* encoder) const
 {
     WebEvent::encode(encoder);
 
-    encoder->encode(CoreIPC::In(m_position, m_globalPosition, m_delta, m_wheelTicks, m_granularity));
+    encoder->encode(m_position);
+    encoder->encode(m_globalPosition);
+    encoder->encode(m_delta);
+    encoder->encode(m_wheelTicks);
+    encoder->encode(m_granularity);
+#if PLATFORM(MAC)
+    encoder->encode(m_phase);
+#endif
 }
 
 bool WebWheelEvent::decode(CoreIPC::ArgumentDecoder* decoder, WebWheelEvent& t)
 {
     if (!WebEvent::decode(decoder, t))
         return false;
-
-    return decoder->decode(CoreIPC::Out(t.m_position, t.m_globalPosition, t.m_delta, t.m_wheelTicks, t.m_granularity));
+    if (!decoder->decode(t.m_position))
+        return false;
+    if (!decoder->decode(t.m_globalPosition))
+        return false;
+    if (!decoder->decode(t.m_delta))
+        return false;
+    if (!decoder->decode(t.m_wheelTicks))
+        return false;
+    if (!decoder->decode(t.m_granularity))
+        return false;
+#if PLATFORM(MAC)
+    if (!decoder->decode(t.m_phase))
+        return false;
+#endif
+    return true;
 }
 
 bool WebWheelEvent::isWheelEventType(Type type)
diff --git a/WebKit2/Shared/mac/WebEventFactory.mm b/WebKit2/Shared/mac/WebEventFactory.mm
index cedcd48..46ff906 100644
--- a/WebKit2/Shared/mac/WebEventFactory.mm
+++ b/WebKit2/Shared/mac/WebEventFactory.mm
@@ -169,6 +169,26 @@ static NSPoint pointForEvent(NSEvent *event, NSView *windowView)
     }
 }
 
+static WebWheelEvent::Phase phaseForEvent(NSEvent *event)
+{
+#if !defined(BUILDING_ON_SNOW_LEOPARD)
+    uint32_t phase = WebWheelEvent::PhaseNone; 
+    if ([event momentumPhase] & NSEventPhaseBegan)
+        phase |= WebWheelEvent::PhaseBegan;
+    if ([event momentumPhase] & NSEventPhaseStationary)
+        phase |= WebWheelEvent::PhaseStationary;
+    if ([event momentumPhase] & NSEventPhaseChanged)
+        phase |= WebWheelEvent::PhaseChanged;
+    if ([event momentumPhase] & NSEventPhaseEnded)
+        phase |= WebWheelEvent::PhaseEnded;
+    if ([event momentumPhase] & NSEventPhaseCancelled)
+        phase |= WebWheelEvent::PhaseCancelled;
+    return static_cast<WebWheelEvent::Phase>(phase);
+#else
+    return WebWheelEvent::PhaseNone;
+#endif
+}
+    
 static inline String textFromEvent(NSEvent* event)
 {
     if ([event type] == NSFlagsChanged)
@@ -999,10 +1019,11 @@ WebWheelEvent WebEventFactory::createWebWheelEvent(NSEvent *event, NSView *windo
         deltaY *= static_cast<float>(Scrollbar::pixelsPerLineStep());
     }
 
+    WebWheelEvent::Phase phase              = phaseForEvent(event);
     WebEvent::Modifiers modifiers           = modifiersForEvent(event);
     double timestamp                        = [event timestamp];
-
-    return WebWheelEvent(WebEvent::Wheel, IntPoint(position), IntPoint(globalPosition), FloatSize(deltaX, deltaY), FloatSize(wheelTicksX, wheelTicksY), granularity, modifiers, timestamp);
+    
+    return WebWheelEvent(WebEvent::Wheel, IntPoint(position), IntPoint(globalPosition), FloatSize(deltaX, deltaY), FloatSize(wheelTicksX, wheelTicksY), granularity, phase, modifiers, timestamp);
 }
 
 WebKeyboardEvent WebEventFactory::createWebKeyboardEvent(NSEvent *event, NSView *)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list