<!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>[170926] 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/170926">170926</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2014-07-09 12:47:44 -0700 (Wed, 09 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS][WK2] subviews of the unscaled view drift out during CA animations
https://bugs.webkit.org/show_bug.cgi?id=134751

Patch by Benjamin Poulain &lt;bpoulain@apple.com&gt; on 2014-07-09
Reviewed by Enrica Casucci.

It is not possible to animate the WKContentView and the inverse view in such a way
that the combined matrix remain the identity for every frame of the animation.

This patch solves the issue by moving the unscaled view as a sibling of WKContentView
instead of a child so that we do not need to update two scales simultaneously.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView initWithFrame:configuration:]):
(-[WKWebView _processDidExit]):
(-[WKWebView _dynamicViewportUpdateChangedTargetToScale:position:]):
Set the z scale to 1 or no coordinate transform will work with this view.

(-[WKWebView _beginAnimatedResizeWithUpdates:]):
(-[WKWebView _endAnimatedResize]):
* UIProcess/ios/WKContentView.mm:
(-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:]):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setupInteraction]):
Since we need to observe changes inside the animation block, the code now use KVO to observe changes of scale.

(-[WKContentView cleanupInteraction]):
(-[WKContentView unscaledView]):
(-[WKContentView inverseScale]):
(-[WKContentView observeValueForKeyPath:ofObject:change:context:]):
We update the utility views as usual. The extra bits here are to deal with views coming in during an animation.

If a new utility view comes in during a scaling animation, we do not want to start a new animation with the same curve
to end up at the right place. To avoid any issue, we just hide the view until the animation is finished.

(-[WKContentView hitTest:withEvent:]):
(-[WKContentView _showTapHighlight]):
(-[WKContentView _updateUnscaledView]): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewmm">trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewInteractionh">trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (170925 => 170926)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-07-09 19:31:33 UTC (rev 170925)
+++ trunk/Source/WebKit2/ChangeLog        2014-07-09 19:47:44 UTC (rev 170926)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2014-07-09  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        [iOS][WK2] subviews of the unscaled view drift out during CA animations
+        https://bugs.webkit.org/show_bug.cgi?id=134751
+
+        Reviewed by Enrica Casucci.
+
+        It is not possible to animate the WKContentView and the inverse view in such a way
+        that the combined matrix remain the identity for every frame of the animation.
+
+        This patch solves the issue by moving the unscaled view as a sibling of WKContentView
+        instead of a child so that we do not need to update two scales simultaneously.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView initWithFrame:configuration:]):
+        (-[WKWebView _processDidExit]):
+        (-[WKWebView _dynamicViewportUpdateChangedTargetToScale:position:]):
+        Set the z scale to 1 or no coordinate transform will work with this view.
+
+        (-[WKWebView _beginAnimatedResizeWithUpdates:]):
+        (-[WKWebView _endAnimatedResize]):
+        * UIProcess/ios/WKContentView.mm:
+        (-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:]):
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView setupInteraction]):
+        Since we need to observe changes inside the animation block, the code now use KVO to observe changes of scale.
+
+        (-[WKContentView cleanupInteraction]):
+        (-[WKContentView unscaledView]):
+        (-[WKContentView inverseScale]):
+        (-[WKContentView observeValueForKeyPath:ofObject:change:context:]):
+        We update the utility views as usual. The extra bits here are to deal with views coming in during an animation.
+
+        If a new utility view comes in during a scaling animation, we do not want to start a new animation with the same curve
+        to end up at the right place. To avoid any issue, we just hide the view until the animation is finished.
+
+        (-[WKContentView hitTest:withEvent:]):
+        (-[WKContentView _showTapHighlight]):
+        (-[WKContentView _updateUnscaledView]): Deleted.
+
</ins><span class="cx"> 2014-07-09  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use IOSurface ViewSnapshots everywhere on Mac, remove JPEG encoding path
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (170925 => 170926)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-07-09 19:31:33 UTC (rev 170925)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-07-09 19:47:44 UTC (rev 170926)
</span><span class="lines">@@ -288,6 +288,7 @@
</span><span class="cx">     [_contentView layer].anchorPoint = CGPointZero;
</span><span class="cx">     [_contentView setFrame:bounds];
</span><span class="cx">     [_scrollView addSubview:_contentView.get()];
</span><ins>+    [_scrollView addSubview:[_contentView unscaledView]];
</ins><span class="cx">     _viewportMetaTagWidth = -1;
</span><span class="cx"> 
</span><span class="cx">     [self _frameOrBoundsChanged];
</span><span class="lines">@@ -605,6 +606,7 @@
</span><span class="cx">         _customContentFixedOverlayView = adoptNS([[UIView alloc] initWithFrame:self.bounds]);
</span><span class="cx">         [_customContentFixedOverlayView setUserInteractionEnabled:NO];
</span><span class="cx"> 
</span><ins>+        [[_contentView unscaledView] removeFromSuperview];
</ins><span class="cx">         [_contentView removeFromSuperview];
</span><span class="cx">         [_scrollView addSubview:_customContentView.get()];
</span><span class="cx">         [self addSubview:_customContentFixedOverlayView.get()];
</span><span class="lines">@@ -619,6 +621,7 @@
</span><span class="cx">         _customContentFixedOverlayView = nullptr;
</span><span class="cx"> 
</span><span class="cx">         [_scrollView addSubview:_contentView.get()];
</span><ins>+        [_scrollView addSubview:[_contentView unscaledView]];
</ins><span class="cx">         [_scrollView setContentSize:roundScrollViewContentSize(*_page, [_contentView frame].size)];
</span><span class="cx"> 
</span><span class="cx">         [_customContentFixedOverlayView setFrame:self.bounds];
</span><span class="lines">@@ -718,6 +721,7 @@
</span><span class="cx">     if (!_customContentView &amp;&amp; _isAnimatingResize) {
</span><span class="cx">         NSUInteger indexOfResizeAnimationView = [[_scrollView subviews] indexOfObject:_resizeAnimationView.get()];
</span><span class="cx">         [_scrollView insertSubview:_contentView.get() atIndex:indexOfResizeAnimationView];
</span><ins>+        [_scrollView insertSubview:[_contentView unscaledView] atIndex:indexOfResizeAnimationView + 1];
</ins><span class="cx">         [_resizeAnimationView removeFromSuperview];
</span><span class="cx">         _resizeAnimationView = nil;
</span><span class="cx"> 
</span><span class="lines">@@ -838,7 +842,7 @@
</span><span class="cx">         CGFloat animatingScaleTarget = [[_resizeAnimationView layer] transform].m11;
</span><span class="cx">         double currentTargetScale = animatingScaleTarget * [[_contentView layer] transform].m11;
</span><span class="cx">         double scale = newScale / currentTargetScale;
</span><del>-        _resizeAnimationTransformAdjustments = CATransform3DMakeScale(scale, scale, 0);
</del><ins>+        _resizeAnimationTransformAdjustments = CATransform3DMakeScale(scale, scale, 1);
</ins><span class="cx"> 
</span><span class="cx">         CGPoint newContentOffset = [self _adjustedContentOffset:CGPointMake(newScrollPosition.x * newScale, newScrollPosition.y * newScale)];
</span><span class="cx">         CGPoint currentContentOffset = [_scrollView contentOffset];
</span><span class="lines">@@ -2101,6 +2105,7 @@
</span><span class="cx">     _resizeAnimationView = adoptNS([[UIView alloc] init]);
</span><span class="cx">     [_scrollView insertSubview:_resizeAnimationView.get() atIndex:indexOfContentView];
</span><span class="cx">     [_resizeAnimationView addSubview:_contentView.get()];
</span><ins>+    [_resizeAnimationView addSubview:[_contentView unscaledView]];
</ins><span class="cx"> 
</span><span class="cx">     CGSize contentSizeInContentViewCoordinates = [_contentView bounds].size;
</span><span class="cx">     [_scrollView setMinimumZoomScale:std::min(newMinimumLayoutSize.width() / contentSizeInContentViewCoordinates.width, [_scrollView minimumZoomScale])];
</span><span class="lines">@@ -2159,6 +2164,7 @@
</span><span class="cx"> 
</span><span class="cx">     NSUInteger indexOfResizeAnimationView = [[_scrollView subviews] indexOfObject:_resizeAnimationView.get()];
</span><span class="cx">     [_scrollView insertSubview:_contentView.get() atIndex:indexOfResizeAnimationView];
</span><ins>+    [_scrollView insertSubview:[_contentView unscaledView] atIndex:indexOfResizeAnimationView + 1];
</ins><span class="cx"> 
</span><span class="cx">     CALayer *contentViewLayer = [_contentView layer];
</span><span class="cx">     CGFloat adjustmentScale = _resizeAnimationTransformAdjustments.m11;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm (170925 => 170926)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm        2014-07-09 19:31:33 UTC (rev 170925)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm        2014-07-09 19:47:44 UTC (rev 170926)
</span><span class="lines">@@ -574,8 +574,6 @@
</span><span class="cx"> - (void)didUpdateVisibleRect:(CGRect)visibleRect unobscuredRect:(CGRect)unobscuredRect unobscuredRectInScrollViewCoordinates:(CGRect)unobscuredRectInScrollViewCoordinates
</span><span class="cx">     scale:(CGFloat)zoomScale minimumScale:(CGFloat)minimumScale inStableState:(BOOL)isStableState isChangingObscuredInsetsInteractively:(BOOL)isChangingObscuredInsetsInteractively
</span><span class="cx"> {
</span><del>-    double oldDisplayedContentScale = _page-&gt;displayedContentScale();
-
</del><span class="cx">     double timestamp = monotonicallyIncreasingTime();
</span><span class="cx">     HistoricalVelocityData::VelocityData velocityData;
</span><span class="cx">     if (!isStableState)
</span><span class="lines">@@ -593,9 +591,6 @@
</span><span class="cx"> 
</span><span class="cx">     if (auto drawingArea = _page-&gt;drawingArea())
</span><span class="cx">         drawingArea-&gt;updateDebugIndicator();
</span><del>-
-    if (!withinEpsilon(oldDisplayedContentScale, zoomScale))
-        [self _updateUnscaledView];
</del><span class="cx">         
</span><span class="cx">     [self updateFixedClippingView:fixedPositionRect];
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewInteractionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h (170925 => 170926)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h        2014-07-09 19:31:33 UTC (rev 170925)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h        2014-07-09 19:47:44 UTC (rev 170926)
</span><span class="lines">@@ -101,7 +101,7 @@
</span><span class="cx">     RetainPtr&lt;UITextInputTraits&gt; _traits;
</span><span class="cx">     RetainPtr&lt;UIWebFormAccessory&gt; _formAccessoryView;
</span><span class="cx">     RetainPtr&lt;_UIHighlightView&gt; _highlightView;
</span><del>-    RetainPtr&lt;UIView&gt; _inverseScaleRootView;
</del><ins>+    RetainPtr&lt;UIView&gt; _interactionViewsContainerView;
</ins><span class="cx">     RetainPtr&lt;NSString&gt; _markedText;
</span><span class="cx">     RetainPtr&lt;WKActionSheetAssistant&gt; _actionSheetAssistant;
</span><span class="cx">     RetainPtr&lt;WKAirPlayRoutePicker&gt; _airPlayRoutePicker;
</span><span class="lines">@@ -181,7 +181,6 @@
</span><span class="cx"> - (void)accessoryDone;
</span><span class="cx"> - (void)_didHandleKeyEvent:(WebIOSEvent *)event;
</span><span class="cx"> - (Vector&lt;WebKit::OptionItem&gt;&amp;) assistedNodeSelectOptions;
</span><del>-- (void)_updateUnscaledView;
</del><span class="cx"> - (void)_enableInspectorNodeSearch;
</span><span class="cx"> - (void)_disableInspectorNodeSearch;
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm (170925 => 170926)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2014-07-09 19:31:33 UTC (rev 170925)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm        2014-07-09 19:47:44 UTC (rev 170926)
</span><span class="lines">@@ -138,6 +138,10 @@
</span><span class="cx"> - (void)didHandleWebKeyEvent;
</span><span class="cx"> @end
</span><span class="cx"> 
</span><ins>+@interface UIView (UIViewInternalHack)
++ (BOOL)_addCompletion:(void(^)(BOOL))completion;
+@end
+
</ins><span class="cx"> @interface WKFormInputSession : NSObject &lt;_WKFormInputSession&gt;
</span><span class="cx"> 
</span><span class="cx"> - (instancetype)initWithContentView:(WKContentView *)view userObject:(NSObject &lt;NSSecureCoding&gt; *)userObject;
</span><span class="lines">@@ -212,14 +216,13 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)setupInteraction
</span><span class="cx"> {
</span><del>-    if (!_inverseScaleRootView) {
-        _inverseScaleRootView = adoptNS([[UIView alloc] init]);
-        [_inverseScaleRootView setOpaque:NO];
-        [_inverseScaleRootView layer].anchorPoint = CGPointMake(0, 0);
</del><ins>+    if (!_interactionViewsContainerView) {
+        _interactionViewsContainerView = adoptNS([[UIView alloc] init]);
+        [_interactionViewsContainerView setOpaque:NO];
+        [_interactionViewsContainerView layer].anchorPoint = CGPointZero;
</ins><span class="cx">     }
</span><del>-    [self addSubview:_inverseScaleRootView.get()];
-    CGFloat inverseScale = 1 / [[self layer] transform].m11;
-    [_inverseScaleRootView setTransform:CGAffineTransformMakeScale(inverseScale, inverseScale)];
</del><ins>+    [_interactionViewsContainerView setHidden:NO];
+    [self.layer addObserver:self forKeyPath:@&quot;transform&quot; options:NSKeyValueObservingOptionInitial context:nil];
</ins><span class="cx"> 
</span><span class="cx">     _touchEventGestureRecognizer = adoptNS([[UIWebTouchEventsGestureRecognizer alloc] initWithTarget:self action:@selector(_webTouchEventsRecognized:) touchDelegate:self]);
</span><span class="cx">     [_touchEventGestureRecognizer setDelegate:self];
</span><span class="lines">@@ -273,7 +276,8 @@
</span><span class="cx">     [_formInputSession invalidate];
</span><span class="cx">     _formInputSession = nil;
</span><span class="cx">     [_highlightView removeFromSuperview];
</span><del>-    [_inverseScaleRootView removeFromSuperview];
</del><ins>+    [self.layer removeObserver:self forKeyPath:@&quot;transform&quot;];
+    [_interactionViewsContainerView setHidden:YES];
</ins><span class="cx">     [_touchEventGestureRecognizer setDelegate:nil];
</span><span class="cx">     [self removeGestureRecognizer:_touchEventGestureRecognizer.get()];
</span><span class="cx"> 
</span><span class="lines">@@ -330,18 +334,29 @@
</span><span class="cx"> 
</span><span class="cx"> - (UIView*)unscaledView
</span><span class="cx"> {
</span><del>-    return _inverseScaleRootView.get();
</del><ins>+    return _interactionViewsContainerView.get();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (CGFloat)inverseScale
</span><span class="cx"> {
</span><del>-    return [[_inverseScaleRootView layer] transform].m11;
</del><ins>+    return 1 / [[self layer] transform].m11;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_updateUnscaledView
</del><ins>+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
</ins><span class="cx"> {
</span><del>-    CGFloat inverseScale = 1 / [[self layer] transform].m11;
-    [_inverseScaleRootView setTransform:CGAffineTransformMakeScale(inverseScale, inverseScale)];
</del><ins>+    ASSERT([keyPath isEqualToString:@&quot;transform&quot;]);
+    ASSERT(object == self.layer);
+
+    if ([UIView _isInAnimationBlock] &amp;&amp; _page-&gt;editorState().selectionIsNone) {
+        // If the utility views are not already visible, we don't want them to become visible during the animation since
+        // they could not start from a reasonable state.
+        // This is not perfect since views could also get updated during the animation, in practice this is rare and the end state
+        // remains correct.
+        [self _cancelInteraction];
+        [_interactionViewsContainerView setHidden:YES];
+        [UIView _addCompletion:^(BOOL){ [_interactionViewsContainerView setHidden:NO]; }];
+    }
+
</ins><span class="cx">     _selectionNeedsUpdate = YES;
</span><span class="cx">     [self _updateChangedSelection];
</span><span class="cx">     [self _updateTapHighlight];
</span><span class="lines">@@ -369,7 +384,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (UIView *)hitTest:(CGPoint)point withEvent:(::UIEvent *)event
</span><span class="cx"> {
</span><del>-    for (UIView *subView in [_inverseScaleRootView.get() subviews]) {
</del><ins>+    for (UIView *subView in [_interactionViewsContainerView.get() subviews]) {
</ins><span class="cx">         UIView *hitView = [subView hitTest:[subView convertPoint:point fromView:self] withEvent:event];
</span><span class="cx">         if (hitView)
</span><span class="cx">             return hitView;
</span><span class="lines">@@ -584,7 +599,7 @@
</span><span class="cx">         [_highlightView setCornerRadius:minimumTapHighlightRadius];
</span><span class="cx">     }
</span><span class="cx">     [_highlightView layer].opacity = 1;
</span><del>-    [_inverseScaleRootView addSubview:_highlightView.get()];
</del><ins>+    [_interactionViewsContainerView addSubview:_highlightView.get()];
</ins><span class="cx">     [self _updateTapHighlight];
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>