WebKit Bugzilla
Attachment 372552 Details for
Bug 198707
: [GTK] The Previous/Next gesture should handle RTL
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198707-20190620191824.patch (text/plain), 6.35 KB, created by
Alice Mikhaylenko
on 2019-06-20 07:18:26 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alice Mikhaylenko
Created:
2019-06-20 07:18:26 PDT
Size:
6.35 KB
patch
obsolete
>Subversion Revision: 246598 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index ca245beb3969c159e67e518c551b78c24a8ae48a..238ac99c4a10b74b966077ca90f637fe1d44372b 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,20 @@ >+2019-06-20 Alexander Mikhaylenko <exalm7659@gmail.com> >+ >+ [GTK] The Previous/Next gesture should handle RTL >+ https://bugs.webkit.org/show_bug.cgi?id=198707 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ The gesture uses PageClientImpl::userInterfaceLayoutDirection() to determine the text >+ direction. Implement that method, then adjust drawing so that the pages move from/to >+ the left instead of right side for RTL locales. >+ >+ * UIProcess/API/gtk/PageClientImpl.cpp: >+ (WebKit::): Implemented. >+ * UIProcess/API/gtk/PageClientImpl.h: >+ * UIProcess/gtk/ViewGestureControllerGtk.cpp: >+ (WebKit::ViewGestureController::draw): >+ > 2019-06-19 Alex Christensen <achristensen@webkit.org> > > Update preview API deprecation message. >diff --git a/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp b/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp >index d7f9f99e4520a82aea0c3a95ef991f60d694a427..6482298f37b1396173de83b0ec2c955c142c8521 100644 >--- a/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp >+++ b/Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp >@@ -538,6 +538,15 @@ void PageClientImpl::requestDOMPasteAccess(const IntRect&, const String&, Comple > completionHandler(WebCore::DOMPasteAccessResponse::DeniedForGesture); > } > >+UserInterfaceLayoutDirection PageClientImpl::userInterfaceLayoutDirection() >+{ >+ GtkTextDirection direction = gtk_widget_get_direction(m_viewWidget); >+ if (direction == GTK_TEXT_DIR_RTL) >+ return UserInterfaceLayoutDirection::RTL; >+ >+ return UserInterfaceLayoutDirection::LTR; >+} >+ > bool PageClientImpl::effectiveAppearanceIsDark() const > { > auto* settings = gtk_widget_get_settings(m_viewWidget); >diff --git a/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h b/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h >index 9af1e84809840a7b2afa7ca41bfe1d7f343a9fb9..558281116c556d28ff28e70cdc3064d6247e43c2 100644 >--- a/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h >+++ b/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h >@@ -161,7 +161,7 @@ private: > bool decidePolicyForInstallMissingMediaPluginsPermissionRequest(InstallMissingMediaPluginsPermissionRequest&) override; > #endif > >- WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override { return WebCore::UserInterfaceLayoutDirection::LTR; } >+ WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override; > > bool effectiveAppearanceIsDark() const override; > >diff --git a/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp b/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp >index 9d0ba2205c704fd42a39d7b4ce974e88cd9a56c9..597cea1917938fdf7cdca749fd0601d487a01a29 100644 >--- a/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp >+++ b/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp >@@ -328,6 +328,8 @@ void ViewGestureController::handleSwipeGesture(WebBackForwardListItem*, double, > void ViewGestureController::draw(cairo_t* cr, cairo_pattern_t* pageGroup) > { > bool swipingLeft = isPhysicallySwipingLeft(m_swipeProgressTracker.direction()); >+ bool swipingBack = m_swipeProgressTracker.direction() == SwipeDirection::Back; >+ bool isRTL = m_webPageProxy.userInterfaceLayoutDirection() == WebCore::UserInterfaceLayoutDirection::RTL; > float progress = m_swipeProgressTracker.progress(); > > double width = m_webPageProxy.drawingArea()->size().width(); >@@ -336,6 +338,8 @@ void ViewGestureController::draw(cairo_t* cr, cairo_pattern_t* pageGroup) > double swipingLayerOffset = (swipingLeft ? 0 : width) + floor(width * progress); > > double dimmingProgress = swipingLeft ? 1 - progress : -progress; >+ if (isRTL) >+ dimmingProgress = 1 - dimmingProgress; > > double remainingSwipeDistance = dimmingProgress * width; > double shadowFadeDistance = swipeOverlayShadowWidth; >@@ -344,7 +348,7 @@ void ViewGestureController::draw(cairo_t* cr, cairo_pattern_t* pageGroup) > if (remainingSwipeDistance < shadowFadeDistance) > shadowOpacity = (remainingSwipeDistance / shadowFadeDistance) * swipeOverlayShadowOpacity; > >- RefPtr<cairo_pattern_t> shadowPattern = adoptRef(cairo_pattern_create_linear(0, 0, -swipeOverlayShadowWidth, 0)); >+ RefPtr<cairo_pattern_t> shadowPattern = adoptRef(cairo_pattern_create_linear(0, 0, swipeOverlayShadowWidth, 0)); > for (int i = 0; i < 16; i++) { > double offset = swipeOverlayShadowGradientOffsets[i]; > double alpha = swipeOverlayShadowGradientAlpha[i] * shadowOpacity; >@@ -353,8 +357,11 @@ void ViewGestureController::draw(cairo_t* cr, cairo_pattern_t* pageGroup) > > cairo_save(cr); > >- cairo_rectangle(cr, 0, 0, swipingLayerOffset, height); >- cairo_set_source(cr, swipingLeft ? m_currentSwipeSnapshotPattern.get() : pageGroup); >+ if (isRTL) >+ cairo_rectangle(cr, swipingLayerOffset, 0, width - swipingLayerOffset, height); >+ else >+ cairo_rectangle(cr, 0, 0, swipingLayerOffset, height); >+ cairo_set_source(cr, swipingBack ? m_currentSwipeSnapshotPattern.get() : pageGroup); > cairo_fill_preserve(cr); > > cairo_set_source_rgba(cr, 0, 0, 0, dimmingProgress * swipeOverlayDimmingOpacity); >@@ -363,13 +370,21 @@ void ViewGestureController::draw(cairo_t* cr, cairo_pattern_t* pageGroup) > cairo_translate(cr, swipingLayerOffset, 0); > > if (progress) { >- cairo_rectangle(cr, -swipeOverlayShadowWidth, 0, swipeOverlayShadowWidth, height); >+ cairo_save(cr); >+ if (!isRTL) >+ cairo_scale(cr, -1, 1); >+ cairo_rectangle(cr, 0, 0, swipeOverlayShadowWidth, height); > cairo_set_source(cr, shadowPattern.get()); > cairo_fill(cr); >+ cairo_restore(cr); > } > >- cairo_rectangle(cr, 0, 0, width - swipingLayerOffset, height); >- cairo_set_source(cr, swipingLeft ? pageGroup : m_currentSwipeSnapshotPattern.get()); >+ if (isRTL) { >+ cairo_translate(cr, -width, 0); >+ cairo_rectangle(cr, width - swipingLayerOffset, 0, swipingLayerOffset, height); >+ } else >+ cairo_rectangle(cr, 0, 0, width - swipingLayerOffset, height); >+ cairo_set_source(cr, swipingBack ? pageGroup : m_currentSwipeSnapshotPattern.get()); > cairo_fill(cr); > > cairo_restore(cr);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198707
: 372552