RESOLVED FIXED198707
[GTK] The Previous/Next gesture should handle RTL
https://bugs.webkit.org/show_bug.cgi?id=198707
Summary [GTK] The Previous/Next gesture should handle RTL
Adrien Plazas
Reported 2019-06-09 23:40:00 PDT
The Previous/Next gesture (two-fingers horizontal drag) should be inversed on RTL languages, as the newer page should move to/come from the left instead of the right. This affects GNOME Web: https://gitlab.gnome.org/GNOME/epiphany/issues/820.
Attachments
Patch (6.35 KB, patch)
2019-06-20 07:18 PDT, Alice Mikhaylenko
no flags
Alice Mikhaylenko
Comment 1 2019-06-20 02:28:14 PDT
Hm, it looks like WebKit in general doesn't support at least GtkInspector's text direction override. Scrollbars are still on the right, for example.
Alice Mikhaylenko
Comment 2 2019-06-20 02:47:40 PDT
Nevermind, it seems to be flipped for RTL pages only. However, `m_webPageProxy.userInterfaceLayoutDirection()` seems to always return LTR direction, which is why it doesn't work. I wonder if it would work with an actual RTL locale. Other than that, I need to adjust `ViewGestureController::PendingSwipeTracker::scrollEventGetScrollingDeltas()` and drawing. The pages comes from the correct side, but the order is reversed: the current page is on the bottom when you're going back, and on the top if you're going forward. It should be the other way.
Alice Mikhaylenko
Comment 3 2019-06-20 07:18:26 PDT
EWS Watchlist
Comment 4 2019-06-20 07:22:04 PDT
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See http://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Michael Catanzaro
Comment 5 2019-06-20 07:32:50 PDT
(In reply to Alexander Mikhaylenko from comment #2) > Nevermind, it seems to be flipped for RTL pages only. > > However, `m_webPageProxy.userInterfaceLayoutDirection()` seems to always > return LTR direction, which is why it doesn't work. > > I wonder if it would work with an actual RTL locale. Currently we have this in our PageClientImpl.h: WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override { return WebCore::UserInterfaceLayoutDirection::LTR; } Something like this in our PageClientImpl.cpp would probably suffice: WebCore::UserInterfaceLayoutDirection PageClientImpl::userInterfaceLayoutDirection() { return gtk_widget_get_direction(m_viewWidget) == GTK_TEXT_DIR_RTL ? WebCore::UserInterfaceLayoutDirection::RTL : WebCore::UserInterfaceLayoutDirection::LTR; }
Michael Catanzaro
Comment 6 2019-06-20 07:33:23 PDT
Next time, I should read your patch *before* wasting time investigating the problem you've already solved. :)
Michael Catanzaro
Comment 7 2019-06-20 07:34:50 PDT
Comment on attachment 372552 [details] Patch This could improve a bunch of layout test results. I suppose we'll find out.
WebKit Commit Bot
Comment 8 2019-06-20 08:55:58 PDT
Comment on attachment 372552 [details] Patch Clearing flags on attachment: 372552 Committed r246635: <https://trac.webkit.org/changeset/246635>
WebKit Commit Bot
Comment 9 2019-06-20 08:56:00 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.