Skip to content
  • jonlee@apple.com's avatar
    Extend DOM WheelEvent to differentiate between physical and logical scroll directions · 736fb651
    jonlee@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=68959
    <rdar://problem/10036688>
    
    Reviewed by Sam Weinig.
    
    Source/JavaScriptCore:
    
    * wtf/Platform.h: Added HAVE_INVERTED_WHEEL_EVENTS for Lion and later.
    
    Source/WebCore:
    
    Test: fast/events/wheelevent-direction-inverted-from-device.html
    
    * dom/WheelEvent.cpp:
    (WebCore::WheelEvent::WheelEvent):
    (WebCore::WheelEvent::initWheelEvent):
    (WebCore::WheelEventDispatchMediator::WheelEventDispatchMediator):
    * dom/WheelEvent.h:
    (WebCore::WheelEvent::create):
    (WebCore::WheelEvent::webkitDirectionInvertedFromDevice):
    * dom/WheelEvent.idl: Added the webkitDirectionInvertedFromDevice idl attribute.
    * platform/PlatformWheelEvent.h:
    (WebCore::PlatformWheelEvent::PlatformWheelEvent):
    (WebCore::PlatformWheelEvent::webkitDirectionInvertedFromDevice):
    * platform/efl/PlatformWheelEventEfl.cpp:
    (WebCore::PlatformWheelEvent::PlatformWheelEvent): default to false.
    * platform/gtk/PlatformWheelEventGtk.cpp:
    (WebCore::PlatformWheelEvent::PlatformWheelEvent): default to false.
    * platform/mac/WheelEventMac.mm:
    (WebCore::PlatformWheelEvent::PlatformWheelEvent): if building on Lion or later, use
    [NSEvent isDirectionInvertedFromDevice].
    * platform/qt/WheelEventQt.cpp:
    (WebCore::PlatformWheelEvent::PlatformWheelEvent): default to false.
    * platform/win/WheelEventWin.cpp:
    (WebCore::PlatformWheelEvent::PlatformWheelEvent): default to false.
    * platform/wx/MouseWheelEventWx.cpp:
    (WebCore::PlatformWheelEvent::PlatformWheelEvent): default to false.
    
    Source/WebKit2:
    
    * Shared/WebEvent.h:
    (WebKit::WebWheelEvent::directionInvertedFromDevice):
    * Shared/WebEventConversion.cpp:
    (WebKit::WebKit2PlatformWheelEvent::WebKit2PlatformWheelEvent):
    * Shared/WebWheelEvent.cpp:
    (WebKit::WebWheelEvent::WebWheelEvent):
    (WebKit::WebWheelEvent::encode):
    (WebKit::WebWheelEvent::decode):
    * Shared/mac/WebEventFactory.mm:
    (WebKit::WebEventFactory::createWebWheelEvent): get the flag from the NSEvent.
    * UIProcess/WebPageProxy.cpp:
    (WebKit::coalesce):
    
    LayoutTests:
    
    * fast/events/wheelevent-direction-inverted-from-device-expected.txt: Added.
    * fast/events/wheelevent-direction-inverted-from-device.html: Added.
    * platform/mac-wk2/Skipped: WKTR does not support mouse scroll events yet.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96613 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    736fb651