Changeset 227966 in webkit
- Timestamp:
- Feb 1, 2018 8:04:09 AM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r227965 r227966 1 2018-02-01 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Shift + mouse scroll should scroll horizontally 4 https://bugs.webkit.org/show_bug.cgi?id=181629 5 6 Reviewed by Michael Catanzaro. 7 8 We currently turn vertical scroll into horizontal when scrolling over the horizontal scrollbar. When Shift key is 9 pressed, we still want to scroll in the scrollbar direction when scrolling over a scrollbar, so we need to swap 10 directions in both scrollbars depending on whther the Shift key is pressed or not. 11 12 * page/EventHandler.cpp: 13 (WebCore::EventHandler::shouldSwapScrollDirection const): Renamed. 14 (WebCore::EventHandler::handleWheelEvent): Use the new name. 15 (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal const): Deleted. 16 * page/EventHandler.h: 17 * platform/PlatformWheelEvent.h: 18 (WebCore::PlatformWheelEvent::copySwappingDirection const): Swap the direction of the event. 19 (WebCore::PlatformWheelEvent::copyTurningVerticalTicksIntoHorizontalTicks const): Deleted. 20 * platform/glib/EventHandlerGLib.cpp: 21 (WebCore::EventHandler::shouldSwapScrollDirection const): Take into account whether the Shift key is present. 22 (WebCore::EventHandler::shouldTurnVerticalTicksIntoHorizontal const): Deleted. 23 1 24 2018-02-01 Carlos Garcia Campos <cgarcia@igalia.com> 2 25 -
trunk/Source/WebCore/page/EventHandler.cpp
r226313 r227966 2640 2640 #if !PLATFORM(GTK) && !PLATFORM(WPE) 2641 2641 2642 bool EventHandler::should TurnVerticalTicksIntoHorizontal(const HitTestResult&, const PlatformWheelEvent&) const2642 bool EventHandler::shouldSwapScrollDirection(const HitTestResult&, const PlatformWheelEvent&) const 2643 2643 { 2644 2644 return false; … … 2784 2784 // FIXME: It should not be necessary to do this mutation here. 2785 2785 // Instead, the handlers should know convert vertical scrolls appropriately. 2786 PlatformWheelEvent adjustedEvent = event; 2787 if (shouldTurnVerticalTicksIntoHorizontal(result, event)) 2788 adjustedEvent = event.copyTurningVerticalTicksIntoHorizontalTicks(); 2789 2786 PlatformWheelEvent adjustedEvent = shouldSwapScrollDirection(result, event) ? event.copySwappingDirection() : event; 2790 2787 platformRecordWheelEvent(adjustedEvent); 2791 2788 -
trunk/Source/WebCore/page/EventHandler.h
r227759 r227966 385 385 bool logicalScrollOverflow(ScrollLogicalDirection, ScrollGranularity, Node* startingNode = nullptr); 386 386 387 bool should TurnVerticalTicksIntoHorizontal(const HitTestResult&, const PlatformWheelEvent&) const;387 bool shouldSwapScrollDirection(const HitTestResult&, const PlatformWheelEvent&) const; 388 388 389 389 bool mouseDownMayStartSelect() const { return m_mouseDownMayStartSelect; } -
trunk/Source/WebCore/platform/PlatformWheelEvent.h
r222392 r227966 82 82 } 83 83 84 PlatformWheelEvent copy TurningVerticalTicksIntoHorizontalTicks() const84 PlatformWheelEvent copySwappingDirection() const 85 85 { 86 86 PlatformWheelEvent copy = *this; 87 copy.m_deltaX = copy.m_deltaY; 88 copy.m_deltaY = 0; 89 copy.m_wheelTicksX = copy.m_wheelTicksY; 90 copy.m_wheelTicksY = 0; 87 std::swap(copy.m_deltaX, copy.m_deltaY); 88 std::swap(copy.m_wheelTicksX, copy.m_wheelTicksY); 91 89 return copy; 92 90 } -
trunk/Source/WebCore/platform/glib/EventHandlerGLib.cpp
r222595 r227966 129 129 // add the deltas and ticks here so that this behavior is consistent 130 130 // for styled scrollbars. 131 bool EventHandler::should TurnVerticalTicksIntoHorizontal(const HitTestResult& result, const PlatformWheelEvent& event) const131 bool EventHandler::shouldSwapScrollDirection(const HitTestResult& result, const PlatformWheelEvent& event) const 132 132 { 133 133 #if PLATFORM(GTK) … … 136 136 if (!scrollbar) 137 137 scrollbar = result.scrollbar(); 138 return scrollbar && scrollbar->orientation() == HorizontalScrollbar; 138 if (!scrollbar) 139 return false; 140 141 // The directions are already swapped when shift key is pressed, but when scrolling 142 // over scrollbars we always want to follow the scrollbar direction. 143 return scrollbar->orientation() == HorizontalScrollbar ? !event.shiftKey() : event.shiftKey(); 139 144 #else 140 145 UNUSED_PARAM(result); -
trunk/Source/WebKit/ChangeLog
r227961 r227966 1 2018-02-01 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Shift + mouse scroll should scroll horizontally 4 https://bugs.webkit.org/show_bug.cgi?id=181629 5 6 Reviewed by Michael Catanzaro. 7 8 Swap scroll direction when Shift is pressed for consistency with GtkScrolledWindow. 9 10 * UIProcess/API/gtk/WebKitWebViewBase.cpp: 11 (webkitWebViewBaseScrollEvent): 12 1 13 2018-02-01 Carlos Garcia Campos <cgarcia@igalia.com> 2 14 -
trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp
r227961 r227966 831 831 return GDK_EVENT_PROPAGATE; 832 832 833 // Shift+Wheel scrolls in the perpendicular direction. 834 if (event->state & GDK_SHIFT_MASK) { 835 switch (event->direction) { 836 case GDK_SCROLL_UP: 837 event->direction = GDK_SCROLL_LEFT; 838 break; 839 case GDK_SCROLL_LEFT: 840 event->direction = GDK_SCROLL_UP; 841 break; 842 case GDK_SCROLL_DOWN: 843 event->direction = GDK_SCROLL_RIGHT; 844 break; 845 case GDK_SCROLL_RIGHT: 846 event->direction = GDK_SCROLL_DOWN; 847 break; 848 case GDK_SCROLL_SMOOTH: 849 std::swap(event->delta_x, event->delta_y); 850 break; 851 } 852 } 853 833 854 webkitWebViewBaseHandleWheelEvent(webViewBase, reinterpret_cast<GdkEvent*>(event)); 834 855
Note: See TracChangeset
for help on using the changeset viewer.