Changeset 218374 in webkit


Ignore:
Timestamp:
Jun 15, 2017, 6:43:27 PM (8 years ago)
Author:
Simon Fraser
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.

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r218343 r218374  
     12017-06-15  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] YouTube videos flash at the wrong place at the end of rotation
     4        https://bugs.webkit.org/show_bug.cgi?id=173445
     5        rdar://problem/31584852
     6
     7        Reviewed by Tim Horton.
     8
     9        In MobileSafari where WKWebView rotation uses _dynamicViewportUpdateModes, we could do a
     10        visibleContentRect update at the end of rotation which computed a bad layoutViewportRect,
     11        because it used a m_baseLayoutViewportSize from the old orientation.
     12
     13        We have actually sent a new m_baseLayoutViewportSize to the UI process by this point in
     14        a layer tree commit, but _didCommitLayerTree: ignored it because we had a _dynamicViewportUpdateMode.
     15
     16        Fix is to always update the layout viewport data from the web process, since during dynamic
     17        viewport updates, we still need these data to compute rectangles sent back to the web process via
     18        visible content rect updates.
     19
     20        * UIProcess/API/Cocoa/WKWebView.mm:
     21        (-[WKWebView _didCommitLayerTree:]):
     22        * UIProcess/ios/WebPageProxyIOS.mm:
     23        (WebKit::WebPageProxy::computeCustomFixedPositionRect):
     24        (WebKit::WebPageProxy::updateLayoutViewportParameters): Cleanup.
     25
    1262017-06-15  Wenson Hsieh  <wenson_hsieh@apple.com>
    227
  • trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm

    r218144 r218374  
    14791479    LOG_WITH_STREAM(VisibleRects, stream << "-[WKWebView _didCommitLayerTree:] transactionID " <<  layerTreeTransaction.transactionID() << " _dynamicViewportUpdateMode " << (int)_dynamicViewportUpdateMode);
    14801480
     1481    BOOL needUpdateVisbleContentRects = _page->updateLayoutViewportParameters(layerTreeTransaction);
     1482
    14811483    if (_dynamicViewportUpdateMode != DynamicViewportUpdateMode::NotResizing) {
    14821484        if (_resizeAnimationTransformTransactionID && layerTreeTransaction.transactionID() >= _resizeAnimationTransformTransactionID.value()) {
     
    15141516        _stableStatePresentationUpdateCallbacks = nil;
    15151517    }
    1516 
    1517     BOOL needUpdateVisbleContentRects = _page->updateLayoutViewportParameters(layerTreeTransaction);
    15181518
    15191519    if (![_contentView _mayDisableDoubleTapGesturesDuringSingleTap])
  • trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm

    r216794 r218374  
    260260    FloatSize constainedSize = isBelowMinimumScale ? constrainedUnobscuredRect.size() : unobscuredContentRect.size();
    261261    FloatRect unobscuredContentRectForViewport = isBelowMinimumScale ? constrainedUnobscuredRect : unobscuredContentRectRespectingInputViewBounds;
    262    
     262
    263263    FloatRect layoutViewportRect = FrameView::computeUpdatedLayoutViewportRect(LayoutRect(currentCustomFixedPositionRect), LayoutRect(documentRect), LayoutSize(constainedSize), LayoutRect(unobscuredContentRectForViewport), m_baseLayoutViewportSize, m_minStableLayoutViewportOrigin, m_maxStableLayoutViewportOrigin, constraint);
    264264   
     
    405405bool WebPageProxy::updateLayoutViewportParameters(const WebKit::RemoteLayerTreeTransaction& layerTreeTransaction)
    406406{
    407     bool changed = m_baseLayoutViewportSize != layerTreeTransaction.baseLayoutViewportSize()
    408         || m_minStableLayoutViewportOrigin != layerTreeTransaction.minStableLayoutViewportOrigin()
    409         || m_maxStableLayoutViewportOrigin != layerTreeTransaction.maxStableLayoutViewportOrigin();
     407    if (m_baseLayoutViewportSize == layerTreeTransaction.baseLayoutViewportSize()
     408        && m_minStableLayoutViewportOrigin == layerTreeTransaction.minStableLayoutViewportOrigin()
     409        && m_maxStableLayoutViewportOrigin == layerTreeTransaction.maxStableLayoutViewportOrigin())
     410        return false;
    410411
    411412    m_baseLayoutViewportSize = layerTreeTransaction.baseLayoutViewportSize();
    412413    m_minStableLayoutViewportOrigin = layerTreeTransaction.minStableLayoutViewportOrigin();
    413414    m_maxStableLayoutViewportOrigin = layerTreeTransaction.maxStableLayoutViewportOrigin();
    414    
    415     return changed;
     415
     416    LOG_WITH_STREAM(VisibleRects, stream << "WebPageProxy::updateLayoutViewportParameters: baseLayoutViewportSize: " << m_baseLayoutViewportSize << " minStableLayoutViewportOrigin: " << m_minStableLayoutViewportOrigin << " maxStableLayoutViewportOrigin: " << m_maxStableLayoutViewportOrigin);
     417
     418    return true;
    416419}
    417420
Note: See TracChangeset for help on using the changeset viewer.