Changeset 121025 in webkit


Ignore:
Timestamp:
Jun 22, 2012 8:18:46 AM (12 years ago)
Author:
rjkroege@chromium.org
Message:

Suppress horizontal conversion of PlatformWheelEvents when hasPreciseScrollingDeltas is true
https://bugs.webkit.org/show_bug.cgi?id=89580

Source/WebCore:

WebKit GTK and Chromium Linux force vertical wheel events to
scroll horizontally when over horizontal scroll bars. This is
undesirable for touchpad scrolling with
hasPreciseScrollingDeltas() == true. Modified shouldTurnVerticalTicksIntoHorizontal
to not perform this conversion for PlatformWheelEvents with preciseScrollingDeltas.

Reviewed by Adam Barth.

Unit tests in EventHandlerTest.cpp

  • page/EventHandler.cpp:

(WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal):
(WebCore::EventHandler::handleWheelEvent):

  • page/EventHandler.h:

(EventHandler):

  • page/chromium/EventHandlerChromium.cpp:

(WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal):

  • page/gtk/EventHandlerGtk.cpp:

(WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal):

Source/WebKit/chromium:

WebKit GTK and Chromium Linux force vertical wheel events to
scroll horizontally when over horizontal scroll bars. This is
undesirable for touchpad scrolling with hasPreciseScrollingDeltas() == true.

Added unit tests to show that
EventHandler::shouldTurnVerticalTicksIntoHorizontal() is true
only for PlatformWheelEvents when !hasPreciseScrollingDeltas().

Reviewed by Adam Barth.

  • WebKit.gypi:
  • tests/EventHandlerTest.cpp: Added.

(MockScrollbar):
(MockScrollbar::MockScrollbar):
(MockScrollbar::~MockScrollbar):
(MockHitTestResult):
(MockHitTestResult::MockHitTestResult):
(MockHitTestResult::scrollbar):
(MockPlatformWheelEvent):
(MockPlatformWheelEvent::MockPlatformWheelEvent):
(EventHandlerTest):
(EventHandlerTest::EventHandlerTest):
(EventHandlerTest::externalShouldTurnVerticalTicksIntoHorizontal):
(TEST):

Location:
trunk/Source
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r121022 r121025  
     12012-06-22  Robert Kroeger  <rjkroege@chromium.org>
     2
     3        Suppress horizontal conversion of PlatformWheelEvents when hasPreciseScrollingDeltas is true
     4        https://bugs.webkit.org/show_bug.cgi?id=89580
     5
     6        WebKit GTK and Chromium Linux force vertical wheel events to
     7        scroll horizontally when over horizontal scroll bars.  This is
     8        undesirable for touchpad scrolling with
     9        hasPreciseScrollingDeltas() == true. Modified shouldTurnVerticalTicksIntoHorizontal
     10        to not perform this conversion for PlatformWheelEvents with preciseScrollingDeltas.
     11
     12        Reviewed by Adam Barth.
     13
     14        Unit tests in EventHandlerTest.cpp
     15
     16        * page/EventHandler.cpp:
     17        (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal):
     18        (WebCore::EventHandler::handleWheelEvent):
     19        * page/EventHandler.h:
     20        (EventHandler):
     21        * page/chromium/EventHandlerChromium.cpp:
     22        (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal):
     23        * page/gtk/EventHandlerGtk.cpp:
     24        (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal):
     25
    1262012-06-22  Ilya Tikhonovsky  <loislo@chromium.org>
    227
  • trunk/Source/WebCore/page/EventHandler.cpp

    r120597 r121025  
    22852285
    22862286#if !PLATFORM(GTK) && !(PLATFORM(CHROMIUM) && (OS(UNIX) && !OS(DARWIN)))
    2287 bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&) const
     2287bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&, const PlatformWheelEvent&) const
    22882288{
    22892289    return false;
     
    23402340    // appropriately.
    23412341    PlatformWheelEvent event = e;
    2342     if (m_baseEventType == PlatformEvent::NoType && shouldTurnVerticalTicksIntoHorizontal(result))
     2342    if (m_baseEventType == PlatformEvent::NoType && shouldTurnVerticalTicksIntoHorizontal(result, e))
    23432343        event = event.copyTurningVerticalTicksIntoHorizontalTicks();
    23442344
  • trunk/Source/WebCore/page/EventHandler.h

    r118611 r121025  
    4848#include <wtf/HashMap.h>
    4949#endif
     50
     51class EventHandlerTest;
    5052
    5153namespace WebCore {
     
    228230
    229231private:
     232    friend class ::EventHandlerTest;
     233
    230234#if ENABLE(DRAG_SUPPORT)
    231235    static DragState& dragState();
     
    267271    bool logicalScrollOverflow(ScrollLogicalDirection, ScrollGranularity, Node* startingNode = 0);
    268272   
    269     bool shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&) const;
     273    bool shouldTurnVerticalTicksIntoHorizontal(const HitTestResult&, const PlatformWheelEvent&) const;
    270274    bool mouseDownMayStartSelect() const { return m_mouseDownMayStartSelect; }
    271275
  • trunk/Source/WebCore/page/chromium/EventHandlerChromium.cpp

    r103297 r121025  
    159159// horizontal scrollbar while scrolling with the wheel.
    160160// This code comes from gtk/EventHandlerGtk.cpp.
    161 bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult& result) const
     161bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult& result, const PlatformWheelEvent& event) const
    162162{
    163     return result.scrollbar() && result.scrollbar()->orientation() == HorizontalScrollbar;
     163    return !event.hasPreciseScrollingDeltas() && result.scrollbar() && result.scrollbar()->orientation() == HorizontalScrollbar;
    164164}
    165165#endif
  • trunk/Source/WebCore/page/gtk/EventHandlerGtk.cpp

    r103196 r121025  
    127127// add the deltas and ticks here so that this behavior is consistent
    128128// for styled scrollbars.
    129 bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult& result) const
     129bool EventHandler::shouldTurnVerticalTicksIntoHorizontal(const HitTestResult& result, const PlatformWheelEvent&) const
    130130{
    131131    return result.scrollbar() && result.scrollbar()->orientation() == HorizontalScrollbar;
  • trunk/Source/WebKit/chromium/ChangeLog

    r121016 r121025  
     12012-06-22  Robert Kroeger  <rjkroege@chromium.org>
     2
     3        Suppress horizontal conversion of PlatformWheelEvents when hasPreciseScrollingDeltas is true
     4        https://bugs.webkit.org/show_bug.cgi?id=89580
     5
     6        WebKit GTK and Chromium Linux force vertical wheel events to
     7        scroll horizontally when over horizontal scroll bars.  This is
     8        undesirable for touchpad scrolling with hasPreciseScrollingDeltas() == true.
     9
     10        Added unit tests to show that
     11        EventHandler::shouldTurnVerticalTicksIntoHorizontal() is true
     12        only for PlatformWheelEvents when !hasPreciseScrollingDeltas().
     13
     14        Reviewed by Adam Barth.
     15
     16        * WebKit.gypi:
     17        * tests/EventHandlerTest.cpp: Added.
     18        (MockScrollbar):
     19        (MockScrollbar::MockScrollbar):
     20        (MockScrollbar::~MockScrollbar):
     21        (MockHitTestResult):
     22        (MockHitTestResult::MockHitTestResult):
     23        (MockHitTestResult::scrollbar):
     24        (MockPlatformWheelEvent):
     25        (MockPlatformWheelEvent::MockPlatformWheelEvent):
     26        (EventHandlerTest):
     27        (EventHandlerTest::EventHandlerTest):
     28        (EventHandlerTest::externalShouldTurnVerticalTicksIntoHorizontal):
     29        (TEST):
     30
    1312012-06-22  Amy Ousterhout  <aousterh@chromium.org>
    232
  • trunk/Source/WebKit/chromium/WebKit.gypi

    r120360 r121025  
    103103            'tests/DragImageTest.cpp',
    104104            'tests/DrawingBufferChromiumTest.cpp',
     105            'tests/EventHandlerTest.cpp',
    105106            'tests/EventListenerTest.cpp',
    106107            'tests/FakeCCLayerTreeHostClient.h',
Note: See TracChangeset for help on using the changeset viewer.