<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[199695] trunk/Source/WebKit2</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/199695">199695</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2016-04-18 16:00:29 -0700 (Mon, 18 Apr 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Swipe view gesture should be reversed in right-to-left contexts
https://bugs.webkit.org/show_bug.cgi?id=156714

Reviewed by Anders Carlsson.

* UIProcess/API/gtk/PageClientImpl.h:
* UIProcess/PageClient.h:
* UIProcess/UserInterfaceLayoutDirection.h: Added.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::userInterfaceLayoutDirection):
* UIProcess/WebPageProxy.h:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::userInterfaceLayoutDirection):
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::userInterfaceLayoutDirection):
Plumb RTL-ness through to WebPageProxy.
We look at the WK(Web)View's UI layout direction.
For other platforms, we just assume LTR.

* UIProcess/mac/ViewGestureController.h:
* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanBecomeSwipe):
Decide which way to swipe (and which way to look for back-forward items)
based on the WebPageProxy's reported RTLness.

(WebKit::ViewGestureController::isPhysicallySwipingLeft):
&quot;Back&quot; means &quot;swiping left&quot; in LTR and &quot;swiping right&quot; in RTL.

(WebKit::ViewGestureController::trackSwipeGesture):
(WebKit::ViewGestureController::determineLayerAdjacentToSnapshotForParent):
(WebKit::ViewGestureController::beginSwipeGesture):
(WebKit::ViewGestureController::handleSwipeGesture):
Make things that were equating &quot;back&quot; with &quot;left&quot; instead check isPhysicallySwipingLeft.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkPageClientImplh">trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessPageClienth">trunk/Source/WebKit2/UIProcess/PageClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcesseflWebViewh">trunk/Source/WebKit2/UIProcess/efl/WebView.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosPageClientImplIOSh">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosPageClientImplIOSmm">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplh">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplmm">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacViewGestureControllerh">trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacViewGestureControllerMacmm">trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessUserInterfaceLayoutDirectionh">trunk/Source/WebKit2/UIProcess/UserInterfaceLayoutDirection.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (199694 => 199695)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-04-18 22:59:31 UTC (rev 199694)
+++ trunk/Source/WebKit2/ChangeLog        2016-04-18 23:00:29 UTC (rev 199695)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2016-04-18  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
+        Swipe view gesture should be reversed in right-to-left contexts
+        https://bugs.webkit.org/show_bug.cgi?id=156714
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/API/gtk/PageClientImpl.h:
+        * UIProcess/PageClient.h:
+        * UIProcess/UserInterfaceLayoutDirection.h: Added.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::userInterfaceLayoutDirection):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::userInterfaceLayoutDirection):
+        * UIProcess/mac/PageClientImpl.h:
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::userInterfaceLayoutDirection):
+        Plumb RTL-ness through to WebPageProxy.
+        We look at the WK(Web)View's UI layout direction.
+        For other platforms, we just assume LTR.
+
+        * UIProcess/mac/ViewGestureController.h:
+        * UIProcess/mac/ViewGestureControllerMac.mm:
+        (WebKit::ViewGestureController::PendingSwipeTracker::scrollEventCanBecomeSwipe):
+        Decide which way to swipe (and which way to look for back-forward items)
+        based on the WebPageProxy's reported RTLness.
+
+        (WebKit::ViewGestureController::isPhysicallySwipingLeft):
+        &quot;Back&quot; means &quot;swiping left&quot; in LTR and &quot;swiping right&quot; in RTL.
+
+        (WebKit::ViewGestureController::trackSwipeGesture):
+        (WebKit::ViewGestureController::determineLayerAdjacentToSnapshotForParent):
+        (WebKit::ViewGestureController::beginSwipeGesture):
+        (WebKit::ViewGestureController::handleSwipeGesture):
+        Make things that were equating &quot;back&quot; with &quot;left&quot; instead check isPhysicallySwipingLeft.
+
</ins><span class="cx"> 2016-04-18  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix build with newer versions of clang.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkPageClientImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h (199694 => 199695)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h        2016-04-18 22:59:31 UTC (rev 199694)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/PageClientImpl.h        2016-04-18 23:00:29 UTC (rev 199695)
</span><span class="lines">@@ -142,6 +142,8 @@
</span><span class="cx">     bool decidePolicyForInstallMissingMediaPluginsPermissionRequest(InstallMissingMediaPluginsPermissionRequest&amp;) override;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    UserInterfaceLayoutDirection userInterfaceLayoutDirection() override { return UserInterfaceLayoutDirection::LTR; }
+
</ins><span class="cx">     // Members of PageClientImpl class
</span><span class="cx">     GtkWidget* m_viewWidget;
</span><span class="cx">     DefaultUndoController m_undoController;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (199694 => 199695)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/PageClient.h        2016-04-18 22:59:31 UTC (rev 199694)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h        2016-04-18 23:00:29 UTC (rev 199695)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #define PageClient_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ShareableBitmap.h&quot;
</span><ins>+#include &quot;UserInterfaceLayoutDirection.h&quot;
</ins><span class="cx"> #include &quot;WebColorPicker.h&quot;
</span><span class="cx"> #include &quot;WebPageProxy.h&quot;
</span><span class="cx"> #include &quot;WebPopupMenuProxy.h&quot;
</span><span class="lines">@@ -363,6 +364,8 @@
</span><span class="cx">     virtual void didRestoreScrollPosition() = 0;
</span><span class="cx"> 
</span><span class="cx">     virtual bool windowIsFrontWindowUnderMouse(const NativeWebMouseEvent&amp;) { return false; }
</span><ins>+
+    virtual UserInterfaceLayoutDirection userInterfaceLayoutDirection() = 0;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessUserInterfaceLayoutDirectionh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/UserInterfaceLayoutDirection.h (0 => 199695)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/UserInterfaceLayoutDirection.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/UserInterfaceLayoutDirection.h        2016-04-18 23:00:29 UTC (rev 199695)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+#ifndef UserInterfaceLayoutDirection_h
+#define UserInterfaceLayoutDirection_h
+
+namespace WebKit {
+
+enum class UserInterfaceLayoutDirection { LTR, RTL };
+
+} // namespace WebKit
+
+#endif // UserInterfaceLayoutDirection_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (199694 => 199695)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2016-04-18 22:59:31 UTC (rev 199694)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2016-04-18 23:00:29 UTC (rev 199695)
</span><span class="lines">@@ -6275,4 +6275,9 @@
</span><span class="cx">     m_process-&gt;send(Messages::WebPage::SetResourceCachingDisabled(disabled), m_pageID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+UserInterfaceLayoutDirection WebPageProxy::userInterfaceLayoutDirection()
+{
+    return m_pageClient.userInterfaceLayoutDirection();
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (199694 => 199695)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2016-04-18 22:59:31 UTC (rev 199694)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2016-04-18 23:00:29 UTC (rev 199695)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx"> #include &quot;ProcessThrottler.h&quot;
</span><span class="cx"> #include &quot;SandboxExtension.h&quot;
</span><span class="cx"> #include &quot;ShareableBitmap.h&quot;
</span><ins>+#include &quot;UserInterfaceLayoutDirection.h&quot;
</ins><span class="cx"> #include &quot;UserMediaPermissionRequestManagerProxy.h&quot;
</span><span class="cx"> #include &quot;VisibleContentRectUpdateInfo.h&quot;
</span><span class="cx"> #include &quot;WKBase.h&quot;
</span><span class="lines">@@ -1104,6 +1105,8 @@
</span><span class="cx">     bool isResourceCachingDisabled() const { return m_isResourceCachingDisabled; }
</span><span class="cx">     void setResourceCachingDisabled(bool);
</span><span class="cx"> 
</span><ins>+    UserInterfaceLayoutDirection userInterfaceLayoutDirection();
+
</ins><span class="cx"> private:
</span><span class="cx">     WebPageProxy(PageClient&amp;, WebProcessProxy&amp;, uint64_t pageID, Ref&lt;API::PageConfiguration&gt;&amp;&amp;);
</span><span class="cx">     void platformInitialize();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcesseflWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/efl/WebView.h (199694 => 199695)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/efl/WebView.h        2016-04-18 22:59:31 UTC (rev 199694)
+++ trunk/Source/WebKit2/UIProcess/efl/WebView.h        2016-04-18 23:00:29 UTC (rev 199695)
</span><span class="lines">@@ -261,6 +261,8 @@
</span><span class="cx">     void beganExitFullScreen(const WebCore::IntRect&amp;, const WebCore::IntRect&amp;) override { }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    UserInterfaceLayoutDirection userInterfaceLayoutDirection() override { return UserInterfaceLayoutDirection::LTR; }
+
</ins><span class="cx">     EwkView* m_ewkView;
</span><span class="cx"> 
</span><span class="cx">     WebViewClient m_client;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (199694 => 199695)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2016-04-18 22:59:31 UTC (rev 199694)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2016-04-18 23:00:29 UTC (rev 199695)
</span><span class="lines">@@ -193,6 +193,8 @@
</span><span class="cx"> 
</span><span class="cx">     void didRestoreScrollPosition() override;
</span><span class="cx"> 
</span><ins>+    UserInterfaceLayoutDirection userInterfaceLayoutDirection() override;
+
</ins><span class="cx">     WKContentView *m_contentView;
</span><span class="cx">     WKWebView *m_webView;
</span><span class="cx">     RetainPtr&lt;WKEditorUndoTargetObjC&gt; m_undoTarget;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (199694 => 199695)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2016-04-18 22:59:31 UTC (rev 199694)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2016-04-18 23:00:29 UTC (rev 199695)
</span><span class="lines">@@ -747,6 +747,13 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+UserInterfaceLayoutDirection PageClientImpl::userInterfaceLayoutDirection()
+{
+    if (!m_webView)
+        return UserInterfaceLayoutDirection::LTR;
+    return ([UIView userInterfaceLayoutDirectionForSemanticContentAttribute:[m_webView semanticContentAttribute]] == UIUserInterfaceLayoutDirectionLeftToRight) ? UserInterfaceLayoutDirection::LTR : UserInterfaceLayoutDirection::RTL;
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (199694 => 199695)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2016-04-18 22:59:31 UTC (rev 199694)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2016-04-18 23:00:29 UTC (rev 199695)
</span><span class="lines">@@ -220,6 +220,8 @@
</span><span class="cx">     void startWindowDrag() override;
</span><span class="cx">     NSWindow *platformWindow() override;
</span><span class="cx"> 
</span><ins>+    UserInterfaceLayoutDirection userInterfaceLayoutDirection() override;
+
</ins><span class="cx"> #if WK_API_ENABLED
</span><span class="cx">     NSView *inspectorAttachmentView() override;
</span><span class="cx">     _WKRemoteObjectRegistry *remoteObjectRegistry() override;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (199694 => 199695)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2016-04-18 22:59:31 UTC (rev 199694)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2016-04-18 23:00:29 UTC (rev 199695)
</span><span class="lines">@@ -840,6 +840,13 @@
</span><span class="cx">     return m_impl-&gt;windowIsFrontWindowUnderMouse(event.nativeEvent());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+UserInterfaceLayoutDirection PageClientImpl::userInterfaceLayoutDirection()
+{
+    if (!m_view)
+        return UserInterfaceLayoutDirection::LTR;
+    return (m_view.userInterfaceLayoutDirection == NSUserInterfaceLayoutDirectionLeftToRight) ? UserInterfaceLayoutDirection::LTR : UserInterfaceLayoutDirection::RTL;
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(MAC)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacViewGestureControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h (199694 => 199695)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h        2016-04-18 22:59:31 UTC (rev 199694)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h        2016-04-18 23:00:29 UTC (rev 199695)
</span><span class="lines">@@ -109,6 +109,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool shouldIgnorePinnedState() { return m_pendingSwipeTracker.shouldIgnorePinnedState(); }
</span><span class="cx">     void setShouldIgnorePinnedState(bool ignore) { m_pendingSwipeTracker.setShouldIgnorePinnedState(ignore); }
</span><ins>+
+    bool isPhysicallySwipingLeft(SwipeDirection) const;
</ins><span class="cx"> #else
</span><span class="cx">     void installSwipeHandler(UIView *gestureRecognizerView, UIView *swipingView);
</span><span class="cx">     void setAlternateBackForwardListSourceView(WKWebView *);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacViewGestureControllerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm (199694 => 199695)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm        2016-04-18 22:59:31 UTC (rev 199694)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm        2016-04-18 23:00:29 UTC (rev 199695)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #import &quot;FrameLoadState.h&quot;
</span><span class="cx"> #import &quot;Logging.h&quot;
</span><span class="cx"> #import &quot;NativeWebWheelEvent.h&quot;
</span><ins>+#import &quot;UserInterfaceLayoutDirection.h&quot;
</ins><span class="cx"> #import &quot;ViewGestureControllerMessages.h&quot;
</span><span class="cx"> #import &quot;ViewGestureGeometryCollectorMessages.h&quot;
</span><span class="cx"> #import &quot;ViewSnapshotStore.h&quot;
</span><span class="lines">@@ -297,12 +298,19 @@
</span><span class="cx">     bool isPinnedToLeft = m_shouldIgnorePinnedState || m_webPageProxy.isPinnedToLeftSide();
</span><span class="cx">     bool isPinnedToRight = m_shouldIgnorePinnedState || m_webPageProxy.isPinnedToRightSide();
</span><span class="cx"> 
</span><del>-    bool willSwipeLeft = event.scrollingDeltaX &gt; 0 &amp;&amp; isPinnedToLeft &amp;&amp; m_webPageProxy.backForwardList().backItem();
-    bool willSwipeRight = event.scrollingDeltaX &lt; 0 &amp;&amp; isPinnedToRight &amp;&amp; m_webPageProxy.backForwardList().forwardItem();
-    if (!willSwipeLeft &amp;&amp; !willSwipeRight)
</del><ins>+    bool willSwipeBack = false;
+    bool willSwipeForward = false;
+    if (m_webPageProxy.userInterfaceLayoutDirection() == UserInterfaceLayoutDirection::LTR) {
+        willSwipeBack = event.scrollingDeltaX &gt; 0 &amp;&amp; isPinnedToLeft &amp;&amp; m_webPageProxy.backForwardList().backItem();
+        willSwipeForward = event.scrollingDeltaX &lt; 0 &amp;&amp; isPinnedToRight &amp;&amp; m_webPageProxy.backForwardList().forwardItem();
+    } else {
+        willSwipeBack = event.scrollingDeltaX &lt; 0 &amp;&amp; isPinnedToRight &amp;&amp; m_webPageProxy.backForwardList().backItem();
+        willSwipeForward = event.scrollingDeltaX &gt; 0 &amp;&amp; isPinnedToLeft &amp;&amp; m_webPageProxy.backForwardList().forwardItem();
+    }
+    if (!willSwipeBack &amp;&amp; !willSwipeForward)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    potentialSwipeDirection = willSwipeLeft ? ViewGestureController::SwipeDirection::Back : ViewGestureController::SwipeDirection::Forward;
</del><ins>+    potentialSwipeDirection = willSwipeBack ? ViewGestureController::SwipeDirection::Back : ViewGestureController::SwipeDirection::Forward;
</ins><span class="cx"> 
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -394,8 +402,9 @@
</span><span class="cx"> 
</span><span class="cx">     m_webPageProxy.recordNavigationSnapshot();
</span><span class="cx"> 
</span><del>-    CGFloat maxProgress = (direction == SwipeDirection::Back) ? 1 : 0;
-    CGFloat minProgress = (direction == SwipeDirection::Forward) ? -1 : 0;
</del><ins>+    BOOL swipingLeft = isPhysicallySwipingLeft(direction);
+    CGFloat maxProgress = swipingLeft ? 1 : 0;
+    CGFloat minProgress = !swipingLeft ? -1 : 0;
</ins><span class="cx">     RefPtr&lt;WebBackForwardListItem&gt; targetItem = (direction == SwipeDirection::Back) ? m_webPageProxy.backForwardList().backItem() : m_webPageProxy.backForwardList().forwardItem();
</span><span class="cx">     if (!targetItem)
</span><span class="cx">         return;
</span><span class="lines">@@ -476,7 +485,7 @@
</span><span class="cx"> CALayer *ViewGestureController::determineLayerAdjacentToSnapshotForParent(SwipeDirection direction, CALayer *snapshotLayerParent) const
</span><span class="cx"> {
</span><span class="cx">     // If we have custom swiping views, we assume that the views were passed to us in back-to-front z-order.
</span><del>-    CALayer *layerAdjacentToSnapshot = direction == SwipeDirection::Back ? m_currentSwipeLiveLayers.first().get() : m_currentSwipeLiveLayers.last().get();
</del><ins>+    CALayer *layerAdjacentToSnapshot = isPhysicallySwipingLeft(direction) ? m_currentSwipeLiveLayers.first().get() : m_currentSwipeLiveLayers.last().get();
</ins><span class="cx"> 
</span><span class="cx">     if (m_currentSwipeLiveLayers.size() == 1)
</span><span class="cx">         return layerAdjacentToSnapshot;
</span><span class="lines">@@ -593,7 +602,8 @@
</span><span class="cx">         applyDebuggingPropertiesToSwipeViews();
</span><span class="cx"> 
</span><span class="cx">     CALayer *layerAdjacentToSnapshot = determineLayerAdjacentToSnapshotForParent(direction, snapshotLayerParent);
</span><del>-    if (direction == SwipeDirection::Back)
</del><ins>+    BOOL swipingLeft = isPhysicallySwipingLeft(direction);
+    if (swipingLeft)
</ins><span class="cx">         [snapshotLayerParent insertSublayer:m_swipeLayer.get() below:layerAdjacentToSnapshot];
</span><span class="cx">     else
</span><span class="cx">         [snapshotLayerParent insertSublayer:m_swipeLayer.get() above:layerAdjacentToSnapshot];
</span><span class="lines">@@ -657,7 +667,7 @@
</span><span class="cx">         [m_swipeShadowLayer setGeometryFlipped:geometryIsFlippedToRoot];
</span><span class="cx">         [m_swipeShadowLayer setDelegate:[WebActionDisablingCALayerDelegate shared]];
</span><span class="cx"> 
</span><del>-        if (direction == SwipeDirection::Back)
</del><ins>+        if (swipingLeft)
</ins><span class="cx">             [snapshotLayerParent insertSublayer:m_swipeDimmingLayer.get() above:m_swipeLayer.get()];
</span><span class="cx">         else
</span><span class="cx">             [snapshotLayerParent insertSublayer:m_swipeDimmingLayer.get() below:m_swipeLayer.get()];
</span><span class="lines">@@ -666,10 +676,19 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool ViewGestureController::isPhysicallySwipingLeft(SwipeDirection direction) const
+{
+    bool isLTR = m_webPageProxy.userInterfaceLayoutDirection() == UserInterfaceLayoutDirection::LTR;
+    bool isSwipingForward = direction == SwipeDirection::Forward;
+    return isLTR != isSwipingForward;
+}
+
</ins><span class="cx"> void ViewGestureController::handleSwipeGesture(WebBackForwardListItem* targetItem, double progress, SwipeDirection direction)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_activeGestureType == ViewGestureType::Swipe);
</span><span class="cx"> 
</span><ins>+    bool swipingLeft = isPhysicallySwipingLeft(direction);
+
</ins><span class="cx">     if (!m_webPageProxy.drawingArea())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -681,7 +700,7 @@
</span><span class="cx"> 
</span><span class="cx">     double swipingLayerOffset = floor(width * progress);
</span><span class="cx"> 
</span><del>-    double dimmingProgress = (direction == SwipeDirection::Back) ? 1 - progress : -progress;
</del><ins>+    double dimmingProgress = swipingLeft ? 1 - progress : -progress;
</ins><span class="cx">     dimmingProgress = std::min(1., std::max(dimmingProgress, 0.));
</span><span class="cx">     [m_swipeDimmingLayer setOpacity:dimmingProgress * swipeOverlayDimmingOpacity];
</span><span class="cx"> 
</span><span class="lines">@@ -694,19 +713,19 @@
</span><span class="cx">         [m_swipeShadowLayer setOpacity:swipeOverlayShadowOpacity];
</span><span class="cx"> 
</span><span class="cx">     if (m_swipeTransitionStyle == SwipeTransitionStyle::Overlap)
</span><del>-        [m_swipeShadowLayer setTransform:CATransform3DMakeTranslation((direction == SwipeDirection::Back ? 0 : width) + swipingLayerOffset, 0, 0)];
</del><ins>+        [m_swipeShadowLayer setTransform:CATransform3DMakeTranslation((swipingLeft ? 0 : width) + swipingLayerOffset, 0, 0)];
</ins><span class="cx"> 
</span><span class="cx">     if (m_swipeTransitionStyle == SwipeTransitionStyle::Overlap) {
</span><del>-        if (direction == SwipeDirection::Forward) {
</del><ins>+        if (!swipingLeft) {
</ins><span class="cx">             [m_swipeLayer setTransform:CATransform3DMakeTranslation(width + swipingLayerOffset, 0, 0)];
</span><span class="cx">             didMoveSwipeSnapshotLayer();
</span><span class="cx">         }
</span><span class="cx">     } else if (m_swipeTransitionStyle == SwipeTransitionStyle::Push)
</span><del>-        [m_swipeLayer setTransform:CATransform3DMakeTranslation((direction == SwipeDirection::Back ? -width : width) + swipingLayerOffset, 0, 0)];
</del><ins>+        [m_swipeLayer setTransform:CATransform3DMakeTranslation((swipingLeft ? -width : width) + swipingLayerOffset, 0, 0)];
</ins><span class="cx"> 
</span><span class="cx">     for (const auto&amp; layer : m_currentSwipeLiveLayers) {
</span><span class="cx">         if (m_swipeTransitionStyle == SwipeTransitionStyle::Overlap) {
</span><del>-            if (direction == SwipeDirection::Back)
</del><ins>+            if (swipingLeft)
</ins><span class="cx">                 [layer setTransform:CATransform3DMakeTranslation(swipingLayerOffset, 0, 0)];
</span><span class="cx">         } else if (m_swipeTransitionStyle == SwipeTransitionStyle::Push)
</span><span class="cx">             [layer setTransform:CATransform3DMakeTranslation(swipingLayerOffset, 0, 0)];
</span></span></pre>
</div>
</div>

</body>
</html>