Diff
Modified: trunk/Source/WebCore/ChangeLog (265137 => 265138)
--- trunk/Source/WebCore/ChangeLog 2020-07-31 09:00:54 UTC (rev 265137)
+++ trunk/Source/WebCore/ChangeLog 2020-07-31 10:57:19 UTC (rev 265138)
@@ -1,3 +1,18 @@
+2020-07-31 Carlos Garcia Campos <[email protected]>
+
+ [GTK] Mouse wheel events on horizontal scrollbar not correctly handled when AC mode is forced
+ https://bugs.webkit.org/show_bug.cgi?id=207113
+
+ Reviewed by Adrian Perez de Castro.
+
+ Remove GTK specific code to invert scroll direction of wheel events.
+
+ * page/EventHandler.cpp:
+ (WebCore::EventHandler::handleWheelEvent):
+ (WebCore::EventHandler::shouldSwapScrollDirection const): Deleted.
+ * platform/SourcesGLib.txt:
+ * platform/glib/EventHandlerGLib.cpp: Removed.
+
2020-07-10 Sergio Villar Senin <[email protected]>
[WebXR] Retrieve supported reference spaces from actual XR systems
Modified: trunk/Source/WebCore/page/EventHandler.cpp (265137 => 265138)
--- trunk/Source/WebCore/page/EventHandler.cpp 2020-07-31 09:00:54 UTC (rev 265137)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2020-07-31 10:57:19 UTC (rev 265138)
@@ -2778,15 +2778,6 @@
return false;
}
-#if !USE(GLIB)
-
-bool EventHandler::shouldSwapScrollDirection(const HitTestResult&, const PlatformWheelEvent&) const
-{
- return false;
-}
-
-#endif
-
void EventHandler::clearLatchedStateTimerFired()
{
LOG(ScrollLatching, "EventHandler %p clearLatchedStateTimerFired()", this);
@@ -2937,20 +2928,17 @@
m_frame.page()->resetLatchingState();
#endif
- // FIXME: It should not be necessary to do this mutation here.
- // Instead, the handlers should know convert vertical scrolls appropriately.
- PlatformWheelEvent adjustedEvent = shouldSwapScrollDirection(result, event) ? event.copySwappingDirection() : event;
- recordWheelEventForDeltaFilter(adjustedEvent);
+ recordWheelEventForDeltaFilter(event);
if (element) {
if (isOverWidget) {
if (WeakPtr<Widget> widget = widgetForElement(*element)) {
if (passWheelEventToWidget(event, *widget.get()))
- return completeWidgetWheelEvent(adjustedEvent, widget, scrollableArea, scrollableContainer.get());
+ return completeWidgetWheelEvent(event, widget, scrollableArea, scrollableContainer.get());
}
}
- if (!element->dispatchWheelEvent(adjustedEvent)) {
+ if (!element->dispatchWheelEvent(event)) {
m_isHandlingWheelEvent = false;
if (scrollableArea && scrollableArea->scrollShouldClearLatchedState()) {
// Web developer is controlling scrolling, so don't attempt to latch.
@@ -2958,7 +2946,7 @@
scrollableArea->setScrollShouldClearLatchedState(false);
}
- processWheelEventForScrollSnap(adjustedEvent, scrollableArea);
+ processWheelEventForScrollSnap(event, scrollableArea);
return true;
}
}
@@ -2966,8 +2954,8 @@
if (scrollableArea)
scrollableArea->setScrollShouldClearLatchedState(false);
- bool handledEvent = processWheelEventForScrolling(adjustedEvent, scrollableContainer.get(), scrollableArea);
- processWheelEventForScrollSnap(adjustedEvent, scrollableArea);
+ bool handledEvent = processWheelEventForScrolling(event, scrollableContainer.get(), scrollableArea);
+ processWheelEventForScrollSnap(event, scrollableArea);
return handledEvent;
}
Modified: trunk/Source/WebCore/platform/SourcesGLib.txt (265137 => 265138)
--- trunk/Source/WebCore/platform/SourcesGLib.txt 2020-07-31 09:00:54 UTC (rev 265137)
+++ trunk/Source/WebCore/platform/SourcesGLib.txt 2020-07-31 10:57:19 UTC (rev 265138)
@@ -23,7 +23,6 @@
platform/audio/glib/AudioBusGLib.cpp
-platform/glib/EventHandlerGLib.cpp
platform/glib/FileMonitorGLib.cpp
platform/glib/KeyedDecoderGlib.cpp
platform/glib/KeyedEncoderGlib.cpp
Deleted: trunk/Source/WebCore/platform/glib/EventHandlerGLib.cpp (265137 => 265138)
--- trunk/Source/WebCore/platform/glib/EventHandlerGLib.cpp 2020-07-31 09:00:54 UTC (rev 265137)
+++ trunk/Source/WebCore/platform/glib/EventHandlerGLib.cpp 2020-07-31 10:57:19 UTC (rev 265138)
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2006 Zack Rusin <[email protected]>
- * Copyright (C) 2014-2017 Igalia S.L.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "EventHandler.h"
-
-#include "FocusController.h"
-#include "Frame.h"
-#include "FrameView.h"
-#include "KeyboardEvent.h"
-#include "MouseEventWithHitTestResults.h"
-#include "NotImplemented.h"
-#include "Page.h"
-#include "PlatformKeyboardEvent.h"
-#include "PlatformWheelEvent.h"
-#include "RenderWidget.h"
-
-#if ENABLE(DRAG_SUPPORT)
-#include "DataTransfer.h"
-#endif
-
-#if PLATFORM(GTK)
-#include "Scrollbar.h"
-#endif
-
-namespace WebCore {
-
-// GTK+ must scroll horizontally if the mouse pointer is on top of the
-// horizontal scrollbar while scrolling with the wheel; we need to
-// add the deltas and ticks here so that this behavior is consistent
-// for styled scrollbars.
-bool EventHandler::shouldSwapScrollDirection(const HitTestResult& result, const PlatformWheelEvent& event) const
-{
-#if PLATFORM(GTK)
- FrameView* view = m_frame.view();
- Scrollbar* scrollbar = view ? view->scrollbarAtPoint(event.position()) : nullptr;
- if (!scrollbar)
- scrollbar = result.scrollbar();
- if (!scrollbar)
- return false;
-
- // The directions are already swapped when shift key is pressed, but when scrolling
- // over scrollbars we always want to follow the scrollbar direction.
- return scrollbar->orientation() == HorizontalScrollbar ? !event.shiftKey() : event.shiftKey();
-#else
- UNUSED_PARAM(result);
- UNUSED_PARAM(event);
- notImplemented();
- return false;
-#endif
-}
-
-}
Modified: trunk/Source/WebKit/ChangeLog (265137 => 265138)
--- trunk/Source/WebKit/ChangeLog 2020-07-31 09:00:54 UTC (rev 265137)
+++ trunk/Source/WebKit/ChangeLog 2020-07-31 10:57:19 UTC (rev 265138)
@@ -1,3 +1,31 @@
+2020-07-31 Carlos Garcia Campos <[email protected]>
+
+ [GTK] Mouse wheel events on horizontal scrollbar not correctly handled when AC mode is forced
+ https://bugs.webkit.org/show_bug.cgi?id=207113
+
+ Reviewed by Adrian Perez de Castro.
+
+ Move the direction swap to the UI process before passing the event to the web
+ process. WebHitTestResultData::isScrollbar is now an enum with values No, Verttical, Horizontal. When a wheel
+ event is received in the widget we check whether we should invert the direction or not.
+
+ * Shared/API/glib/WebKitHitTestResult.cpp:
+ (webkitHitTestResultCreate):
+ (webkitHitTestResultCompare):
+ * Shared/WebHitTestResultData.cpp:
+ (WebKit::WebHitTestResultData::WebHitTestResultData):
+ * Shared/WebHitTestResultData.h:
+ * UIProcess/API/APIHitTestResult.h:
+ (API::HitTestResult::isScrollbar const):
+ * UIProcess/API/glib/WebKitWebView.cpp:
+ (webkitWebViewMouseTargetChanged):
+ * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+ (shouldInvertDirectionForScrollEvent):
+ (webkitWebViewBaseScrollEvent):
+ (webkitWebViewBaseScroll):
+ (webkitWebViewBaseSetMouseIsOverScrollbar):
+ * UIProcess/API/gtk/WebKitWebViewBasePrivate.h:
+
2020-07-30 Alex Christensen <[email protected]>
Optimize WebsiteDataStoreConfiguration::copy
Modified: trunk/Source/WebKit/Shared/API/glib/WebKitHitTestResult.cpp (265137 => 265138)
--- trunk/Source/WebKit/Shared/API/glib/WebKitHitTestResult.cpp 2020-07-31 09:00:54 UTC (rev 265137)
+++ trunk/Source/WebKit/Shared/API/glib/WebKitHitTestResult.cpp 2020-07-31 10:57:19 UTC (rev 265138)
@@ -238,7 +238,7 @@
if (hitTestResult.isContentEditable)
context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE;
- if (hitTestResult.isScrollbar)
+ if (hitTestResult.isScrollbar != WebHitTestResultData::IsScrollbar::No)
context |= WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR;
if (hitTestResult.isSelected)
@@ -262,8 +262,9 @@
bool webkitHitTestResultCompare(WebKitHitTestResult* hitTestResult, const WebHitTestResultData& webHitTestResult)
{
WebKitHitTestResultPrivate* priv = hitTestResult->priv;
+ bool isScrollbar = webHitTestResult.isScrollbar != WebHitTestResultData::IsScrollbar::No;
return webHitTestResult.isContentEditable == webkit_hit_test_result_context_is_editable(hitTestResult)
- && webHitTestResult.isScrollbar == webkit_hit_test_result_context_is_scrollbar(hitTestResult)
+ && isScrollbar == webkit_hit_test_result_context_is_scrollbar(hitTestResult)
&& webHitTestResult.isSelected == webkit_hit_test_result_context_is_selection(hitTestResult)
&& stringIsEqualToCString(webHitTestResult.absoluteLinkURL, priv->linkURI)
&& stringIsEqualToCString(webHitTestResult.linkTitle, priv->linkTitle)
Modified: trunk/Source/WebKit/Shared/WebHitTestResultData.cpp (265137 => 265138)
--- trunk/Source/WebKit/Shared/WebHitTestResultData.cpp 2020-07-31 09:00:54 UTC (rev 265137)
+++ trunk/Source/WebKit/Shared/WebHitTestResultData.cpp 2020-07-31 10:57:19 UTC (rev 265138)
@@ -48,7 +48,7 @@
, linkSuggestedFilename(hitTestResult.linkSuggestedFilename())
, isContentEditable(hitTestResult.isContentEditable())
, elementBoundingBox(elementBoundingBoxInWindowCoordinates(hitTestResult))
- , isScrollbar(hitTestResult.scrollbar())
+ , isScrollbar(IsScrollbar::No)
, isSelected(hitTestResult.isSelected())
, isTextNode(hitTestResult.innerNode() && hitTestResult.innerNode()->isTextNode())
, isOverTextInsideFormControlElement(hitTestResult.isOverTextInsideFormControlElement())
@@ -56,6 +56,8 @@
, toolTipText(toolTipText)
, imageSize(0)
{
+ if (auto* scrollbar = hitTestResult.scrollbar())
+ isScrollbar = scrollbar->orientation() == HorizontalScrollbar ? IsScrollbar::Horizontal : IsScrollbar::Vertical;
}
WebHitTestResultData::WebHitTestResultData(const WebCore::HitTestResult& hitTestResult, bool includeImage)
@@ -68,7 +70,7 @@
, linkSuggestedFilename(hitTestResult.linkSuggestedFilename())
, isContentEditable(hitTestResult.isContentEditable())
, elementBoundingBox(elementBoundingBoxInWindowCoordinates(hitTestResult))
- , isScrollbar(hitTestResult.scrollbar())
+ , isScrollbar(IsScrollbar::No)
, isSelected(hitTestResult.isSelected())
, isTextNode(hitTestResult.innerNode() && hitTestResult.innerNode()->isTextNode())
, isOverTextInsideFormControlElement(hitTestResult.isOverTextInsideFormControlElement())
@@ -75,6 +77,9 @@
, isDownloadableMedia(hitTestResult.isDownloadableMedia())
, imageSize(0)
{
+ if (auto* scrollbar = hitTestResult.scrollbar())
+ isScrollbar = scrollbar->orientation() == HorizontalScrollbar ? IsScrollbar::Horizontal : IsScrollbar::Vertical;
+
if (!includeImage)
return;
Modified: trunk/Source/WebKit/Shared/WebHitTestResultData.h (265137 => 265138)
--- trunk/Source/WebKit/Shared/WebHitTestResultData.h 2020-07-31 09:00:54 UTC (rev 265137)
+++ trunk/Source/WebKit/Shared/WebHitTestResultData.h 2020-07-31 10:57:19 UTC (rev 265138)
@@ -17,8 +17,7 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef WebHitTestResultData_h
-#define WebHitTestResultData_h
+#pragma once
#include "APIObject.h"
#include "SharedMemory.h"
@@ -26,6 +25,7 @@
#include <WebCore/FloatPoint.h>
#include <WebCore/IntRect.h>
#include <WebCore/PageOverlay.h>
+#include <wtf/EnumTraits.h>
#include <wtf/Forward.h>
#include <wtf/RefPtr.h>
#include <wtf/text/WTFString.h>
@@ -53,7 +53,8 @@
String linkSuggestedFilename;
bool isContentEditable;
WebCore::IntRect elementBoundingBox;
- bool isScrollbar;
+ enum class IsScrollbar { No, Vertical, Horizontal };
+ IsScrollbar isScrollbar;
bool isSelected;
bool isTextNode;
bool isOverTextInsideFormControlElement;
@@ -90,4 +91,15 @@
} // namespace WebKit
-#endif // WebHitTestResultData_h
+namespace WTF {
+
+template<> struct EnumTraits<WebKit::WebHitTestResultData::IsScrollbar> {
+ using values = EnumValues<
+ WebKit::WebHitTestResultData::IsScrollbar,
+ WebKit::WebHitTestResultData::IsScrollbar::No,
+ WebKit::WebHitTestResultData::IsScrollbar::Vertical,
+ WebKit::WebHitTestResultData::IsScrollbar::Horizontal
+ >;
+};
+
+} // namespace WTF
Modified: trunk/Source/WebKit/UIProcess/API/APIHitTestResult.h (265137 => 265138)
--- trunk/Source/WebKit/UIProcess/API/APIHitTestResult.h 2020-07-31 09:00:54 UTC (rev 265137)
+++ trunk/Source/WebKit/UIProcess/API/APIHitTestResult.h 2020-07-31 10:57:19 UTC (rev 265138)
@@ -62,7 +62,7 @@
WebCore::IntRect elementBoundingBox() const { return m_data.elementBoundingBox; }
- bool isScrollbar() const { return m_data.isScrollbar; }
+ bool isScrollbar() const { return m_data.isScrollbar != WebKit::WebHitTestResultData::IsScrollbar::No; }
bool isSelected() const { return m_data.isSelected; }
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp (265137 => 265138)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp 2020-07-31 09:00:54 UTC (rev 265137)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp 2020-07-31 10:57:19 UTC (rev 265138)
@@ -2565,6 +2565,7 @@
{
#if PLATFORM(GTK)
webkitWebViewBaseSetTooltipArea(WEBKIT_WEB_VIEW_BASE(webView), hitTestResult.elementBoundingBox);
+ webkitWebViewBaseSetMouseIsOverScrollbar(WEBKIT_WEB_VIEW_BASE(webView), hitTestResult.isScrollbar);
#endif
WebKitWebViewPrivate* priv = webView->priv;
Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp (265137 => 265138)
--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp 2020-07-31 09:00:54 UTC (rev 265137)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp 2020-07-31 10:57:19 UTC (rev 265138)
@@ -268,6 +268,7 @@
#endif
CString tooltipText;
IntRect tooltipArea;
+ WebHitTestResultData::IsScrollbar mouseIsOverScrollbar;
GRefPtr<AtkObject> accessible;
GtkWidget* dialog { nullptr };
GtkWidget* inspectorView { nullptr };
@@ -1207,6 +1208,21 @@
}
#endif
+static bool shouldInvertDirectionForScrollEvent(WebHitTestResultData::IsScrollbar isScrollbar, bool isShiftPressed)
+{
+ // Shift+Wheel scrolls in the perpendicular direction, unless we are over a scrollbar
+ // in which case we always want to follow the scrollbar direction.
+ switch (isScrollbar) {
+ case WebHitTestResultData::IsScrollbar::No:
+ return isShiftPressed;
+ case WebHitTestResultData::IsScrollbar::Horizontal:
+ return true;
+ case WebHitTestResultData::IsScrollbar::Vertical:
+ return false;
+ }
+ RELEASE_ASSERT_NOT_REACHED();
+}
+
#if !USE(GTK4)
static void webkitWebViewBaseHandleWheelEvent(WebKitWebViewBase* webViewBase, GdkEvent* event, Optional<WebWheelEvent::Phase> phase = WTF::nullopt, Optional<WebWheelEvent::Phase> momentum = WTF::nullopt)
{
@@ -1233,8 +1249,7 @@
if (priv->dialog)
return GDK_EVENT_PROPAGATE;
- // Shift+Wheel scrolls in the perpendicular direction.
- if (event->state & GDK_SHIFT_MASK) {
+ if (shouldInvertDirectionForScrollEvent(priv->mouseIsOverScrollbar, event->state & GDK_SHIFT_MASK)) {
switch (event->direction) {
case GDK_SCROLL_UP:
event->direction = GDK_SCROLL_LEFT;
@@ -1269,8 +1284,7 @@
auto* event = gtk_event_controller_get_current_event(controller);
- // Shift+Wheel scrolls in the perpendicular direction.
- if (gdk_event_get_modifier_state(event) & GDK_SHIFT_MASK)
+ if (shouldInvertDirectionForScrollEvent(priv->mouseIsOverScrollbar, gdk_event_get_modifier_state(event) & GDK_SHIFT_MASK))
std::swap(deltaX, deltaY);
priv->pageProxy->handleWheelEvent(NativeWebWheelEvent(event, priv->lastMotionEvent ? IntPoint(priv->lastMotionEvent->position) : IntPoint(), FloatSize(-deltaX, -deltaY)));
@@ -2066,6 +2080,11 @@
webViewBase->priv->tooltipArea = tooltipArea;
}
+void webkitWebViewBaseSetMouseIsOverScrollbar(WebKitWebViewBase* webViewBase, WebHitTestResultData::IsScrollbar isScrollbar)
+{
+ webViewBase->priv->mouseIsOverScrollbar = isScrollbar;
+}
+
#if ENABLE(DRAG_SUPPORT)
void webkitWebViewBaseStartDrag(WebKitWebViewBase* webViewBase, SelectionData&& selectionData, OptionSet<DragOperation> dragOperationMask, RefPtr<ShareableBitmap>&& image)
{
Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h (265137 => 265138)
--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h 2020-07-31 09:00:54 UTC (rev 265137)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewBasePrivate.h 2020-07-31 10:57:19 UTC (rev 265138)
@@ -35,6 +35,7 @@
#include "ViewGestureController.h"
#include "ViewSnapshotStore.h"
#include "WebContextMenuProxyGtk.h"
+#include "WebHitTestResultData.h"
#include "WebInspectorProxy.h"
#include "WebKitInputMethodContext.h"
#include "WebKitWebViewBase.h"
@@ -48,6 +49,7 @@
void webkitWebViewBaseCreateWebPage(WebKitWebViewBase*, Ref<API::PageConfiguration>&&);
void webkitWebViewBaseSetTooltipText(WebKitWebViewBase*, const char*);
void webkitWebViewBaseSetTooltipArea(WebKitWebViewBase*, const WebCore::IntRect&);
+void webkitWebViewBaseSetMouseIsOverScrollbar(WebKitWebViewBase*, WebKit::WebHitTestResultData::IsScrollbar);
void webkitWebViewBaseForwardNextKeyEvent(WebKitWebViewBase*);
void webkitWebViewBaseForwardNextWheelEvent(WebKitWebViewBase*);
void webkitWebViewBaseChildMoveResize(WebKitWebViewBase*, GtkWidget*, const WebCore::IntRect&);