Summary: | [GTK] The Previous/Next gesture should handle RTL | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Adrien Plazas <kekun.plazas> | ||||
Component: | WebKitGTK | Assignee: | Nobody <webkit-unassigned> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | alicem, berto, bugs-noreply, cgarcia, commit-queue, ews-watchlist, gustavo, kekun.plazas, mcatanzaro | ||||
Priority: | P2 | ||||||
Version: | Other | ||||||
Hardware: | Unspecified | ||||||
OS: | Linux | ||||||
Attachments: |
|
Description
Adrien Plazas
2019-06-09 23:40:00 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. 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. Created attachment 372552 [details]
Patch
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 (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; } Next time, I should read your patch *before* wasting time investigating the problem you've already solved. :) Comment on attachment 372552 [details]
Patch
This could improve a bunch of layout test results. I suppose we'll find out.
Comment on attachment 372552 [details] Patch Clearing flags on attachment: 372552 Committed r246635: <https://trac.webkit.org/changeset/246635> All reviewed patches have been landed. Closing bug. |