WebKit Bugzilla
Attachment 341717 Details for
Bug 186130
: Move animated resize into the layer tree transaction, and make it asynchronous
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186130-20180531173808.patch (text/plain), 46.46 KB, created by
Tim Horton
on 2018-05-31 17:38:21 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tim Horton
Created:
2018-05-31 17:38:21 PDT
Size:
46.46 KB
patch
obsolete
>Subversion Revision: 232209 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 79085998915e70e282ddc1aba0472e2efd69c423..3e58be738efbfef8d43c1b9cc0436b3c62093c8f 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,85 @@ >+2018-05-31 Tim Horton <timothy_horton@apple.com> >+ >+ Move animated resize into the layer tree transaction, and make it asynchronous >+ https://bugs.webkit.org/show_bug.cgi?id=186130 >+ <rdar://problem/38477288> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h: >+ (WebKit::RemoteLayerTreeTransaction::setScrollPosition): >+ (WebKit::RemoteLayerTreeTransaction::dynamicViewportSizeUpdateID const): >+ (WebKit::RemoteLayerTreeTransaction::setDynamicViewportSizeUpdateID): >+ * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm: >+ (WebKit::RemoteLayerTreeTransaction::encode const): >+ (WebKit::RemoteLayerTreeTransaction::decode): >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage::willCommitLayerTree): >+ Add scrollPosition to the transaction on all platforms, not just Mac. >+ Add the optional dynamicViewportSizeUpdateID to the transaction, representing >+ the most recent dynamicViewportSizeUpdate that commit contains, if any. >+ >+ * UIProcess/ios/PageClientImplIOS.h: >+ * UIProcess/ios/PageClientImplIOS.mm: >+ (WebKit::PageClientImpl::dynamicViewportUpdateChangedTarget): Deleted. >+ * UIProcess/PageClient.h: >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::resetState): >+ * UIProcess/WebPageProxy.h: >+ * UIProcess/WebPageProxy.messages.in: >+ * UIProcess/ios/WebPageProxyIOS.mm: >+ (WebKit::WebPageProxy::dynamicViewportSizeUpdate): >+ (WebKit::WebPageProxy::didCommitLayerTree): >+ (WebKit::WebPageProxy::synchronizeDynamicViewportUpdate): Deleted. >+ (WebKit::WebPageProxy::dynamicViewportUpdateChangedTarget): Deleted. >+ * WebProcess/WebPage/WebPage.h: >+ * WebProcess/WebPage/WebPage.messages.in: >+ * WebProcess/WebPage/ios/WebPageIOS.mm: >+ (WebKit::WebPage::dynamicViewportSizeUpdate): >+ (WebKit::WebPage::synchronizeDynamicViewportUpdate): Deleted. >+ Remove dynamicViewportUpdateChangedTarget and synchronizeDynamicViewportUpdate. >+ Move dynamicViewportSizeUpdateID maintenance into WKWebView. >+ >+ * UIProcess/API/Cocoa/WKWebView.mm: >+ (-[WKWebView _processDidExit]): >+ Remove _resizeAnimationTransformTransactionID. We now instead pack >+ the resize ID inside the transaction, instead of separately sending >+ back a transaction ID to wait for. >+ >+ (-[WKWebView _didCommitLayerTreeDuringAnimatedResize:]): >+ (-[WKWebView _didCommitLayerTree:]): >+ Added, factored out of _didCommitLayerTree:. >+ If the transaction includes the result of the most recently-sent resize, >+ store the requisite adjustments required to counter the new scale and >+ scroll offset, update the resizeAnimationView, and, if endAnimatedResize >+ has already been called, call _didCompleteAnimatedResize to tear down >+ the animation view and put things back together. >+ >+ Add some code so that if a commit arrives before the resize, we update >+ the scale of the resize animation view to keep the width fitting. >+ >+ (activeMaximumUnobscuredSize): >+ (activeOrientation): >+ Move these because the code that depends on them moved. >+ >+ (-[WKWebView _didCompleteAnimatedResize]): >+ Broken out of _endAnimatedResize. This can now be called from >+ either endAnimatedResize or _didCommitLayerTreeDuringAnimatedResize, >+ depending on which is called first. >+ >+ (-[WKWebView _beginAnimatedResizeWithUpdates:]): >+ Don't create a new resize view if we still have one. Otherwise, we'll >+ get the view ordering all wrong when making the second one. This >+ didn't previously cause trouble, because we don't have a lot of >+ WKScrollView subviews, but it totally could. >+ >+ Adopt _initialContentOffsetForScrollView just to make this code more clear. >+ >+ (-[WKWebView _endAnimatedResize]): >+ (-[WKWebView _dynamicViewportUpdateChangedTargetToScale:position:nextValidLayerTreeTransactionID:]): Deleted. >+ * UIProcess/API/Cocoa/WKWebViewInternal.h: >+ >+ > 2018-05-25 Tim Horton <timothy_horton@apple.com> > > Ensure that the Web Content process doesn't sleep during initialization >diff --git a/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h b/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h >index f156c23354955db7c1b2650b0f0bba3c01d7b336..0cba87113c093f0dab6227e4f84498e927829529 100644 >--- a/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h >+++ b/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h >@@ -218,10 +218,8 @@ public: > WebCore::Color pageExtendedBackgroundColor() const { return m_pageExtendedBackgroundColor; } > void setPageExtendedBackgroundColor(WebCore::Color color) { m_pageExtendedBackgroundColor = color; } > >-#if PLATFORM(MAC) > WebCore::IntPoint scrollPosition() const { return m_scrollPosition; } > void setScrollPosition(WebCore::IntPoint p) { m_scrollPosition = p; } >-#endif > > double pageScaleFactor() const { return m_pageScaleFactor; } > void setPageScaleFactor(double pageScaleFactor) { m_pageScaleFactor = pageScaleFactor; } >@@ -272,6 +270,9 @@ public: > bool hasEditorState() const { return !!m_editorState; } > const EditorState& editorState() const { return m_editorState.value(); } > void setEditorState(const EditorState& editorState) { m_editorState = editorState; } >+ >+ std::optional<uint64_t> dynamicViewportSizeUpdateID() const { return m_dynamicViewportSizeUpdateID; } >+ void setDynamicViewportSizeUpdateID(uint64_t resizeID) { m_dynamicViewportSizeUpdateID = resizeID; } > > private: > WebCore::GraphicsLayer::PlatformLayerID m_rootLayerID; >@@ -290,9 +291,7 @@ private: > WebCore::LayoutSize m_baseLayoutViewportSize; > WebCore::LayoutPoint m_minStableLayoutViewportOrigin; > WebCore::LayoutPoint m_maxStableLayoutViewportOrigin; >-#if PLATFORM(MAC) > WebCore::IntPoint m_scrollPosition; >-#endif > WebCore::Color m_pageExtendedBackgroundColor; > double m_pageScaleFactor { 1 }; > double m_minimumScaleFactor { 1 }; >@@ -310,6 +309,7 @@ private: > bool m_isInStableState { false }; > > std::optional<EditorState> m_editorState { std::nullopt }; >+ std::optional<uint64_t> m_dynamicViewportSizeUpdateID { std::nullopt }; > }; > > } // namespace WebKit >diff --git a/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm b/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm >index caf72df3d15577ead420d28e0ae155c3d028001e..c2517ffb932fb99f143591c4f291a2ac0e92dbc0 100644 >--- a/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm >+++ b/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm >@@ -533,9 +533,8 @@ void RemoteLayerTreeTransaction::encode(IPC::Encoder& encoder) const > encoder << m_minStableLayoutViewportOrigin; > encoder << m_maxStableLayoutViewportOrigin; > >-#if PLATFORM(MAC) > encoder << m_scrollPosition; >-#endif >+ > encoder << m_pageExtendedBackgroundColor; > encoder << m_pageScaleFactor; > encoder << m_minimumScaleFactor; >@@ -563,6 +562,8 @@ void RemoteLayerTreeTransaction::encode(IPC::Encoder& encoder) const > encoder << hasEditorState(); > if (m_editorState) > encoder << *m_editorState; >+ >+ encoder << m_dynamicViewportSizeUpdateID; > } > > bool RemoteLayerTreeTransaction::decode(IPC::Decoder& decoder, RemoteLayerTreeTransaction& result) >@@ -624,11 +625,9 @@ bool RemoteLayerTreeTransaction::decode(IPC::Decoder& decoder, RemoteLayerTreeTr > > if (!decoder.decode(result.m_maxStableLayoutViewportOrigin)) > return false; >- >-#if PLATFORM(MAC) >+ > if (!decoder.decode(result.m_scrollPosition)) > return false; >-#endif > > if (!decoder.decode(result.m_pageExtendedBackgroundColor)) > return false; >@@ -692,6 +691,9 @@ bool RemoteLayerTreeTransaction::decode(IPC::Decoder& decoder, RemoteLayerTreeTr > result.setEditorState(editorState); > } > >+ if (!decoder.decode(result.m_dynamicViewportSizeUpdateID)) >+ return false; >+ > return true; > } > >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >index e988f9a9aa6240c395febc40961663a76abbe1e3..b5f2f7f45b41a94056a9e2cd405d50f7241bf1d4 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >@@ -312,8 +312,8 @@ @implementation WKWebView { > BOOL _needsResetViewStateAfterCommitLoadForMainFrame; > uint64_t _firstPaintAfterCommitLoadTransactionID; > DynamicViewportUpdateMode _dynamicViewportUpdateMode; >+ uint64_t _currentDynamicViewportSizeUpdateID; > CATransform3D _resizeAnimationTransformAdjustments; >- std::optional<uint64_t> _resizeAnimationTransformTransactionID; > RetainPtr<UIView> _resizeAnimationView; > CGFloat _lastAdjustmentForScroller; > std::optional<CGRect> _frozenVisibleContentRect; >@@ -348,6 +348,8 @@ @implementation WKWebView { > BOOL _hadDelayedUpdateVisibleContentRects; > > int _activeAnimatedResizeCount; >+ BOOL _waitingForEndAnimatedResize; >+ BOOL _waitingForCommitAfterAnimatedResize; > > Vector<WTF::Function<void ()>> _snapshotsDeferredDuringResize; > RetainPtr<NSMutableArray> _stableStatePresentationUpdateCallbacks; >@@ -357,15 +359,13 @@ @implementation WKWebView { > BOOL _hasScheduledVisibleRectUpdate; > BOOL _visibleContentRectUpdateScheduledFromScrollViewInStableState; > Vector<BlockPtr<void ()>> _visibleContentRectUpdateCallbacks; >+ >+ _WKDragInteractionPolicy _dragInteractionPolicy; > #endif > #if PLATFORM(MAC) > std::unique_ptr<WebKit::WebViewImpl> _impl; > RetainPtr<WKTextFinderClient> _textFinderClient; > #endif >- >-#if PLATFORM(IOS) >- _WKDragInteractionPolicy _dragInteractionPolicy; >-#endif > } > > - (instancetype)initWithFrame:(CGRect)frame >@@ -1700,7 +1700,6 @@ - (void)_processDidExit > > _firstPaintAfterCommitLoadTransactionID = 0; > _firstTransactionIDAfterPageRestore = std::nullopt; >- _resizeAnimationTransformTransactionID = std::nullopt; > > _hasScheduledVisibleRectUpdate = NO; > _commitDidRestoreScrollPosition = NO; >@@ -1756,6 +1755,46 @@ static inline bool areEssentiallyEqualAsFloat(float a, float b) > return WTF::areEssentiallyEqual(a, b); > } > >+- (void)_didCommitLayerTreeDuringAnimatedResize:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction >+{ >+ auto updateID = layerTreeTransaction.dynamicViewportSizeUpdateID(); >+ if (updateID && *updateID == _currentDynamicViewportSizeUpdateID) { >+ double pageScale = layerTreeTransaction.pageScaleFactor(); >+ WebCore::IntPoint scrollPosition = layerTreeTransaction.scrollPosition(); >+ >+ CGFloat animatingScaleTarget = [[_resizeAnimationView layer] transform].m11; >+ double currentTargetScale = animatingScaleTarget * [[_contentView layer] transform].m11; >+ double scale = pageScale / currentTargetScale; >+ _resizeAnimationTransformAdjustments = CATransform3DMakeScale(scale, scale, 1); >+ >+ CGPoint newContentOffset = [self _contentOffsetAdjustedForObscuredInset:CGPointMake(scrollPosition.x() * pageScale, scrollPosition.y() * pageScale)]; >+ CGPoint currentContentOffset = [_scrollView contentOffset]; >+ >+ _resizeAnimationTransformAdjustments.m41 = (currentContentOffset.x - newContentOffset.x) / animatingScaleTarget; >+ _resizeAnimationTransformAdjustments.m42 = (currentContentOffset.y - newContentOffset.y) / animatingScaleTarget; >+ >+ [_resizeAnimationView layer].sublayerTransform = _resizeAnimationTransformAdjustments; >+ >+ // If we've already passed endAnimatedResize, immediately complete >+ // the resize when we have an up-to-date layer tree. Otherwise, >+ // we will defer completion until endAnimatedResize. >+ _waitingForCommitAfterAnimatedResize = NO; >+ if (!_waitingForEndAnimatedResize) >+ [self _didCompleteAnimatedResize]; >+ >+ return; >+ } >+ >+ // If a commit arrives during a resize but before the layer tree takes the current >+ // resize into account, it could change the WKContentView's size. Update the >+ // resizeAnimationView's scale to ensure we continue to fill the width of the resize target. >+ CGFloat visibleContentViewWidthInContentCoordinates = std::min<CGFloat>([_contentView bounds].size.width, _page->unobscuredContentRect().width()); >+ auto newViewLayoutSize = [self activeViewLayoutSize:self.bounds]; >+ CGFloat targetScale = newViewLayoutSize.width() / visibleContentViewWidthInContentCoordinates; >+ CGFloat resizeAnimationViewScale = targetScale / contentZoomScale(self); >+ [_resizeAnimationView setTransform:CGAffineTransformMakeScale(resizeAnimationViewScale, resizeAnimationViewScale)]; >+} >+ > - (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction > { > if (![self usesStandardContentView]) >@@ -1766,14 +1805,7 @@ - (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTree > bool needUpdateVisibleContentRects = _page->updateLayoutViewportParameters(layerTreeTransaction); > > if (_dynamicViewportUpdateMode != DynamicViewportUpdateMode::NotResizing) { >- if (_resizeAnimationTransformTransactionID && layerTreeTransaction.transactionID() >= _resizeAnimationTransformTransactionID.value()) { >- _resizeAnimationTransformTransactionID = std::nullopt; >- [_resizeAnimationView layer].sublayerTransform = _resizeAnimationTransformAdjustments; >- if (_dynamicViewportUpdateMode == DynamicViewportUpdateMode::ResizingWithDocumentHidden) { >- [_contentView setHidden:NO]; >- [self _endAnimatedResize]; >- } >- } >+ [self _didCommitLayerTreeDuringAnimatedResize:layerTreeTransaction]; > return; > } > >@@ -1873,25 +1905,6 @@ - (void)_layerTreeCommitComplete > _commitDidRestoreScrollPosition = NO; > } > >-- (void)_dynamicViewportUpdateChangedTargetToScale:(double)newScale position:(CGPoint)newScrollPosition nextValidLayerTreeTransactionID:(uint64_t)nextValidLayerTreeTransactionID >-{ >- LOG_WITH_STREAM(VisibleRects, stream << "-[WKWebView " << _page->pageID() << " _dynamicViewportUpdateChangedTargetToScale:] " << newScale << " _dynamicViewportUpdateMode " << (int)_dynamicViewportUpdateMode); >- >- if (_dynamicViewportUpdateMode != DynamicViewportUpdateMode::NotResizing) { >- CGFloat animatingScaleTarget = [[_resizeAnimationView layer] transform].m11; >- double currentTargetScale = animatingScaleTarget * [[_contentView layer] transform].m11; >- double scale = newScale / currentTargetScale; >- _resizeAnimationTransformAdjustments = CATransform3DMakeScale(scale, scale, 1); >- >- CGPoint newContentOffset = [self _contentOffsetAdjustedForObscuredInset:CGPointMake(newScrollPosition.x * newScale, newScrollPosition.y * newScale)]; >- CGPoint currentContentOffset = [_scrollView contentOffset]; >- >- _resizeAnimationTransformAdjustments.m41 = (currentContentOffset.x - newContentOffset.x) / animatingScaleTarget; >- _resizeAnimationTransformAdjustments.m42 = (currentContentOffset.y - newContentOffset.y) / animatingScaleTarget; >- _resizeAnimationTransformTransactionID = nextValidLayerTreeTransactionID; >- } >-} >- > - (void)_couldNotRestorePageState > { > // The gestureController may be waiting for the scroll position to be restored >@@ -2831,6 +2844,82 @@ - (void)_updateVisibleContentRects > } > } > >+static WebCore::FloatSize activeMaximumUnobscuredSize(WKWebView *webView, const CGRect& bounds) >+{ >+ return WebCore::FloatSize(webView->_overridesMaximumUnobscuredSize ? webView->_maximumUnobscuredSizeOverride : bounds.size); >+} >+ >+static int32_t activeOrientation(WKWebView *webView) >+{ >+ return webView->_overridesInterfaceOrientation ? deviceOrientationForUIInterfaceOrientation(webView->_interfaceOrientationOverride) : webView->_page->deviceOrientation(); >+} >+ >+- (void)_didCompleteAnimatedResize >+{ >+ if (_dynamicViewportUpdateMode == DynamicViewportUpdateMode::NotResizing) >+ return; >+ >+ [_contentView setHidden:NO]; >+ >+ if (!_resizeAnimationView) { >+ // Paranoia. If _resizeAnimationView is null we'll end up setting a zero scale on the content view. >+ RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _endAnimatedResize:] - _resizeAnimationView is nil", self); >+ _dynamicViewportUpdateMode = DynamicViewportUpdateMode::NotResizing; >+ return; >+ } >+ >+ --_activeAnimatedResizeCount; >+ NSUInteger indexOfResizeAnimationView = [[_scrollView subviews] indexOfObject:_resizeAnimationView.get()]; >+ [_scrollView insertSubview:_contentView.get() atIndex:indexOfResizeAnimationView]; >+ [_scrollView insertSubview:[_contentView unscaledView] atIndex:indexOfResizeAnimationView + 1]; >+ >+ CALayer *contentLayer = [_contentView layer]; >+ CGFloat adjustmentScale = _resizeAnimationTransformAdjustments.m11; >+ contentLayer.sublayerTransform = CATransform3DIdentity; >+ >+ CGFloat animatingScaleTarget = [[_resizeAnimationView layer] transform].m11; >+ CATransform3D contentLayerTransform = contentLayer.transform; >+ CGFloat currentScale = [[_resizeAnimationView layer] transform].m11 * contentLayerTransform.m11; >+ >+ // We cannot use [UIScrollView setZoomScale:] directly because the UIScrollView delegate would get a callback with >+ // an invalid contentOffset. The real content offset is only set below. >+ // Since there is no public API for setting both the zoomScale and the contentOffset, we set the zoomScale manually >+ // on the zoom layer and then only change the contentOffset. >+ CGFloat adjustedScale = adjustmentScale * currentScale; >+ contentLayerTransform.m11 = adjustedScale; >+ contentLayerTransform.m22 = adjustedScale; >+ contentLayer.transform = contentLayerTransform; >+ >+ CGPoint currentScrollOffset = [_scrollView contentOffset]; >+ double horizontalScrollAdjustement = _resizeAnimationTransformAdjustments.m41 * animatingScaleTarget; >+ double verticalScrollAdjustment = _resizeAnimationTransformAdjustments.m42 * animatingScaleTarget; >+ >+ [_scrollView setContentSize:roundScrollViewContentSize(*_page, [_contentView frame].size)]; >+ [_scrollView setContentOffset:CGPointMake(currentScrollOffset.x - horizontalScrollAdjustement, currentScrollOffset.y - verticalScrollAdjustment)]; >+ >+ [_resizeAnimationView removeFromSuperview]; >+ _resizeAnimationView = nil; >+ _resizeAnimationTransformAdjustments = CATransform3DIdentity; >+ >+ _dynamicViewportUpdateMode = DynamicViewportUpdateMode::NotResizing; >+ [self _scheduleVisibleContentRectUpdate]; >+ >+ CGRect newBounds = self.bounds; >+ auto newViewLayoutSize = [self activeViewLayoutSize:newBounds]; >+ auto newMaximumUnobscuredSize = activeMaximumUnobscuredSize(self, newBounds); >+ int32_t newOrientation = activeOrientation(self); >+ >+ if (!_lastSentViewLayoutSize || newViewLayoutSize != _lastSentViewLayoutSize.value()) >+ [self _dispatchSetViewLayoutSize:newViewLayoutSize]; >+ if (!_lastSentMaximumUnobscuredSize || newMaximumUnobscuredSize != _lastSentMaximumUnobscuredSize.value()) >+ [self _dispatchSetMaximumUnobscuredSize:WebCore::FloatSize(newMaximumUnobscuredSize)]; >+ if (!_lastSentDeviceOrientation || newOrientation != _lastSentDeviceOrientation.value()) >+ [self _dispatchSetDeviceOrientation:newOrientation]; >+ >+ while (!_snapshotsDeferredDuringResize.isEmpty()) >+ _snapshotsDeferredDuringResize.takeLast()(); >+} >+ > - (void)_didFinishLoadForMainFrame > { > if (_gestureController) >@@ -4213,16 +4302,6 @@ - (void)_setShouldSuppressFirstResponderChanges:(BOOL)shouldSuppress > #endif > > #if PLATFORM(IOS) >-static WebCore::FloatSize activeMaximumUnobscuredSize(WKWebView *webView, const CGRect& bounds) >-{ >- return WebCore::FloatSize(webView->_overridesMaximumUnobscuredSize ? webView->_maximumUnobscuredSizeOverride : bounds.size); >-} >- >-static int32_t activeOrientation(WKWebView *webView) >-{ >- return webView->_overridesInterfaceOrientation ? deviceOrientationForUIInterfaceOrientation(webView->_interfaceOrientationOverride) : webView->_page->deviceOrientation(); >-} >- > - (void (^)(void))_retainActiveFocusedState > { > ++_activeFocusedStateRetainCount; >@@ -5198,12 +5277,14 @@ - (void)_beginAnimatedResizeWithUpdates:(void (^)(void))updateBlock > ++_activeAnimatedResizeCount; > _resizeAnimationTransformAdjustments = CATransform3DIdentity; > >- NSUInteger indexOfContentView = [[_scrollView subviews] indexOfObject:_contentView.get()]; >- _resizeAnimationView = adoptNS([[UIView alloc] init]); >- [_resizeAnimationView layer].name = @"ResizeAnimation"; >- [_scrollView insertSubview:_resizeAnimationView.get() atIndex:indexOfContentView]; >- [_resizeAnimationView addSubview:_contentView.get()]; >- [_resizeAnimationView addSubview:[_contentView unscaledView]]; >+ if (!_resizeAnimationView) { >+ NSUInteger indexOfContentView = [[_scrollView subviews] indexOfObject:_contentView.get()]; >+ _resizeAnimationView = adoptNS([[UIView alloc] init]); >+ [_resizeAnimationView layer].name = @"ResizeAnimation"; >+ [_scrollView insertSubview:_resizeAnimationView.get() atIndex:indexOfContentView]; >+ [_resizeAnimationView addSubview:_contentView.get()]; >+ [_resizeAnimationView addSubview:[_contentView unscaledView]]; >+ } > > CGSize contentSizeInContentViewCoordinates = contentViewBounds.size; > [_scrollView setMinimumZoomScale:std::min(newViewLayoutSize.width() / contentSizeInContentViewCoordinates.width, [_scrollView minimumZoomScale])]; >@@ -5240,7 +5321,7 @@ - (void)_beginAnimatedResizeWithUpdates:(void (^)(void))updateBlock > if (oldUnobscuredContentRect.maxY() > contentSizeInContentViewCoordinates.height - 1) > contentOffset.y = maxVerticalOffset; > if (oldUnobscuredContentRect.y() < 1) >- contentOffset.y = -_obscuredInsets.top; >+ contentOffset.y = [self _initialContentOffsetForScrollView].y; > > // FIXME: if we have content centered after double tap to zoom, we should also try to keep that rect in view. > [_scrollView setContentSize:roundScrollViewContentSize(*_page, futureContentSizeInSelfCoordinates)]; >@@ -5256,9 +5337,12 @@ - (void)_beginAnimatedResizeWithUpdates:(void (^)(void))updateBlock > _lastSentMaximumUnobscuredSize = newMaximumUnobscuredSize; > _lastSentDeviceOrientation = newOrientation; > >- _page->dynamicViewportSizeUpdate(newViewLayoutSize, newMaximumUnobscuredSize, visibleRectInContentCoordinates, unobscuredRectInContentCoordinates, futureUnobscuredRectInSelfCoordinates, unobscuredSafeAreaInsetsExtent, targetScale, newOrientation); >+ _page->dynamicViewportSizeUpdate(newViewLayoutSize, newMaximumUnobscuredSize, visibleRectInContentCoordinates, unobscuredRectInContentCoordinates, futureUnobscuredRectInSelfCoordinates, unobscuredSafeAreaInsetsExtent, targetScale, newOrientation, ++_currentDynamicViewportSizeUpdateID); > if (WebKit::DrawingAreaProxy* drawingArea = _page->drawingArea()) > drawingArea->setSize(WebCore::IntSize(newBounds.size)); >+ >+ _waitingForCommitAfterAnimatedResize = YES; >+ _waitingForEndAnimatedResize = YES; > } > > - (void)_endAnimatedResize >@@ -5268,75 +5352,11 @@ - (void)_endAnimatedResize > if ([_customContentView respondsToSelector:@selector(web_endAnimatedResize)]) > [_customContentView web_endAnimatedResize]; > >- if (_dynamicViewportUpdateMode == DynamicViewportUpdateMode::NotResizing) >- return; >- >- _page->synchronizeDynamicViewportUpdate(); >- >- // synchronizeDynamicViewportUpdate() may cause this function to re-enter via _didCommitLayerTree, so check _dynamicViewportUpdateMode again. >- if (_dynamicViewportUpdateMode == DynamicViewportUpdateMode::NotResizing) >- return; >- >- if (!_resizeAnimationView) { >- // Paranoia. If _resizeAnimationView is null we'll end up setting a zero scale on the content view. >- RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _endAnimatedResize:] - _resizeAnimationView is nil", self); >- _dynamicViewportUpdateMode = DynamicViewportUpdateMode::NotResizing; >- [_contentView setHidden:NO]; >- return; >- } >- >- --_activeAnimatedResizeCount; >- NSUInteger indexOfResizeAnimationView = [[_scrollView subviews] indexOfObject:_resizeAnimationView.get()]; >- [_scrollView insertSubview:_contentView.get() atIndex:indexOfResizeAnimationView]; >- [_scrollView insertSubview:[_contentView unscaledView] atIndex:indexOfResizeAnimationView + 1]; >- >- CALayer *contentViewLayer = [_contentView layer]; >- CGFloat adjustmentScale = _resizeAnimationTransformAdjustments.m11; >- contentViewLayer.sublayerTransform = CATransform3DIdentity; >- >- CGFloat animatingScaleTarget = [[_resizeAnimationView layer] transform].m11; >- CALayer *contentLayer = [_contentView layer]; >- CATransform3D contentLayerTransform = contentLayer.transform; >- CGFloat currentScale = [[_resizeAnimationView layer] transform].m11 * contentLayerTransform.m11; >- >- // We cannot use [UIScrollView setZoomScale:] directly because the UIScrollView delegate would get a callback with >- // an invalid contentOffset. The real content offset is only set below. >- // Since there is no public API for setting both the zoomScale and the contentOffset, we set the zoomScale manually >- // on the zoom layer and then only change the contentOffset. >- CGFloat adjustedScale = adjustmentScale * currentScale; >- contentLayerTransform.m11 = adjustedScale; >- contentLayerTransform.m22 = adjustedScale; >- contentLayer.transform = contentLayerTransform; >- >- CGPoint currentScrollOffset = [_scrollView contentOffset]; >- double horizontalScrollAdjustement = _resizeAnimationTransformAdjustments.m41 * animatingScaleTarget; >- double verticalScrollAdjustment = _resizeAnimationTransformAdjustments.m42 * animatingScaleTarget; >- >- [_scrollView setContentSize:roundScrollViewContentSize(*_page, [_contentView frame].size)]; >- [_scrollView setContentOffset:CGPointMake(currentScrollOffset.x - horizontalScrollAdjustement, currentScrollOffset.y - verticalScrollAdjustment)]; >- >- [_resizeAnimationView removeFromSuperview]; >- _resizeAnimationView = nil; >- _resizeAnimationTransformAdjustments = CATransform3DIdentity; >- >- _dynamicViewportUpdateMode = DynamicViewportUpdateMode::NotResizing; >- [_contentView setHidden:NO]; >- [self _scheduleVisibleContentRectUpdate]; >- >- CGRect newBounds = self.bounds; >- auto newViewLayoutSize = [self activeViewLayoutSize:newBounds]; >- auto newMaximumUnobscuredSize = activeMaximumUnobscuredSize(self, newBounds); >- int32_t newOrientation = activeOrientation(self); >- >- if (!_lastSentViewLayoutSize || newViewLayoutSize != _lastSentViewLayoutSize.value()) >- [self _dispatchSetViewLayoutSize:newViewLayoutSize]; >- if (!_lastSentMaximumUnobscuredSize || newMaximumUnobscuredSize != _lastSentMaximumUnobscuredSize.value()) >- [self _dispatchSetMaximumUnobscuredSize:WebCore::FloatSize(newMaximumUnobscuredSize)]; >- if (!_lastSentDeviceOrientation || newOrientation != _lastSentDeviceOrientation.value()) >- [self _dispatchSetDeviceOrientation:newOrientation]; >- >- while (!_snapshotsDeferredDuringResize.isEmpty()) >- _snapshotsDeferredDuringResize.takeLast()(); >+ // If we already have an up-to-date layer tree, immediately complete >+ // the resize. Otherwise, we will defer completion until we do. >+ _waitingForEndAnimatedResize = NO; >+ if (!_waitingForCommitAfterAnimatedResize) >+ [self _didCompleteAnimatedResize]; > } > > - (void)_resizeWhileHidingContentWithUpdates:(void (^)(void))updateBlock >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h >index 1be7ffb0958a9edb766a207dda8e57eef3aaf568..a84d98de31bfc5c168076ff8640b233ce07a6aef 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h >@@ -82,7 +82,6 @@ struct PrintInfo; > - (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&)layerTreeTransaction; > - (void)_layerTreeCommitComplete; > >-- (void)_dynamicViewportUpdateChangedTargetToScale:(double)newScale position:(CGPoint)newScrollPosition nextValidLayerTreeTransactionID:(uint64_t)nextValidLayerTreeTransactionID; > - (void)_couldNotRestorePageState; > - (void)_restorePageScrollPosition:(std::optional<WebCore::FloatPoint>)scrollPosition scrollOrigin:(WebCore::FloatPoint)scrollOrigin previousObscuredInset:(WebCore::FloatBoxExtent)insets scale:(double)scale; > - (void)_restorePageStateToUnobscuredCenter:(std::optional<WebCore::FloatPoint>)center scale:(double)scale; // FIXME: needs scroll origin? >@@ -105,6 +104,8 @@ struct PrintInfo; > > - (void)_scheduleVisibleContentRectUpdate; > >+- (void)_didCompleteAnimatedResize; >+ > - (void)_didFinishLoadForMainFrame; > - (void)_didFailLoadForMainFrame; > - (void)_didSameDocumentNavigationForMainFrame:(WebKit::SameDocumentNavigationType)navigationType; >diff --git a/Source/WebKit/UIProcess/PageClient.h b/Source/WebKit/UIProcess/PageClient.h >index d7ef697d998a166697f11dc6f9e91e1c967e1819..b658fbb508d8543fe884c56b2f2aff6abdaf6535 100644 >--- a/Source/WebKit/UIProcess/PageClient.h >+++ b/Source/WebKit/UIProcess/PageClient.h >@@ -284,7 +284,6 @@ public: > virtual void didCommitLayerTree(const RemoteLayerTreeTransaction&) = 0; > virtual void layerTreeCommitComplete() = 0; > >- virtual void dynamicViewportUpdateChangedTarget(double newScale, const WebCore::FloatPoint& newScrollPosition, uint64_t transactionID) = 0; > virtual void couldNotRestorePageState() = 0; > virtual void restorePageState(std::optional<WebCore::FloatPoint> scrollPosition, const WebCore::FloatPoint& scrollOrigin, const WebCore::FloatBoxExtent& obscuredInsetsOnSave, double scale) = 0; > virtual void restorePageCenterAndScale(std::optional<WebCore::FloatPoint> center, double scale) = 0; >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index ea43629501c59f2b34f4fbb0be6b740120c08991..7c05045eeaca8f46bdb66af85bd1805fcc15acf4 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -5938,9 +5938,6 @@ void WebPageProxy::resetState(ResetStateReason resetStateReason) > #if PLATFORM(IOS) > m_firstLayerTreeTransactionIdAfterDidCommitLoad = 0; > m_lastVisibleContentRectUpdate = VisibleContentRectUpdateInfo(); >- m_dynamicViewportSizeUpdateWaitingForTarget = false; >- m_dynamicViewportSizeUpdateWaitingForLayerTreeCommit = false; >- m_dynamicViewportSizeUpdateLayerTreeTransactionID = 0; > m_hasNetworkRequestsOnSuspended = false; > m_isKeyboardAnimatingIn = false; > m_isScrollingOrZooming = false; >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index 82e4e046241ee209f5d789c63d0eb783b4feb71c..8d524b193a6c96355e4efdc39a0151983845a13f 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -550,8 +550,7 @@ public: > void overflowScrollWillStartScroll(); > void overflowScrollDidEndScroll(); > >- void dynamicViewportSizeUpdate(const WebCore::FloatSize& viewLayoutSize, const WebCore::FloatSize& maximumUnobscuredSize, const WebCore::FloatRect& targetExposedContentRect, const WebCore::FloatRect& targetUnobscuredRect, const WebCore::FloatRect& targetUnobscuredRectInScrollViewCoordinates, const WebCore::FloatBoxExtent& unobscuredSafeAreaInsets, double targetScale, int32_t deviceOrientation); >- void synchronizeDynamicViewportUpdate(); >+ void dynamicViewportSizeUpdate(const WebCore::FloatSize& viewLayoutSize, const WebCore::FloatSize& maximumUnobscuredSize, const WebCore::FloatRect& targetExposedContentRect, const WebCore::FloatRect& targetUnobscuredRect, const WebCore::FloatRect& targetUnobscuredRectInScrollViewCoordinates, const WebCore::FloatBoxExtent& unobscuredSafeAreaInsets, double targetScale, int32_t deviceOrientation, uint64_t dynamicViewportSizeUpdateID); > > void setViewportConfigurationViewLayoutSize(const WebCore::FloatSize&); > void setMaximumUnobscuredSize(const WebCore::FloatSize&); >@@ -1662,7 +1661,6 @@ private: > WebCore::FloatSize overrideScreenSize(); > float textAutosizingWidth(); > >- void dynamicViewportUpdateChangedTarget(double newTargetScale, const WebCore::FloatPoint& newScrollPosition, uint64_t dynamicViewportSizeUpdateID); > void couldNotRestorePageState(); > void restorePageState(std::optional<WebCore::FloatPoint> scrollPosition, const WebCore::FloatPoint& scrollOrigin, const WebCore::FloatBoxExtent& obscuredInsetsOnSave, double scale); > void restorePageCenterAndScale(std::optional<WebCore::FloatPoint>, double scale); >@@ -1843,11 +1841,7 @@ private: > VisibleContentRectUpdateInfo m_lastVisibleContentRectUpdate; > uint64_t m_firstLayerTreeTransactionIdAfterDidCommitLoad { 0 }; > int32_t m_deviceOrientation { 0 }; >- uint64_t m_dynamicViewportSizeUpdateLayerTreeTransactionID { 0 }; >- uint64_t m_currentDynamicViewportSizeUpdateID { 0 }; > bool m_hasReceivedLayerTreeTransactionAfterDidCommitLoad { true }; >- bool m_dynamicViewportSizeUpdateWaitingForTarget { false }; >- bool m_dynamicViewportSizeUpdateWaitingForLayerTreeCommit { false }; > bool m_hasNetworkRequestsOnSuspended { false }; > bool m_isKeyboardAnimatingIn { false }; > bool m_isScrollingOrZooming { false }; >diff --git a/Source/WebKit/UIProcess/WebPageProxy.messages.in b/Source/WebKit/UIProcess/WebPageProxy.messages.in >index e8b69cdf5df62c65fb85d42ad826456940c6ec6a..105f4cf4257a326b33c4e93561a8e593fa614e97 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.messages.in >+++ b/Source/WebKit/UIProcess/WebPageProxy.messages.in >@@ -389,7 +389,6 @@ messages -> WebPageProxy { > #endif > > #if PLATFORM(IOS) >- DynamicViewportUpdateChangedTarget(double newTargetScale, WebCore::FloatPoint newScrollPosition, uint64_t dynamicViewportSizeUpdateID) > CouldNotRestorePageState() > RestorePageState(std::optional<WebCore::FloatPoint> scrollPosition, WebCore::FloatPoint scrollOrigin, WebCore::RectEdges<float> obscuredInsetsOnSave, double scale) > RestorePageCenterAndScale(std::optional<WebCore::FloatPoint> unobscuredCenter, double scale) >diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.h b/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >index 9a7464ba8a47098a0205d1cd468ac0662d02ac5d..152ff301603d14d17d6fdca5c4d94db2c0805c1c 100644 >--- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >+++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.h >@@ -120,7 +120,6 @@ private: > void didCommitLayerTree(const RemoteLayerTreeTransaction&) override; > void layerTreeCommitComplete() override; > >- void dynamicViewportUpdateChangedTarget(double newScale, const WebCore::FloatPoint& newScrollPosition, uint64_t transactionID) override; > void couldNotRestorePageState() override; > void restorePageState(std::optional<WebCore::FloatPoint>, const WebCore::FloatPoint&, const WebCore::FloatBoxExtent&, double) override; > void restorePageCenterAndScale(std::optional<WebCore::FloatPoint>, double) override; >diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >index 6679a44bfe99d329818cb3e12031fe05a5dbc4b1..beef2183e4ae343e6d08ba3801ecd9838d270c3c 100644 >--- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >+++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >@@ -514,11 +514,6 @@ void PageClientImpl::layerTreeCommitComplete() > [m_contentView _layerTreeCommitComplete]; > } > >-void PageClientImpl::dynamicViewportUpdateChangedTarget(double newScale, const WebCore::FloatPoint& newScrollPosition, uint64_t nextValidLayerTreeTransactionID) >-{ >- [m_webView _dynamicViewportUpdateChangedTargetToScale:newScale position:newScrollPosition nextValidLayerTreeTransactionID:nextValidLayerTreeTransactionID]; >-} >- > void PageClientImpl::couldNotRestorePageState() > { > [m_webView _couldNotRestorePageState]; >diff --git a/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm b/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >index 93732367b15404b1aeb7a4c0f90ef77d15b898db..af93da4ad2b96b2909bd872327c9199daa6f15ec 100644 >--- a/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >+++ b/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm >@@ -306,53 +306,14 @@ void WebPageProxy::overflowScrollDidEndScroll() > m_pageClient.overflowScrollDidEndScroll(); > } > >-void WebPageProxy::dynamicViewportSizeUpdate(const FloatSize& viewLayoutSize, const WebCore::FloatSize& maximumUnobscuredSize, const FloatRect& targetExposedContentRect, const FloatRect& targetUnobscuredRect, const FloatRect& targetUnobscuredRectInScrollViewCoordinates, const WebCore::FloatBoxExtent& unobscuredSafeAreaInsets, double targetScale, int32_t deviceOrientation) >+void WebPageProxy::dynamicViewportSizeUpdate(const FloatSize& viewLayoutSize, const WebCore::FloatSize& maximumUnobscuredSize, const FloatRect& targetExposedContentRect, const FloatRect& targetUnobscuredRect, const FloatRect& targetUnobscuredRectInScrollViewCoordinates, const WebCore::FloatBoxExtent& unobscuredSafeAreaInsets, double targetScale, int32_t deviceOrientation, uint64_t dynamicViewportSizeUpdateID) > { > if (!isValid()) > return; > > hideValidationMessage(); > >- m_dynamicViewportSizeUpdateWaitingForTarget = true; >- m_dynamicViewportSizeUpdateWaitingForLayerTreeCommit = true; >- m_process->send(Messages::WebPage::DynamicViewportSizeUpdate(viewLayoutSize, maximumUnobscuredSize, targetExposedContentRect, targetUnobscuredRect, targetUnobscuredRectInScrollViewCoordinates, unobscuredSafeAreaInsets, targetScale, deviceOrientation, ++m_currentDynamicViewportSizeUpdateID), m_pageID); >-} >- >-void WebPageProxy::synchronizeDynamicViewportUpdate() >-{ >- if (!isValid()) >- return; >- >- if (m_dynamicViewportSizeUpdateWaitingForTarget) { >- // We do not want the UIProcess to finish animated resize with the old content size, scale, etc. >- // If that happens, the UIProcess would start pushing new VisibleContentRectUpdateInfo to the WebProcess with >- // invalid informations. >- // >- // Ideally, the animated resize should just be transactional, and the UIProcess would remain in the "resize" state >- // until both DynamicViewportUpdateChangedTarget and the associated commitLayerTree are finished. >- // The tricky part with such implementation is if a second animated resize starts before the end of the previous one. >- // In that case, the values used for the target state needs to be computed from the output of the previous animated resize. >- // >- // The following is a workaround to have the UIProcess in a consistent state. >- // Instead of handling nested resize, we block the UIProcess until the animated resize finishes. >- double newScale; >- FloatPoint newScrollPosition; >- uint64_t nextValidLayerTreeTransactionID; >- if (m_process->sendSync(Messages::WebPage::SynchronizeDynamicViewportUpdate(), Messages::WebPage::SynchronizeDynamicViewportUpdate::Reply(newScale, newScrollPosition, nextValidLayerTreeTransactionID), m_pageID, 2_s)) { >- m_dynamicViewportSizeUpdateWaitingForTarget = false; >- m_dynamicViewportSizeUpdateLayerTreeTransactionID = nextValidLayerTreeTransactionID; >- m_pageClient.dynamicViewportUpdateChangedTarget(newScale, newScrollPosition, nextValidLayerTreeTransactionID); >- } >- >- } >- >- // If m_dynamicViewportSizeUpdateWaitingForTarget is false, we are waiting for the next valid frame with the hope it is the one for the new target. >- // If m_dynamicViewportSizeUpdateWaitingForTarget is still true, this is a desperate attempt to get the valid frame before finishing the animation. >- if (m_dynamicViewportSizeUpdateWaitingForLayerTreeCommit) >- m_drawingArea->waitForDidUpdateActivityState(); >- >- m_dynamicViewportSizeUpdateWaitingForTarget = false; >- m_dynamicViewportSizeUpdateWaitingForLayerTreeCommit = false; >+ m_process->send(Messages::WebPage::DynamicViewportSizeUpdate(viewLayoutSize, maximumUnobscuredSize, targetExposedContentRect, targetUnobscuredRect, targetUnobscuredRectInScrollViewCoordinates, unobscuredSafeAreaInsets, targetScale, deviceOrientation, dynamicViewportSizeUpdateID), m_pageID); > } > > void WebPageProxy::setViewportConfigurationViewLayoutSize(const WebCore::FloatSize& size) >@@ -407,11 +368,6 @@ void WebPageProxy::didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction& > } > } > >- if (!m_dynamicViewportSizeUpdateWaitingForTarget && m_dynamicViewportSizeUpdateWaitingForLayerTreeCommit) { >- if (layerTreeTransaction.transactionID() >= m_dynamicViewportSizeUpdateLayerTreeTransactionID) >- m_dynamicViewportSizeUpdateWaitingForLayerTreeCommit = false; >- } >- > m_pageClient.didCommitLayerTree(layerTreeTransaction); > > // FIXME: Remove this special mechanism and fold it into the transaction's layout milestones. >@@ -904,18 +860,6 @@ float WebPageProxy::textAutosizingWidth() > return WebCore::screenSize().width(); > } > >-void WebPageProxy::dynamicViewportUpdateChangedTarget(double newScale, const WebCore::FloatPoint& newScrollPosition, uint64_t dynamicViewportSizeUpdateID) >-{ >- if (dynamicViewportSizeUpdateID != m_currentDynamicViewportSizeUpdateID) >- return; >- >- if (m_dynamicViewportSizeUpdateWaitingForTarget) { >- m_dynamicViewportSizeUpdateLayerTreeTransactionID = downcast<RemoteLayerTreeDrawingAreaProxy>(*drawingArea()).nextLayerTreeTransactionID(); >- m_dynamicViewportSizeUpdateWaitingForTarget = false; >- m_pageClient.dynamicViewportUpdateChangedTarget(newScale, newScrollPosition, m_dynamicViewportSizeUpdateLayerTreeTransactionID); >- } >-} >- > void WebPageProxy::couldNotRestorePageState() > { > m_pageClient.couldNotRestorePageState(); >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index 714d0f1547a3418ae2dc4ebc6da326074f0ded9a..051a04cfca9f7af2a87d564c25832da42c5945e2 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -3219,11 +3219,13 @@ void WebPage::willCommitLayerTree(RemoteLayerTreeTransaction& layerTransaction) > layerTransaction.setAvoidsUnsafeArea(m_viewportConfiguration.avoidsUnsafeArea()); > layerTransaction.setIsInStableState(m_isInStableState); > layerTransaction.setAllowsUserScaling(allowsUserScaling()); >+ if (m_pendingDynamicViewportSizeUpdateID) { >+ layerTransaction.setDynamicViewportSizeUpdateID(*m_pendingDynamicViewportSizeUpdateID); >+ m_pendingDynamicViewportSizeUpdateID = std::nullopt; >+ } > #endif > >-#if PLATFORM(MAC) > layerTransaction.setScrollPosition(frameView->scrollPosition()); >-#endif > > if (m_hasPendingEditorStateUpdate) { > layerTransaction.setEditorState(editorState()); >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.h b/Source/WebKit/WebProcess/WebPage/WebPage.h >index 333c7cc83e3249070910c4c3ea9b788eab06b900..49fcc6218a08652c4092149c6e678878e246ee6b 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.h >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.h >@@ -886,7 +886,6 @@ public: > void setMaximumUnobscuredSize(const WebCore::FloatSize&); > void setDeviceOrientation(int32_t); > void dynamicViewportSizeUpdate(const WebCore::FloatSize& viewLayoutSize, const WebCore::FloatSize& maximumUnobscuredSize, const WebCore::FloatRect& targetExposedContentRect, const WebCore::FloatRect& targetUnobscuredRect, const WebCore::FloatRect& targetUnobscuredRectInScrollViewCoordinates, const WebCore::FloatBoxExtent& targetUnobscuredSafeAreaInsets, double scale, int32_t deviceOrientation, uint64_t dynamicViewportSizeUpdateID); >- void synchronizeDynamicViewportUpdate(double& newTargetScale, WebCore::FloatPoint& newScrollPosition, uint64_t& nextValidLayerTreeTransactionID); > std::optional<float> scaleFromUIProcess(const VisibleContentRectUpdateInfo&) const; > void updateVisibleContentRects(const VisibleContentRectUpdateInfo&, MonotonicTime oldestTimestamp); > bool scaleWasSetByUIProcess() const { return m_scaleWasSetByUIProcess; } >@@ -1657,6 +1656,7 @@ private: > WebCore::FloatPoint m_pendingSyntheticClickLocation; > WebCore::FloatRect m_previousExposedContentRect; > uint64_t m_currentAssistedNodeIdentifier { 0 }; >+ std::optional<uint64_t> m_pendingDynamicViewportSizeUpdateID; > #endif > > WebCore::Timer m_layerVolatilityTimer; >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >index 41b5147cb5a4f71cff5af725bbd8a7cdbcb121ac..67ccf020a4dabd7c7a3e4e9cfa36e3d42b35f6a9 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.messages.in >@@ -49,7 +49,6 @@ messages -> WebPage LegacyReceiver { > SetMaximumUnobscuredSize(WebCore::FloatSize size) > SetDeviceOrientation(int32_t deviceOrientation) > DynamicViewportSizeUpdate(WebCore::FloatSize viewLayoutSize, WebCore::FloatSize maximumUnobscuredSize, WebCore::FloatRect targetExposedContentRect, WebCore::FloatRect targetUnobscuredRect, WebCore::FloatRect targetUnobscuredRectInScrollViewCoordinates, WebCore::RectEdges<float> targetUnobscuredSafeAreaInsets, double scale, int32_t deviceOrientation, uint64_t dynamicViewportSizeUpdateID) >- SynchronizeDynamicViewportUpdate() -> (double newTargetScale, WebCore::FloatPoint newScrollPosition, uint64_t nextValidLayerTreeTransactionID) > > HandleTap(WebCore::IntPoint point, uint64_t lastLayerTreeTransactionId) > PotentialTapAtPosition(uint64_t requestID, WebCore::FloatPoint point) >diff --git a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >index 2474130b1dc42d7e9ea45e7b43023f12dfcb4c2c..cdbb1f141e5cf2cb3f53e99e18f6adcd7ad89d73 100644 >--- a/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >+++ b/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm >@@ -2670,14 +2670,7 @@ void WebPage::dynamicViewportSizeUpdate(const FloatSize& viewLayoutSize, const W > > m_drawingArea->scheduleCompositingLayerFlush(); > >- send(Messages::WebPageProxy::DynamicViewportUpdateChangedTarget(pageScaleFactor(), frameView.scrollPosition(), dynamicViewportSizeUpdateID)); >-} >- >-void WebPage::synchronizeDynamicViewportUpdate(double& newTargetScale, FloatPoint& newScrollPosition, uint64_t& nextValidLayerTreeTransactionID) >-{ >- newTargetScale = pageScaleFactor(); >- newScrollPosition = m_page->mainFrame().view()->scrollPosition(); >- nextValidLayerTreeTransactionID = downcast<RemoteLayerTreeDrawingArea>(*m_drawingArea).nextTransactionID(); >+ m_pendingDynamicViewportSizeUpdateID = dynamicViewportSizeUpdateID; > } > > void WebPage::resetViewportDefaultConfiguration(WebFrame* frame, bool hasMobileDocType)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186130
:
341649
|
341717
|
342020
|
342036
|
342037
|
342041