[prev in list] [next in list] [prev in thread] [next in thread] 

List:       webkit-changes
Subject:    [webkit-changes] [182214] trunk/Source/WebKit2
From:       timothy_horton () apple ! com
Date:       2015-03-31 23:38:50
Message-ID: 20150331233850.516D9308029 () svn ! webkit ! org
[Download RAW message or body]

[Attachment #2 (text/html)]

<!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>[182214] 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/182214">182214</a></dd> \
<dt>Author</dt> <dd>timothy_horton@apple.com</dd> <dt>Date</dt> <dd>2015-03-31 \
16:38:49 -0700 (Tue, 31 Mar 2015)</dd> </dl>

<h3>Log Message</h3>
<pre>Swipes occur in the wrong direction in RTL
https://bugs.webkit.org/show_bug.cgi?id=143257
&lt;rdar://problem/20300862&gt;

Reviewed by Simon Fraser.

* UIProcess/ios/ViewGestureControllerIOS.mm:
(-[WKSwipeTransitionController \
gestureRecognizerForInteractiveTransition:WithTarget:action:]): When choosing which \
edge to attach our gesture recognizers to, flip them in RTL.

(-[WKSwipeTransitionController directionForTransition:]):
(WebKit::ViewGestureController::beginSwipeGesture):
(WebKit::ViewGestureController::canSwipeInDirection):
* UIProcess/mac/ViewGestureController.h:
* UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::scrollEventCanBecomeSwipe):
(WebKit::ViewGestureController::trackSwipeGesture):
(WebKit::ViewGestureController::determineLayerAdjacentToSnapshotForParent):
(WebKit::ViewGestureController::beginSwipeGesture):
(WebKit::ViewGestureController::handleSwipeGesture):
Adjust SwipeDirection to be in logical back-forward list direction
instead of physical edge direction.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosViewGestureControllerIOSmm">trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.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>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (182213 => \
182214)</h4> <pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog	2015-03-31 23:15:02 UTC (rev \
                182213)
+++ trunk/Source/WebKit2/ChangeLog	2015-03-31 23:38:49 UTC (rev 182214)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2015-03-31  Timothy Horton  &lt;timothy_horton@apple.com&gt;
+
+        Swipes occur in the wrong direction in RTL
+        https://bugs.webkit.org/show_bug.cgi?id=143257
+        &lt;rdar://problem/20300862&gt;
+
+        Reviewed by Simon Fraser.
+
+        * UIProcess/ios/ViewGestureControllerIOS.mm:
+        (-[WKSwipeTransitionController \
gestureRecognizerForInteractiveTransition:WithTarget:action:]): +        When \
choosing which edge to attach our gesture recognizers to, +        flip them in RTL.
+
+        (-[WKSwipeTransitionController directionForTransition:]):
+        (WebKit::ViewGestureController::beginSwipeGesture):
+        (WebKit::ViewGestureController::canSwipeInDirection):
+        * UIProcess/mac/ViewGestureController.h:
+        * UIProcess/mac/ViewGestureControllerMac.mm:
+        (WebKit::ViewGestureController::scrollEventCanBecomeSwipe):
+        (WebKit::ViewGestureController::trackSwipeGesture):
+        (WebKit::ViewGestureController::determineLayerAdjacentToSnapshotForParent):
+        (WebKit::ViewGestureController::beginSwipeGesture):
+        (WebKit::ViewGestureController::handleSwipeGesture):
+        Adjust SwipeDirection to be in logical back-forward list direction
+        instead of physical edge direction.
+
</ins><span class="cx"> 2015-03-31  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Move ExpansionBehaviorFlags and TextDirection to \
their own file </span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosViewGestureControllerIOSmm"></a>
<div class="modfile"><h4>Modified: \
trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm (182213 => \
182214)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm	2015-03-31 23:15:02 \
                UTC (rev 182213)
+++ trunk/Source/WebKit2/UIProcess/ios/ViewGestureControllerIOS.mm	2015-03-31 \
23:38:49 UTC (rev 182214) </span><span class="lines">@@ -60,6 +60,7 @@
</span><span class="cx">     WebKit::ViewGestureController *_gestureController;
</span><span class="cx">     RetainPtr&lt;_UINavigationInteractiveTransitionBase&gt; \
_backTransitionController; </span><span class="cx">     \
RetainPtr&lt;_UINavigationInteractiveTransitionBase&gt; _forwardTransitionController; \
</span><ins>+    WebKit::WeakObjCPtr&lt;UIView&gt; _gestureRecognizerView; \
</ins><span class="cx"> } </span><span class="cx"> 
</span><span class="cx"> static const float \
swipeSnapshotRemovalRenderTreeSizeTargetFraction = 0.5; </span><span class="lines">@@ \
-78,6 +79,7 @@ </span><span class="cx">     self = [super init];
</span><span class="cx">     if (self) {
</span><span class="cx">         _gestureController = gestureController;
</span><ins>+        _gestureRecognizerView = gestureRecognizerView;
</ins><span class="cx"> 
</span><span class="cx">         _backTransitionController = \
adoptNS([_UINavigationInteractiveTransitionBase alloc]); </span><span class="cx">     \
_backTransitionController = [_backTransitionController \
initWithGestureRecognizerView:gestureRecognizerView animator:nil delegate:self]; \
</span><span class="lines">@@ -96,7 +98,7 @@ </span><span class="cx"> 
</span><span class="cx"> - \
(WebKit::ViewGestureController::SwipeDirection)directionForTransition:(_UINavigationInteractiveTransitionBase \
*)transition </span><span class="cx"> {
</span><del>-    return transition == _backTransitionController ? \
WebKit::ViewGestureController::SwipeDirection::Left : \
WebKit::ViewGestureController::SwipeDirection::Right; </del><ins>+    return \
transition == _backTransitionController ? \
WebKit::ViewGestureController::SwipeDirection::Back : \
WebKit::ViewGestureController::SwipeDirection::Forward; </ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - \
(void)startInteractiveTransition:(_UINavigationInteractiveTransitionBase *)transition \
</span><span class="lines">@@ -122,12 +124,19 @@ </span><span class="cx"> - \
(UIPanGestureRecognizer \
*)gestureRecognizerForInteractiveTransition:(_UINavigationInteractiveTransitionBase \
*)transition WithTarget:(id)target action:(SEL)action </span><span class="cx"> {
</span><span class="cx">     UIScreenEdgePanGestureRecognizer *recognizer = \
[[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:target action:action]; \
</span><ins>+ +#if __IPHONE_OS_VERSION_MIN_REQUIRED &gt;= 90000
+    bool isLTR = [UIView \
userInterfaceLayoutDirectionForSemanticContentAttribute:[_gestureRecognizerView.get() \
semanticContentAttribute]] == UIUserInterfaceLayoutDirectionLeftToRight; +#else
+    bool isLTR = true;
+#endif
+
</ins><span class="cx">     switch ([self directionForTransition:transition]) {
</span><del>-    case WebKit::ViewGestureController::SwipeDirection::Left:
-        [recognizer setEdges:UIRectEdgeLeft];
</del><ins>+    case WebKit::ViewGestureController::SwipeDirection::Back:
+        [recognizer setEdges:isLTR ? UIRectEdgeLeft : UIRectEdgeRight];
</ins><span class="cx">         break;
</span><del>-    case WebKit::ViewGestureController::SwipeDirection::Right:
-        [recognizer setEdges:UIRectEdgeRight];
</del><ins>+    case WebKit::ViewGestureController::SwipeDirection::Forward:
+        [recognizer setEdges:isLTR ? UIRectEdgeRight : UIRectEdgeLeft];
</ins><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx">     return [recognizer autorelease];
</span><span class="lines">@@ -183,7 +192,7 @@
</span><span class="cx">     if (m_webPageProxyForBackForwardListForCurrentSwipe != \
&amp;m_webPageProxy) </span><span class="cx">         \
backForwardList.currentItem()-&gt;setSnapshot(m_webPageProxy.backForwardList().currentItem()-&gt;snapshot());
 </span><span class="cx"> 
</span><del>-    RefPtr&lt;WebBackForwardListItem&gt; targetItem = direction == \
SwipeDirection::Left ? backForwardList.backItem() : backForwardList.forwardItem(); \
</del><ins>+    RefPtr&lt;WebBackForwardListItem&gt; targetItem = direction == \
SwipeDirection::Back ? backForwardList.backItem() : backForwardList.forwardItem(); \
</ins><span class="cx">  </span><span class="cx">     CGRect liveSwipeViewFrame = \
[m_liveSwipeView frame]; </span><span class="cx"> 
</span><span class="lines">@@ -218,7 +227,7 @@
</span><span class="cx">     RetainPtr&lt;UIViewController&gt; \
targettedViewController = adoptNS([[UIViewController alloc] init]); </span><span \
class="cx">     [targettedViewController setView:m_liveSwipeViewClippingView.get()]; \
</span><span class="cx">  </span><del>-    UINavigationControllerOperation \
transitionOperation = direction == SwipeDirection::Left ? \
UINavigationControllerOperationPop : UINavigationControllerOperationPush; \
</del><ins>+    UINavigationControllerOperation transitionOperation = direction == \
SwipeDirection::Back ? UINavigationControllerOperationPop : \
UINavigationControllerOperationPush; </ins><span class="cx">     \
RetainPtr&lt;_UINavigationParallaxTransition&gt; animationController = \
adoptNS([[_UINavigationParallaxTransition alloc] \
initWithCurrentOperation:transitionOperation]); </span><span class="cx"> 
</span><span class="cx">     m_swipeTransitionContext = \
adoptNS([[_UIViewControllerOneToOneTransitionContext alloc] init]); </span><span \
class="lines">@@ -253,7 +262,7 @@ </span><span class="cx"> bool \
ViewGestureController::canSwipeInDirection(SwipeDirection direction) </span><span \
class="cx"> { </span><span class="cx">     auto&amp; backForwardList = \
m_alternateBackForwardListSourceView.get() ? \
m_alternateBackForwardListSourceView.get()-&gt;_page-&gt;backForwardList() : \
m_webPageProxy.backForwardList(); </span><del>-    if (direction == \
SwipeDirection::Left) </del><ins>+    if (direction == SwipeDirection::Back)
</ins><span class="cx">         return !!backForwardList.backItem();
</span><span class="cx">     return !!backForwardList.forwardItem();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacViewGestureControllerh"></a>
<div class="modfile"><h4>Modified: \
trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h (182213 => 182214)</h4> \
<pre class="diff"><span> <span class="info">--- \
trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h	2015-03-31 23:15:02 UTC \
                (rev 182213)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureController.h	2015-03-31 23:38:49 \
UTC (rev 182214) </span><span class="lines">@@ -80,8 +80,8 @@
</span><span class="cx">     };
</span><span class="cx">     
</span><span class="cx">     enum class SwipeDirection {
</span><del>-        Left,
-        Right
</del><ins>+        Back,
+        Forward
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     enum class PendingSwipeReason {
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacViewGestureControllerMacmm"></a>
<div class="modfile"><h4>Modified: \
trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm (182213 => \
182214)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm	2015-03-31 23:15:02 \
                UTC (rev 182213)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewGestureControllerMac.mm	2015-03-31 \
23:38:49 UTC (rev 182214) </span><span class="lines">@@ -275,7 +275,7 @@
</span><span class="cx">     if (!willSwipeLeft &amp;&amp; !willSwipeRight)
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    potentialSwipeDirection = willSwipeLeft ? \
ViewGestureController::SwipeDirection::Left : \
ViewGestureController::SwipeDirection::Right; </del><ins>+    potentialSwipeDirection \
= willSwipeLeft ? ViewGestureController::SwipeDirection::Back : \
ViewGestureController::SwipeDirection::Forward; </ins><span class="cx"> 
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -371,9 +371,9 @@
</span><span class="cx"> 
</span><span class="cx">     m_webPageProxy.recordNavigationSnapshot();
</span><span class="cx"> 
</span><del>-    CGFloat maxProgress = (direction == SwipeDirection::Left) ? 1 : 0;
-    CGFloat minProgress = (direction == SwipeDirection::Right) ? -1 : 0;
-    RefPtr&lt;WebBackForwardListItem&gt; targetItem = (direction == \
SwipeDirection::Left) ? m_webPageProxy.backForwardList().backItem() : \
m_webPageProxy.backForwardList().forwardItem(); </del><ins>+    CGFloat maxProgress = \
(direction == SwipeDirection::Back) ? 1 : 0; +    CGFloat minProgress = (direction == \
SwipeDirection::Forward) ? -1 : 0; +    RefPtr&lt;WebBackForwardListItem&gt; \
targetItem = (direction == SwipeDirection::Back) ? \
m_webPageProxy.backForwardList().backItem() : \
m_webPageProxy.backForwardList().forwardItem(); </ins><span class="cx">     if \
(!targetItem) </span><span class="cx">         return;
</span><span class="cx">     
</span><span class="lines">@@ -446,7 +446,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::Left ? \
m_currentSwipeLiveLayers.first().get() : m_currentSwipeLiveLayers.last().get(); \
</del><ins>+    CALayer *layerAdjacentToSnapshot = direction == SwipeDirection::Back \
? 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">@@ -566,7 +566,7 @@
</span><span class="cx"> 
</span><span class="cx">     // We don't know enough about the custom views' \
hierarchy to apply a shadow. </span><span class="cx">     if (m_swipeTransitionStyle \
== SwipeTransitionStyle::Overlap &amp;&amp; m_customSwipeViews.isEmpty()) { \
</span><del>-        if (direction == SwipeDirection::Left) { </del><ins>+        if \
(direction == SwipeDirection::Back) { </ins><span class="cx">             float \
topContentInset = m_webPageProxy.topContentInset(); </span><span class="cx">          \
FloatRect shadowRect(FloatPoint(0, topContentInset), m_webPageProxy.viewSize() - \
FloatSize(0, topContentInset)); </span><span class="cx">             \
RetainPtr&lt;CGPathRef&gt; shadowPath = adoptCF(CGPathCreateWithRect(shadowRect, 0)); \
</span><span class="lines">@@ -584,7 +584,7 @@ </span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     CALayer *layerAdjacentToSnapshot = \
determineLayerAdjacentToSnapshotForParent(direction, snapshotLayerParent); \
</span><del>-    if (direction == SwipeDirection::Left) </del><ins>+    if (direction \
== SwipeDirection::Back) </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">@@ -606,16 +606,16 @@ </span><span class="cx">     double \
swipingLayerOffset = floor(width * progress); </span><span class="cx"> 
</span><span class="cx">     if (m_swipeTransitionStyle == \
SwipeTransitionStyle::Overlap) { </span><del>-        if (direction == \
SwipeDirection::Right) { </del><ins>+        if (direction == \
SwipeDirection::Forward) { </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::Left ? -width \
: width) + swipingLayerOffset, 0, 0)]; </del><ins>+        [m_swipeLayer \
setTransform:CATransform3DMakeTranslation((direction == SwipeDirection::Back ? -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::Left) </del><ins>+            if (direction == SwipeDirection::Back)
</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>



_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic