Title: [218374] trunk/Source/WebKit2
- Revision
- 218374
- Author
- simon.fra...@apple.com
- Date
- 2017-06-15 18:43:27 -0700 (Thu, 15 Jun 2017)
Log Message
[iOS WK2] YouTube videos flash at the wrong place at the end of rotation
https://bugs.webkit.org/show_bug.cgi?id=173445
rdar://problem/31584852
Reviewed by Tim Horton.
In MobileSafari where WKWebView rotation uses _dynamicViewportUpdateModes, we could do a
visibleContentRect update at the end of rotation which computed a bad layoutViewportRect,
because it used a m_baseLayoutViewportSize from the old orientation.
We have actually sent a new m_baseLayoutViewportSize to the UI process by this point in
a layer tree commit, but _didCommitLayerTree: ignored it because we had a _dynamicViewportUpdateMode.
Fix is to always update the layout viewport data from the web process, since during dynamic
viewport updates, we still need these data to compute rectangles sent back to the web process via
visible content rect updates.
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _didCommitLayerTree:]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::computeCustomFixedPositionRect):
(WebKit::WebPageProxy::updateLayoutViewportParameters): Cleanup.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (218373 => 218374)
--- trunk/Source/WebKit2/ChangeLog 2017-06-16 01:39:31 UTC (rev 218373)
+++ trunk/Source/WebKit2/ChangeLog 2017-06-16 01:43:27 UTC (rev 218374)
@@ -1,3 +1,28 @@
+2017-06-15 Simon Fraser <simon.fra...@apple.com>
+
+ [iOS WK2] YouTube videos flash at the wrong place at the end of rotation
+ https://bugs.webkit.org/show_bug.cgi?id=173445
+ rdar://problem/31584852
+
+ Reviewed by Tim Horton.
+
+ In MobileSafari where WKWebView rotation uses _dynamicViewportUpdateModes, we could do a
+ visibleContentRect update at the end of rotation which computed a bad layoutViewportRect,
+ because it used a m_baseLayoutViewportSize from the old orientation.
+
+ We have actually sent a new m_baseLayoutViewportSize to the UI process by this point in
+ a layer tree commit, but _didCommitLayerTree: ignored it because we had a _dynamicViewportUpdateMode.
+
+ Fix is to always update the layout viewport data from the web process, since during dynamic
+ viewport updates, we still need these data to compute rectangles sent back to the web process via
+ visible content rect updates.
+
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _didCommitLayerTree:]):
+ * UIProcess/ios/WebPageProxyIOS.mm:
+ (WebKit::WebPageProxy::computeCustomFixedPositionRect):
+ (WebKit::WebPageProxy::updateLayoutViewportParameters): Cleanup.
+
2017-06-15 Wenson Hsieh <wenson_hs...@apple.com>
Using -[WebItemProviderPasteboard setItemProviders:] to swap out item providers before a drop breaks item provider loading
Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (218373 => 218374)
--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2017-06-16 01:39:31 UTC (rev 218373)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm 2017-06-16 01:43:27 UTC (rev 218374)
@@ -1478,6 +1478,8 @@
LOG_WITH_STREAM(VisibleRects, stream << "-[WKWebView _didCommitLayerTree:] transactionID " << layerTreeTransaction.transactionID() << " _dynamicViewportUpdateMode " << (int)_dynamicViewportUpdateMode);
+ BOOL needUpdateVisbleContentRects = _page->updateLayoutViewportParameters(layerTreeTransaction);
+
if (_dynamicViewportUpdateMode != DynamicViewportUpdateMode::NotResizing) {
if (_resizeAnimationTransformTransactionID && layerTreeTransaction.transactionID() >= _resizeAnimationTransformTransactionID.value()) {
_resizeAnimationTransformTransactionID = std::nullopt;
@@ -1514,8 +1516,6 @@
_stableStatePresentationUpdateCallbacks = nil;
}
- BOOL needUpdateVisbleContentRects = _page->updateLayoutViewportParameters(layerTreeTransaction);
-
if (![_contentView _mayDisableDoubleTapGesturesDuringSingleTap])
[_contentView _setDoubleTapGesturesEnabled:self._allowsDoubleTapGestures];
Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (218373 => 218374)
--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm 2017-06-16 01:39:31 UTC (rev 218373)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm 2017-06-16 01:43:27 UTC (rev 218374)
@@ -259,7 +259,7 @@
FloatSize constainedSize = isBelowMinimumScale ? constrainedUnobscuredRect.size() : unobscuredContentRect.size();
FloatRect unobscuredContentRectForViewport = isBelowMinimumScale ? constrainedUnobscuredRect : unobscuredContentRectRespectingInputViewBounds;
-
+
FloatRect layoutViewportRect = FrameView::computeUpdatedLayoutViewportRect(LayoutRect(currentCustomFixedPositionRect), LayoutRect(documentRect), LayoutSize(constainedSize), LayoutRect(unobscuredContentRectForViewport), m_baseLayoutViewportSize, m_minStableLayoutViewportOrigin, m_maxStableLayoutViewportOrigin, constraint);
if (layoutViewportRect != currentCustomFixedPositionRect)
@@ -404,15 +404,18 @@
bool WebPageProxy::updateLayoutViewportParameters(const WebKit::RemoteLayerTreeTransaction& layerTreeTransaction)
{
- bool changed = m_baseLayoutViewportSize != layerTreeTransaction.baseLayoutViewportSize()
- || m_minStableLayoutViewportOrigin != layerTreeTransaction.minStableLayoutViewportOrigin()
- || m_maxStableLayoutViewportOrigin != layerTreeTransaction.maxStableLayoutViewportOrigin();
+ if (m_baseLayoutViewportSize == layerTreeTransaction.baseLayoutViewportSize()
+ && m_minStableLayoutViewportOrigin == layerTreeTransaction.minStableLayoutViewportOrigin()
+ && m_maxStableLayoutViewportOrigin == layerTreeTransaction.maxStableLayoutViewportOrigin())
+ return false;
m_baseLayoutViewportSize = layerTreeTransaction.baseLayoutViewportSize();
m_minStableLayoutViewportOrigin = layerTreeTransaction.minStableLayoutViewportOrigin();
m_maxStableLayoutViewportOrigin = layerTreeTransaction.maxStableLayoutViewportOrigin();
-
- return changed;
+
+ LOG_WITH_STREAM(VisibleRects, stream << "WebPageProxy::updateLayoutViewportParameters: baseLayoutViewportSize: " << m_baseLayoutViewportSize << " minStableLayoutViewportOrigin: " << m_minStableLayoutViewportOrigin << " maxStableLayoutViewportOrigin: " << m_maxStableLayoutViewportOrigin);
+
+ return true;
}
void WebPageProxy::layerTreeCommitComplete()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes