<!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>[167274] 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/167274">167274</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2014-04-14 15:39:18 -0700 (Mon, 14 Apr 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS][WK2] Change the SPI used when starting the rotation animation
https://bugs.webkit.org/show_bug.cgi?id=131638

Patch by Benjamin Poulain &lt;bpoulain@apple.com&gt; on 2014-04-14
Reviewed by Tim Horton.

Having an update block where all the properties are changed is more convenient for Safari.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _beginAnimatedResizeWithUpdates:]):
(-[WKWebView _beginAnimatedResizeToSize:obscuredInsets:minimumLayoutSizeOverride:]): Deleted.
* UIProcess/API/Cocoa/WKWebViewPrivate.h:</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="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (167273 => 167274)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-04-14 22:37:07 UTC (rev 167273)
+++ trunk/Source/WebKit2/ChangeLog        2014-04-14 22:39:18 UTC (rev 167274)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-04-14  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        [iOS][WK2] Change the SPI used when starting the rotation animation
+        https://bugs.webkit.org/show_bug.cgi?id=131638
+
+        Reviewed by Tim Horton.
+
+        Having an update block where all the properties are changed is more convenient for Safari.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _beginAnimatedResizeWithUpdates:]):
+        (-[WKWebView _beginAnimatedResizeToSize:obscuredInsets:minimumLayoutSizeOverride:]): Deleted.
+        * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+
</ins><span class="cx"> 2014-04-14  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS WK2] Hash table assertion closing a tab
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (167273 => 167274)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-04-14 22:37:07 UTC (rev 167273)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2014-04-14 22:39:18 UTC (rev 167274)
</span><span class="lines">@@ -1242,38 +1242,43 @@
</span><span class="cx">     [self _updateVisibleContentRects];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_beginAnimatedResizeToSize:(CGSize)futureSize obscuredInsets:(UIEdgeInsets)futureObscuredInsets minimumLayoutSizeOverride:(CGSize)futureMinimumLayoutSize
</del><ins>+- (void)_beginAnimatedResizeWithUpdates:(void (^)(void))updateBlock
</ins><span class="cx"> {
</span><span class="cx">     _isAnimatingResize = YES;
</span><span class="cx">     _resizeAnimationTransformAdjustments = CATransform3DIdentity;
</span><span class="cx"> 
</span><ins>+    CGRect oldBounds = self.bounds;
+    CGSize oldMinimumLayoutSize = oldBounds.size;
+    if (_hasStaticMinimumLayoutSize)
+        oldMinimumLayoutSize = _minimumLayoutSizeOverride;
+    WebCore::FloatRect oldUnobscuredContentRect = _page-&gt;unobscuredContentRect();
+
+    updateBlock();
+
</ins><span class="cx">     if (_customContentView)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    CGSize contentSizeInContentViewCoordinates = [_contentView bounds].size;
-    [_scrollView setMinimumZoomScale:std::min(futureSize.width / contentSizeInContentViewCoordinates.width, [_scrollView minimumZoomScale])];
-
-    _obscuredInsets = futureObscuredInsets;
</del><ins>+    CGRect newBounds = self.bounds;
+    CGSize newMinimumLayoutSize = newBounds.size;
</ins><span class="cx">     if (_hasStaticMinimumLayoutSize)
</span><del>-        _minimumLayoutSizeOverride = futureMinimumLayoutSize;
</del><ins>+        newMinimumLayoutSize = _minimumLayoutSizeOverride;
</ins><span class="cx"> 
</span><del>-    CGRect oldBounds = self.bounds;
-    WebCore::FloatRect originalUnobscuredContentRect = _page-&gt;unobscuredContentRect();
</del><ins>+    if (CGSizeEqualToSize(newMinimumLayoutSize, oldMinimumLayoutSize) &amp;&amp; CGRectEqualToRect(newBounds, oldBounds))
+        return;
</ins><span class="cx"> 
</span><del>-    CGRect futureBounds = oldBounds;
-    futureBounds.size = futureSize;
-    [self setBounds:futureBounds];
</del><ins>+    CGSize contentSizeInContentViewCoordinates = [_contentView bounds].size;
+    [_scrollView setMinimumZoomScale:std::min(newBounds.size.width / contentSizeInContentViewCoordinates.width, [_scrollView minimumZoomScale])];
</ins><span class="cx"> 
</span><span class="cx">     // Compute the new scale to keep the current content width in the scrollview.
</span><span class="cx">     CGFloat oldWebViewWidthInContentViewCoordinates = oldBounds.size.width / contentZoomScale(self);
</span><span class="cx">     CGFloat visibleContentViewWidthInContentCoordinates = std::min(contentSizeInContentViewCoordinates.width, oldWebViewWidthInContentViewCoordinates);
</span><del>-    CGFloat targetScale = futureBounds.size.width / visibleContentViewWidthInContentCoordinates;
</del><ins>+    CGFloat targetScale = newBounds.size.width / visibleContentViewWidthInContentCoordinates;
</ins><span class="cx">     [_scrollView setZoomScale:targetScale];
</span><span class="cx"> 
</span><span class="cx">     // Compute a new position to keep the content centered.
</span><del>-    CGPoint originalContentCenter = originalUnobscuredContentRect.center();
</del><ins>+    CGPoint originalContentCenter = oldUnobscuredContentRect.center();
</ins><span class="cx">     CGPoint originalContentCenterInSelfCoordinates = [self convertPoint:originalContentCenter fromView:_contentView.get()];
</span><del>-    CGRect futureUnobscuredRectInSelfCoordinates = UIEdgeInsetsInsetRect(futureBounds, futureObscuredInsets);
</del><ins>+    CGRect futureUnobscuredRectInSelfCoordinates = UIEdgeInsetsInsetRect(newBounds, _obscuredInsets);
</ins><span class="cx">     CGPoint futureUnobscuredRectCenterInSelfCoordinates = CGPointMake(futureUnobscuredRectInSelfCoordinates.origin.x + futureUnobscuredRectInSelfCoordinates.size.width / 2, futureUnobscuredRectInSelfCoordinates.origin.y + futureUnobscuredRectInSelfCoordinates.size.height / 2);
</span><span class="cx"> 
</span><span class="cx">     CGPoint originalContentOffset = [_scrollView contentOffset];
</span><span class="lines">@@ -1283,29 +1288,29 @@
</span><span class="cx"> 
</span><span class="cx">     // Limit the new offset within the scrollview, we do not want to rubber band programmatically.
</span><span class="cx">     CGSize futureContentSizeInSelfCoordinates = CGSizeMake(contentSizeInContentViewCoordinates.width * targetScale, contentSizeInContentViewCoordinates.height * targetScale);
</span><del>-    CGFloat maxHorizontalOffset = futureContentSizeInSelfCoordinates.width - futureBounds.size.width + _obscuredInsets.right;
</del><ins>+    CGFloat maxHorizontalOffset = futureContentSizeInSelfCoordinates.width - newBounds.size.width + _obscuredInsets.right;
</ins><span class="cx">     contentOffset.x = std::min(contentOffset.x, maxHorizontalOffset);
</span><del>-    CGFloat maxVerticalOffset = futureContentSizeInSelfCoordinates.height - futureBounds.size.height + _obscuredInsets.bottom;
</del><ins>+    CGFloat maxVerticalOffset = futureContentSizeInSelfCoordinates.height - newBounds.size.height + _obscuredInsets.bottom;
</ins><span class="cx">     contentOffset.y = std::min(contentOffset.y, maxVerticalOffset);
</span><span class="cx"> 
</span><span class="cx">     contentOffset.x = std::max(contentOffset.x, -_obscuredInsets.left);
</span><span class="cx">     contentOffset.y = std::max(contentOffset.y, -_obscuredInsets.top);
</span><span class="cx"> 
</span><span class="cx">     // Make the top/bottom edges &quot;sticky&quot; within 1 pixel.
</span><del>-    if (originalUnobscuredContentRect.maxY() &gt; contentSizeInContentViewCoordinates.height - 1)
</del><ins>+    if (oldUnobscuredContentRect.maxY() &gt; contentSizeInContentViewCoordinates.height - 1)
</ins><span class="cx">         contentOffset.y = maxVerticalOffset;
</span><del>-    if (originalUnobscuredContentRect.y() &lt; 1)
</del><ins>+    if (oldUnobscuredContentRect.y() &lt; 1)
</ins><span class="cx">         contentOffset.y = -_obscuredInsets.top;
</span><span class="cx"> 
</span><span class="cx">     // FIXME: if we have content centered after double tap to zoom, we should also try to keep that rect in view.
</span><span class="cx">     [_scrollView setContentOffset:contentOffset];
</span><span class="cx"> 
</span><del>-    CGRect visibleRectInContentCoordinates = [self convertRect:futureBounds toView:_contentView.get()];
</del><ins>+    CGRect visibleRectInContentCoordinates = [self convertRect:newBounds toView:_contentView.get()];
</ins><span class="cx"> 
</span><del>-    CGRect unobscuredRect = UIEdgeInsetsInsetRect(futureBounds, _obscuredInsets);
</del><ins>+    CGRect unobscuredRect = UIEdgeInsetsInsetRect(newBounds, _obscuredInsets);
</ins><span class="cx">     CGRect unobscuredRectInContentCoordinates = [self convertRect:unobscuredRect toView:_contentView.get()];
</span><span class="cx"> 
</span><del>-    _page-&gt;dynamicViewportSizeUpdate(WebCore::IntSize(CGCeiling(futureMinimumLayoutSize.width), CGCeiling(futureMinimumLayoutSize.height)), visibleRectInContentCoordinates, unobscuredRectInContentCoordinates, targetScale);
</del><ins>+    _page-&gt;dynamicViewportSizeUpdate(WebCore::IntSize(CGCeiling(newMinimumLayoutSize.width), CGCeiling(newMinimumLayoutSize.height)), visibleRectInContentCoordinates, unobscuredRectInContentCoordinates, targetScale);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_endAnimatedResize
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h (167273 => 167274)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2014-04-14 22:37:07 UTC (rev 167273)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h        2014-04-14 22:39:18 UTC (rev 167274)
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx"> - (void)_beginInteractiveObscuredInsetsChange;
</span><span class="cx"> - (void)_endInteractiveObscuredInsetsChange;
</span><span class="cx"> 
</span><del>-- (void)_beginAnimatedResizeToSize:(CGSize)futureSize obscuredInsets:(UIEdgeInsets)futureObscuredInsets minimumLayoutSizeOverride:(CGSize)futureMinimumLayoutSize;
</del><ins>+- (void)_beginAnimatedResizeWithUpdates:(void (^)(void))updateBlock;
</ins><span class="cx"> - (void)_endAnimatedResize;
</span><span class="cx"> 
</span><span class="cx"> - (void)_showInspectorIndication;
</span></span></pre>
</div>
</div>

</body>
</html>