Reviewed by Oliver.
authorantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Apr 2007 10:44:25 +0000 (10:44 +0000)
committerantti <antti@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Apr 2007 10:44:25 +0000 (10:44 +0000)
        Fix <rdar://problem/5169261>
        REGRESSION: Google Maps zooming too sensitive when using two fingers on trackpad

        Use line based delta values when generating DOM wheel events, use pixel deltas
        for scrolling only.

        No test case, requires user interaction and specific hardware.

        * page/EventHandler.cpp:
        (WebCore::EventHandler::handleWheelEvent):
        * platform/PlatformWheelEvent.h:
        (WebCore::PlatformWheelEvent::continuousDeltaX):
        (WebCore::PlatformWheelEvent::continuousDeltaY):
        * platform/mac/WheelEventMac.mm:
        (WebCore::PlatformWheelEvent::PlatformWheelEvent):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@21188 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/page/EventHandler.cpp
WebCore/platform/PlatformWheelEvent.h
WebCore/platform/mac/WheelEventMac.mm

index b9802c33beb18eda4067de239d46addc421ec487..691f7ff9bb828ff330d3f2360dadfd079af77807 100644 (file)
@@ -1,3 +1,23 @@
+2007-04-29  Antti Koivisto  <antti@apple.com>
+
+        Reviewed by Oliver.
+
+        Fix <rdar://problem/5169261>
+        REGRESSION: Google Maps zooming too sensitive when using two fingers on trackpad
+        
+        Use line based delta values when generating DOM wheel events, use pixel deltas
+        for scrolling only.
+        
+        No test case, requires user interaction and specific hardware.
+
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::handleWheelEvent):
+        * platform/PlatformWheelEvent.h:
+        (WebCore::PlatformWheelEvent::continuousDeltaX):
+        (WebCore::PlatformWheelEvent::continuousDeltaY):
+        * platform/mac/WheelEventMac.mm:
+        (WebCore::PlatformWheelEvent::PlatformWheelEvent):
+
 2007-04-29  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by Brady.
index 4e5b3f000107e653eb167e5fb59347a739a9089e..2e8d8cef2a14450ca501dc2ac5dab824df654365 100644 (file)
@@ -1220,11 +1220,13 @@ bool EventHandler::handleWheelEvent(PlatformWheelEvent& e)
         if (node->renderer()) {
             // Just break up into two scrolls if we need to.  Diagonal movement on 
             // a MacBook pro is an example of a 2-dimensional mouse wheel event (where both deltaX and deltaY can be set).
-            if (e.deltaX() && node->renderer()->scroll(e.deltaX() < 0 ? ScrollRight : ScrollLeft, e.isContinuous() ? ScrollByPixel : ScrollByLine,
-                                                       e.deltaX() < 0 ? -e.deltaX() : e.deltaX()))
+            float deltaX = e.isContinuous() ? e.continuousDeltaX() : e.deltaX();
+            float deltaY = e.isContinuous() ? e.continuousDeltaY() : e.deltaY();
+            if (deltaX && node->renderer()->scroll(deltaX < 0 ? ScrollRight : ScrollLeft, e.isContinuous() ? ScrollByPixel : ScrollByLine,
+                                                       deltaX < 0 ? -deltaX : deltaX))
                 e.accept();
-            if (e.deltaY() && node->renderer()->scroll(e.deltaY() < 0 ? ScrollDown : ScrollUp, e.isContinuous() ? ScrollByPixel : ScrollByLine,
-                                                       e.deltaY() < 0 ? -e.deltaY() : e.deltaY()))
+            if (deltaY && node->renderer()->scroll(deltaY < 0 ? ScrollDown : ScrollUp, e.isContinuous() ? ScrollByPixel : ScrollByLine,
+                                                       deltaY < 0 ? -deltaY : deltaY))
                 e.accept();
         }
     }
index 5896fc2d44ee57d959c455a6251f71d960aa33f9..8e76d638863a8009083c35315273f951e48a0a4a 100644 (file)
@@ -75,6 +75,8 @@ namespace WebCore {
         void ignore() { m_isAccepted = false; }
         
         bool isContinuous() const { return m_isContinuous; }
+        float continuousDeltaX() const { return m_continuousDeltaX; }
+        float continuousDeltaY() const { return m_continuousDeltaY; }
 
 #if PLATFORM(MAC)
         PlatformWheelEvent(NSEvent*);
@@ -100,6 +102,8 @@ namespace WebCore {
         bool m_altKey;
         bool m_metaKey;
         bool m_isContinuous;
+        float m_continuousDeltaX;
+        float m_continuousDeltaY;
     };
 
 } // namespace WebCore
index 6cbfca9d37d2e22e6d0b2ff93ede3e10582e1cda..558bc5fafc8d47b34d5c64927751799a70e17303 100644 (file)
@@ -34,6 +34,8 @@ namespace WebCore {
 PlatformWheelEvent::PlatformWheelEvent(NSEvent* event)
     : m_position(pointForEvent(event))
     , m_globalPosition(globalPointForEvent(event))
+    , m_deltaX([event deltaX])
+    , m_deltaY([event deltaY])
     , m_isAccepted(false)
     , m_shiftKey([event modifierFlags] & NSShiftKeyMask)
     , m_ctrlKey([event modifierFlags] & NSControlKeyMask)
@@ -41,7 +43,7 @@ PlatformWheelEvent::PlatformWheelEvent(NSEvent* event)
     , m_metaKey([event modifierFlags] & NSCommandKeyMask)
 {
     BOOL continuous;
-    wkGetWheelEventDeltas(event, &m_deltaX, &m_deltaY, &continuous);
+    wkGetWheelEventDeltas(event, &m_continuousDeltaX, &m_continuousDeltaY, &continuous);
     m_isContinuous = continuous;
 }