Title: [272259] branches/safari-611-branch/Source/WebKit
Revision
272259
Author
[email protected]
Date
2021-02-02 17:39:57 -0800 (Tue, 02 Feb 2021)

Log Message

Cherry-pick r271771. rdar://problem/73890368

    [iOS WK2] Make the "in stable state" bit in visible content rect updates more fine-grained
    https://bugs.webkit.org/show_bug.cgi?id=220875

    Reviewed by Tim Horton.

    VisibleContentRectUpdateInfo contains a single "in stable state" bit, but in a future
    patch the web process will need to know if the UI process is rubberbanding. In addition,
    we can fold "isChangingObscuredInsetsInteractively" into the same state bits.

    So give VisibleContentRectUpdateInfo a OptionSet<ViewStabilityFlag>.

    To give the correct state for non-main UIScrollViews, have _scrollViewIsRubberBanding
    take the UIScrollView in question, and only include isChangingObscuredInsetsInteractively
    if the question is being asked of the main UIScrollView.

    * Shared/VisibleContentRectUpdateInfo.cpp:
    (WebKit::VisibleContentRectUpdateInfo::encode const):
    (WebKit::VisibleContentRectUpdateInfo::decode):
    (WebKit::operator<<):
    * Shared/VisibleContentRectUpdateInfo.h:
    (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
    (WebKit::VisibleContentRectUpdateInfo::inStableState const):
    (WebKit::VisibleContentRectUpdateInfo::viewStability const):
    (WebKit::VisibleContentRectUpdateInfo::isFirstUpdateForNewViewSize const):
    (WebKit::operator==):
    (WebKit::VisibleContentRectUpdateInfo::isChangingObscuredInsetsInteractively const): Deleted.
    * UIProcess/API/Cocoa/WKWebViewInternal.h:
    * UIProcess/API/ios/WKWebViewIOS.mm:
    (-[WKWebView _didRelaunchProcess]):
    (-[WKWebView _scrollViewIsRubberBanding:]):
    (-[WKWebView _viewStabilityState:]):
    (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
    (-[WKWebView _updateVisibleContentRects]):
    (-[WKWebView _scrollViewIsRubberBanding]): Deleted.
    (-[WKWebView _scrollViewIsInStableState:]): Deleted.
    * UIProcess/ios/WKContentView.h:
    * UIProcess/ios/WKContentView.mm:
    (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:viewStability:enclosedInScrollableAncestorView:sendEvenIfUnchanged:]):
    (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:sendEvenIfUnchanged:]): Deleted.
    * WebProcess/WebPage/ios/WebPageIOS.mm:
    (WebKit::WebPage::updateVisibleContentRects):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271771 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-611-branch/Source/WebKit/ChangeLog (272258 => 272259)


--- branches/safari-611-branch/Source/WebKit/ChangeLog	2021-02-03 01:39:53 UTC (rev 272258)
+++ branches/safari-611-branch/Source/WebKit/ChangeLog	2021-02-03 01:39:57 UTC (rev 272259)
@@ -1,5 +1,98 @@
 2021-02-02  Alan Coon  <[email protected]>
 
+        Cherry-pick r271771. rdar://problem/73890368
+
+    [iOS WK2] Make the "in stable state" bit in visible content rect updates more fine-grained
+    https://bugs.webkit.org/show_bug.cgi?id=220875
+    
+    Reviewed by Tim Horton.
+    
+    VisibleContentRectUpdateInfo contains a single "in stable state" bit, but in a future
+    patch the web process will need to know if the UI process is rubberbanding. In addition,
+    we can fold "isChangingObscuredInsetsInteractively" into the same state bits.
+    
+    So give VisibleContentRectUpdateInfo a OptionSet<ViewStabilityFlag>.
+    
+    To give the correct state for non-main UIScrollViews, have _scrollViewIsRubberBanding
+    take the UIScrollView in question, and only include isChangingObscuredInsetsInteractively
+    if the question is being asked of the main UIScrollView.
+    
+    * Shared/VisibleContentRectUpdateInfo.cpp:
+    (WebKit::VisibleContentRectUpdateInfo::encode const):
+    (WebKit::VisibleContentRectUpdateInfo::decode):
+    (WebKit::operator<<):
+    * Shared/VisibleContentRectUpdateInfo.h:
+    (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
+    (WebKit::VisibleContentRectUpdateInfo::inStableState const):
+    (WebKit::VisibleContentRectUpdateInfo::viewStability const):
+    (WebKit::VisibleContentRectUpdateInfo::isFirstUpdateForNewViewSize const):
+    (WebKit::operator==):
+    (WebKit::VisibleContentRectUpdateInfo::isChangingObscuredInsetsInteractively const): Deleted.
+    * UIProcess/API/Cocoa/WKWebViewInternal.h:
+    * UIProcess/API/ios/WKWebViewIOS.mm:
+    (-[WKWebView _didRelaunchProcess]):
+    (-[WKWebView _scrollViewIsRubberBanding:]):
+    (-[WKWebView _viewStabilityState:]):
+    (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
+    (-[WKWebView _updateVisibleContentRects]):
+    (-[WKWebView _scrollViewIsRubberBanding]): Deleted.
+    (-[WKWebView _scrollViewIsInStableState:]): Deleted.
+    * UIProcess/ios/WKContentView.h:
+    * UIProcess/ios/WKContentView.mm:
+    (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:viewStability:enclosedInScrollableAncestorView:sendEvenIfUnchanged:]):
+    (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:sendEvenIfUnchanged:]): Deleted.
+    * WebProcess/WebPage/ios/WebPageIOS.mm:
+    (WebKit::WebPage::updateVisibleContentRects):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271771 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-01-22  Simon Fraser  <[email protected]>
+
+            [iOS WK2] Make the "in stable state" bit in visible content rect updates more fine-grained
+            https://bugs.webkit.org/show_bug.cgi?id=220875
+
+            Reviewed by Tim Horton.
+
+            VisibleContentRectUpdateInfo contains a single "in stable state" bit, but in a future
+            patch the web process will need to know if the UI process is rubberbanding. In addition,
+            we can fold "isChangingObscuredInsetsInteractively" into the same state bits.
+
+            So give VisibleContentRectUpdateInfo a OptionSet<ViewStabilityFlag>.
+
+            To give the correct state for non-main UIScrollViews, have _scrollViewIsRubberBanding
+            take the UIScrollView in question, and only include isChangingObscuredInsetsInteractively
+            if the question is being asked of the main UIScrollView.
+
+            * Shared/VisibleContentRectUpdateInfo.cpp:
+            (WebKit::VisibleContentRectUpdateInfo::encode const):
+            (WebKit::VisibleContentRectUpdateInfo::decode):
+            (WebKit::operator<<):
+            * Shared/VisibleContentRectUpdateInfo.h:
+            (WebKit::VisibleContentRectUpdateInfo::VisibleContentRectUpdateInfo):
+            (WebKit::VisibleContentRectUpdateInfo::inStableState const):
+            (WebKit::VisibleContentRectUpdateInfo::viewStability const):
+            (WebKit::VisibleContentRectUpdateInfo::isFirstUpdateForNewViewSize const):
+            (WebKit::operator==):
+            (WebKit::VisibleContentRectUpdateInfo::isChangingObscuredInsetsInteractively const): Deleted.
+            * UIProcess/API/Cocoa/WKWebViewInternal.h:
+            * UIProcess/API/ios/WKWebViewIOS.mm:
+            (-[WKWebView _didRelaunchProcess]):
+            (-[WKWebView _scrollViewIsRubberBanding:]):
+            (-[WKWebView _viewStabilityState:]):
+            (-[WKWebView _scheduleVisibleContentRectUpdateAfterScrollInView:]):
+            (-[WKWebView _updateVisibleContentRects]):
+            (-[WKWebView _scrollViewIsRubberBanding]): Deleted.
+            (-[WKWebView _scrollViewIsInStableState:]): Deleted.
+            * UIProcess/ios/WKContentView.h:
+            * UIProcess/ios/WKContentView.mm:
+            (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:viewStability:enclosedInScrollableAncestorView:sendEvenIfUnchanged:]):
+            (-[WKContentView didUpdateVisibleRect:unobscuredRect:contentInsets:unobscuredRectInScrollViewCoordinates:obscuredInsets:unobscuredSafeAreaInsets:inputViewBounds:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:sendEvenIfUnchanged:]): Deleted.
+            * WebProcess/WebPage/ios/WebPageIOS.mm:
+            (WebKit::WebPage::updateVisibleContentRects):
+
+2021-02-02  Alan Coon  <[email protected]>
+
         Cherry-pick r271754. rdar://problem/73890755
 
     [WebAuthn] No error is visible after user enters the incorrect PIN

Modified: branches/safari-611-branch/Source/WebKit/Shared/VisibleContentRectUpdateInfo.cpp (272258 => 272259)


--- branches/safari-611-branch/Source/WebKit/Shared/VisibleContentRectUpdateInfo.cpp	2021-02-03 01:39:53 UTC (rev 272258)
+++ branches/safari-611-branch/Source/WebKit/Shared/VisibleContentRectUpdateInfo.cpp	2021-02-03 01:39:57 UTC (rev 272259)
@@ -49,9 +49,8 @@
     encoder << m_scrollVelocity;
     encoder << m_lastLayerTreeTransactionID;
     encoder << m_scale;
-    encoder << m_inStableState;
+    encoder << m_viewStability;
     encoder << m_isFirstUpdateForNewViewSize;
-    encoder << m_isChangingObscuredInsetsInteractively;
     encoder << m_allowShrinkToFit;
     encoder << m_enclosedInScrollableAncestorView;
 }
@@ -80,12 +79,10 @@
         return false;
     if (!decoder.decode(result.m_scale))
         return false;
-    if (!decoder.decode(result.m_inStableState))
+    if (!decoder.decode(result.m_viewStability))
         return false;
     if (!decoder.decode(result.m_isFirstUpdateForNewViewSize))
         return false;
-    if (!decoder.decode(result.m_isChangingObscuredInsetsInteractively))
-        return false;
     if (!decoder.decode(result.m_allowShrinkToFit))
         return false;
     if (!decoder.decode(result.m_enclosedInScrollableAncestorView))
@@ -101,6 +98,18 @@
     return stream.release();
 }
 
+TextStream& operator<<(TextStream& ts, ViewStabilityFlag stabilityFlag)
+{
+    switch (stabilityFlag) {
+    case ViewStabilityFlag::ScrollViewInteracting: ts << "scroll view interacting"; break;
+    case ViewStabilityFlag::ScrollViewAnimatedScrollOrZoom: ts << "scroll view animated scroll or zoom"; break;
+    case ViewStabilityFlag::ScrollViewRubberBanding: ts << "scroll view rubberbanding"; break;
+    case ViewStabilityFlag::ChangingObscuredInsetsInteractively: ts << "changing obscured insets interactively"; break;
+    case ViewStabilityFlag::UnstableForTesting: ts << "unstable for testing"; break;
+    }
+    return ts;
+}
+
 TextStream& operator<<(TextStream& ts, const VisibleContentRectUpdateInfo& info)
 {
     TextStream::GroupScope scope(ts);
@@ -119,10 +128,8 @@
     ts.dumpProperty("unobscuredSafeAreaInsets", info.unobscuredSafeAreaInsets());
 
     ts.dumpProperty("scale", info.scale());
-    ts.dumpProperty("inStableState", info.inStableState());
+    ts.dumpProperty("viewStability", info.viewStability());
     ts.dumpProperty("isFirstUpdateForNewViewSize", info.isFirstUpdateForNewViewSize());
-    if (info.isChangingObscuredInsetsInteractively())
-        ts.dumpProperty("isChangingObscuredInsetsInteractively", info.isChangingObscuredInsetsInteractively());
     if (info.enclosedInScrollableAncestorView())
         ts.dumpProperty("enclosedInScrollableAncestorView", info.enclosedInScrollableAncestorView());
 

Modified: branches/safari-611-branch/Source/WebKit/Shared/VisibleContentRectUpdateInfo.h (272258 => 272259)


--- branches/safari-611-branch/Source/WebKit/Shared/VisibleContentRectUpdateInfo.h	2021-02-03 01:39:53 UTC (rev 272258)
+++ branches/safari-611-branch/Source/WebKit/Shared/VisibleContentRectUpdateInfo.h	2021-02-03 01:39:57 UTC (rev 272259)
@@ -32,6 +32,7 @@
 #include <WebCore/LengthBox.h>
 #include <WebCore/VelocityData.h>
 #include <wtf/MonotonicTime.h>
+#include <wtf/OptionSet.h>
 #include <wtf/text/WTFString.h>
 
 namespace IPC {
@@ -45,11 +46,19 @@
 
 namespace WebKit {
 
+enum class ViewStabilityFlag : uint8_t {
+    ScrollViewInteracting               = 1 << 0, // Dragging, zooming, interrupting deceleration
+    ScrollViewAnimatedScrollOrZoom      = 1 << 1, // Decelerating, scrolling to top, animated zoom
+    ScrollViewRubberBanding             = 1 << 2,
+    ChangingObscuredInsetsInteractively = 1 << 3,
+    UnstableForTesting                  = 1 << 4
+};
+
 class VisibleContentRectUpdateInfo {
 public:
     VisibleContentRectUpdateInfo() = default;
 
-    VisibleContentRectUpdateInfo(const WebCore::FloatRect& exposedContentRect, const WebCore::FloatRect& unobscuredContentRect, const WebCore::FloatBoxExtent& contentInsets, const WebCore::FloatRect& unobscuredRectInScrollViewCoordinates, const WebCore::FloatRect& unobscuredContentRectRespectingInputViewBounds, const WebCore::FloatRect& layoutViewportRect, const WebCore::FloatBoxExtent& obscuredInsets, const WebCore::FloatBoxExtent& unobscuredSafeAreaInsets, double scale, bool inStableState, bool isFirstUpdateForNewViewSize, bool isChangingObscuredInsetsInteractively, bool allowShrinkToFit, bool enclosedInScrollableAncestorView, const WebCore::VelocityData& scrollVelocity, TransactionID lastLayerTreeTransactionId)
+    VisibleContentRectUpdateInfo(const WebCore::FloatRect& exposedContentRect, const WebCore::FloatRect& unobscuredContentRect, const WebCore::FloatBoxExtent& contentInsets, const WebCore::FloatRect& unobscuredRectInScrollViewCoordinates, const WebCore::FloatRect& unobscuredContentRectRespectingInputViewBounds, const WebCore::FloatRect& layoutViewportRect, const WebCore::FloatBoxExtent& obscuredInsets, const WebCore::FloatBoxExtent& unobscuredSafeAreaInsets, double scale, OptionSet<ViewStabilityFlag> viewStability, bool isFirstUpdateForNewViewSize, bool allowShrinkToFit, bool enclosedInScrollableAncestorView, const WebCore::VelocityData& scrollVelocity, TransactionID lastLayerTreeTransactionId)
         : m_exposedContentRect(exposedContentRect)
         , m_unobscuredContentRect(unobscuredContentRect)
         , m_contentInsets(contentInsets)
@@ -61,9 +70,8 @@
         , m_scrollVelocity(scrollVelocity)
         , m_lastLayerTreeTransactionID(lastLayerTreeTransactionId)
         , m_scale(scale)
-        , m_inStableState(inStableState)
+        , m_viewStability(viewStability)
         , m_isFirstUpdateForNewViewSize(isFirstUpdateForNewViewSize)
-        , m_isChangingObscuredInsetsInteractively(isChangingObscuredInsetsInteractively)
         , m_allowShrinkToFit(allowShrinkToFit)
         , m_enclosedInScrollableAncestorView(enclosedInScrollableAncestorView)
     {
@@ -80,9 +88,9 @@
     const WebCore::FloatBoxExtent& unobscuredSafeAreaInsets() const { return m_unobscuredSafeAreaInsets; }
 
     double scale() const { return m_scale; }
-    bool inStableState() const { return m_inStableState; }
+    bool inStableState() const { return m_viewStability.isEmpty(); }
+    OptionSet<ViewStabilityFlag> viewStability() const { return m_viewStability; }
     bool isFirstUpdateForNewViewSize() const { return m_isFirstUpdateForNewViewSize; }
-    bool isChangingObscuredInsetsInteractively() const { return m_isChangingObscuredInsetsInteractively; }
     bool allowShrinkToFit() const { return m_allowShrinkToFit; }
     bool enclosedInScrollableAncestorView() const { return m_enclosedInScrollableAncestorView; }
     TransactionID lastLayerTreeTransactionID() const { return m_lastLayerTreeTransactionID; }
@@ -106,9 +114,8 @@
     WebCore::VelocityData m_scrollVelocity;
     TransactionID m_lastLayerTreeTransactionID;
     double m_scale { -1 };
-    bool m_inStableState { false };
+    OptionSet<ViewStabilityFlag> m_viewStability;
     bool m_isFirstUpdateForNewViewSize { false };
-    bool m_isChangingObscuredInsetsInteractively { false };
     bool m_allowShrinkToFit { false };
     bool m_enclosedInScrollableAncestorView { false };
 };
@@ -125,14 +132,30 @@
         && a.obscuredInsets() == b.obscuredInsets()
         && a.unobscuredSafeAreaInsets() == b.unobscuredSafeAreaInsets()
         && a.scrollVelocity().equalIgnoringTimestamp(b.scrollVelocity())
-        && a.inStableState() == b.inStableState()
+        && a.viewStability() == b.viewStability()
         && a.isFirstUpdateForNewViewSize() == b.isFirstUpdateForNewViewSize()
         && a.allowShrinkToFit() == b.allowShrinkToFit()
         && a.enclosedInScrollableAncestorView() == b.enclosedInScrollableAncestorView();
 }
 
+WTF::TextStream& operator<<(WTF::TextStream&, ViewStabilityFlag);
 WTF::TextStream& operator<<(WTF::TextStream&, const VisibleContentRectUpdateInfo&);
 
 } // namespace WebKit
 
+namespace WTF {
+
+template<> struct EnumTraits<WebKit::ViewStabilityFlag> {
+    using values = EnumValues<
+        WebKit::ViewStabilityFlag,
+        WebKit::ViewStabilityFlag::ScrollViewInteracting,
+        WebKit::ViewStabilityFlag::ScrollViewAnimatedScrollOrZoom,
+        WebKit::ViewStabilityFlag::ScrollViewRubberBanding,
+        WebKit::ViewStabilityFlag::ChangingObscuredInsetsInteractively,
+        WebKit::ViewStabilityFlag::UnstableForTesting
+    >;
+};
+
+} // namespace WTF
+
 #endif // ENABLE(UI_SIDE_COMPOSITING)

Modified: branches/safari-611-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h (272258 => 272259)


--- branches/safari-611-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h	2021-02-03 01:39:53 UTC (rev 272258)
+++ branches/safari-611-branch/Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h	2021-02-03 01:39:57 UTC (rev 272259)
@@ -231,7 +231,7 @@
     RetainPtr<WKPasswordView> _passwordView;
 
     BOOL _hasScheduledVisibleRectUpdate;
-    BOOL _visibleContentRectUpdateScheduledFromScrollViewInStableState;
+    OptionSet<WebKit::ViewStabilityFlag> _viewStabilityWhenVisibleContentRectUpdateScheduled;
 
     Optional<WebCore::WheelScrollGestureState> _currentScrollGestureState;
     uint64_t _wheelEventCountInCurrentScrollGesture;

Modified: branches/safari-611-branch/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm (272258 => 272259)


--- branches/safari-611-branch/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm	2021-02-03 01:39:53 UTC (rev 272258)
+++ branches/safari-611-branch/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm	2021-02-03 01:39:57 UTC (rev 272259)
@@ -701,7 +701,7 @@
 {
     RELEASE_LOG_IF_ALLOWED("%p -[WKWebView _didRelaunchProcess]", self);
     _hasScheduledVisibleRectUpdate = NO;
-    _visibleContentRectUpdateScheduledFromScrollViewInStableState = YES;
+    _viewStabilityWhenVisibleContentRectUpdateScheduled = { };
     if (_gestureController)
         _gestureController->connectToProcess();
 }
@@ -1888,12 +1888,12 @@
 }
 
 // Ideally UIScrollView would expose this for us: <rdar://problem/21394567>.
-- (BOOL)_scrollViewIsRubberBanding
+- (BOOL)_scrollViewIsRubberBanding:(UIScrollView *)scrollView
 {
     float deviceScaleFactor = _page->deviceScaleFactor();
 
-    CGPoint contentOffset = [_scrollView contentOffset];
-    CGPoint boundedOffset = contentOffsetBoundedInValidRange(_scrollView.get(), contentOffset);
+    CGPoint contentOffset = [scrollView contentOffset];
+    CGPoint boundedOffset = contentOffsetBoundedInValidRange(scrollView, contentOffset);
     return !pointsEqualInDevicePixels(contentOffset, boundedOffset, deviceScaleFactor);
 }
 
@@ -1920,23 +1920,30 @@
     [self _scheduleVisibleContentRectUpdate];
 }
 
-- (BOOL)_scrollViewIsInStableState:(UIScrollView *)scrollView
+- (OptionSet<WebKit::ViewStabilityFlag>)_viewStabilityState:(UIScrollView *)scrollView
 {
-    BOOL isStableState = !([scrollView isDragging] || [scrollView isDecelerating] || [scrollView isZooming] || [scrollView _isAnimatingZoom] || [scrollView _isScrollingToTop]);
+    OptionSet<WebKit::ViewStabilityFlag> stabilityFlags;
 
-    if (isStableState && scrollView == _scrollView.get())
-        isStableState = !_isChangingObscuredInsetsInteractively;
+    if (scrollView.isDragging || scrollView.isZooming || scrollView._isInterruptingDeceleration)
+        stabilityFlags.add(WebKit::ViewStabilityFlag::ScrollViewInteracting);
 
-    if (isStableState && scrollView == _scrollView.get())
-        isStableState = ![self _scrollViewIsRubberBanding];
+    if (scrollView.isDecelerating || scrollView._isAnimatingZoom || scrollView._isScrollingToTop)
+        stabilityFlags.add(WebKit::ViewStabilityFlag::ScrollViewAnimatedScrollOrZoom);
 
-    if (isStableState)
-        isStableState = !scrollView._isInterruptingDeceleration;
+    if (scrollView == _scrollView.get() && _isChangingObscuredInsetsInteractively)
+        stabilityFlags.add(WebKit::ViewStabilityFlag::ChangingObscuredInsetsInteractively);
 
-    if (NSNumber *stableOverride = self._stableStateOverride)
-        isStableState = stableOverride.boolValue;
+    if ([self _scrollViewIsRubberBanding:scrollView])
+        stabilityFlags.add(WebKit::ViewStabilityFlag::ScrollViewRubberBanding);
 
-    return isStableState;
+    if (NSNumber *stableOverride = self._stableStateOverride) {
+        if (stableOverride.boolValue)
+            stabilityFlags = { };
+        else
+            stabilityFlags.add(WebKit::ViewStabilityFlag::UnstableForTesting);
+    }
+
+    return stabilityFlags;
 }
 
 - (void)_addUpdateVisibleContentRectPreCommitHandler
@@ -1960,7 +1967,7 @@
 
 - (void)_scheduleVisibleContentRectUpdateAfterScrollInView:(UIScrollView *)scrollView
 {
-    _visibleContentRectUpdateScheduledFromScrollViewInStableState = [self _scrollViewIsInStableState:scrollView];
+    _viewStabilityWhenVisibleContentRectUpdateScheduled = [self _viewStabilityState:scrollView];
 
     if (_hasScheduledVisibleRectUpdate) {
         auto timeNow = MonotonicTime::now();
@@ -2054,7 +2061,7 @@
 
 - (void)_updateVisibleContentRects
 {
-    BOOL inStableState = _visibleContentRectUpdateScheduledFromScrollViewInStableState;
+    auto viewStability = _viewStabilityWhenVisibleContentRectUpdateScheduled;
 
     if (![self usesStandardContentView]) {
         [_passwordView setFrame:self.bounds];
@@ -2110,7 +2117,7 @@
     auto contentInsets = [self currentlyVisibleContentInsetsWithScale:scaleFactor obscuredInsets:computedContentInsetUnadjustedForKeyboard];
 
 #if ENABLE(CSS_SCROLL_SNAP) && ENABLE(ASYNC_SCROLLING)
-    if (inStableState) {
+    if (viewStability.isEmpty()) {
         WebKit::RemoteScrollingCoordinatorProxy* coordinator = _page->scrollingCoordinatorProxy();
         if (coordinator && coordinator->hasActiveSnapPoint()) {
             CGPoint currentPoint = [_scrollView contentOffset];
@@ -2134,8 +2141,7 @@
         unobscuredSafeAreaInsets:[self _computedUnobscuredSafeAreaInset]
         inputViewBounds:_inputViewBounds
         scale:scaleFactor minimumScale:[_scrollView minimumZoomScale]
-        inStableState:inStableState
-        isChangingObscuredInsetsInteractively:_isChangingObscuredInsetsInteractively
+        viewStability:viewStability
         enclosedInScrollableAncestorView:scrollViewCanScroll([self _scroller])
         sendEvenIfUnchanged:_alwaysSendNextVisibleContentRectUpdate];
 

Modified: branches/safari-611-branch/Source/WebKit/UIProcess/ios/WKContentView.h (272258 => 272259)


--- branches/safari-611-branch/Source/WebKit/UIProcess/ios/WKContentView.h	2021-02-03 01:39:53 UTC (rev 272258)
+++ branches/safari-611-branch/Source/WebKit/UIProcess/ios/WKContentView.h	2021-02-03 01:39:57 UTC (rev 272259)
@@ -51,6 +51,7 @@
 class WebPageProxy;
 class WebProcessProxy;
 class WebProcessPool;
+enum class ViewStabilityFlag : uint8_t;
 }
 
 @interface WKContentView : WKApplicationStateTrackingView {
@@ -81,8 +82,7 @@
     unobscuredSafeAreaInsets:(UIEdgeInsets)unobscuredSafeAreaInsets
     inputViewBounds:(CGRect)inputViewBounds
     scale:(CGFloat)scale minimumScale:(CGFloat)minimumScale
-    inStableState:(BOOL)isStableState
-    isChangingObscuredInsetsInteractively:(BOOL)isChangingObscuredInsetsInteractively
+    viewStability:(OptionSet<WebKit::ViewStabilityFlag>)viewStability
     enclosedInScrollableAncestorView:(BOOL)enclosedInScrollableAncestorView
     sendEvenIfUnchanged:(BOOL)sendEvenIfUnchanged;
 

Modified: branches/safari-611-branch/Source/WebKit/UIProcess/ios/WKContentView.mm (272258 => 272259)


--- branches/safari-611-branch/Source/WebKit/UIProcess/ios/WKContentView.mm	2021-02-03 01:39:53 UTC (rev 272258)
+++ branches/safari-611-branch/Source/WebKit/UIProcess/ios/WKContentView.mm	2021-02-03 01:39:57 UTC (rev 272259)
@@ -436,8 +436,7 @@
     unobscuredSafeAreaInsets:(UIEdgeInsets)unobscuredSafeAreaInsets
     inputViewBounds:(CGRect)inputViewBounds
     scale:(CGFloat)zoomScale minimumScale:(CGFloat)minimumScale
-    inStableState:(BOOL)isStableState
-    isChangingObscuredInsetsInteractively:(BOOL)isChangingObscuredInsetsInteractively
+    viewStability:(OptionSet<WebKit::ViewStabilityFlag>)viewStability
     enclosedInScrollableAncestorView:(BOOL)enclosedInScrollableAncestorView
     sendEvenIfUnchanged:(BOOL)sendEvenIfUnchanged
 {
@@ -447,7 +446,8 @@
 
     MonotonicTime timestamp = MonotonicTime::now();
     WebCore::VelocityData velocityData;
-    if (!isStableState)
+    bool inStableState = viewStability.isEmpty();
+    if (!inStableState)
         velocityData = _historicalKinematicData.velocityForNewData(visibleContentRect.origin, zoomScale, timestamp);
     else {
         _historicalKinematicData.clear();
@@ -467,9 +467,8 @@
         floatBoxExtent(obscuredInsets),
         floatBoxExtent(unobscuredSafeAreaInsets),
         zoomScale,
-        isStableState,
+        viewStability,
         _sizeChangedSinceLastVisibleContentRectUpdate,
-        isChangingObscuredInsetsInteractively,
         self.webView._allowsViewportShrinkToFit,
         enclosedInScrollableAncestorView,
         velocityData,
@@ -490,7 +489,7 @@
     
     [self updateFixedClippingView:layoutViewport];
 
-    if (wasStableState && !isStableState)
+    if (wasStableState && !inStableState)
         [self _didExitStableState];
 }
 

Modified: branches/safari-611-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (272258 => 272259)


--- branches/safari-611-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2021-02-03 01:39:53 UTC (rev 272258)
+++ branches/safari-611-branch/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2021-02-03 01:39:57 UTC (rev 272259)
@@ -3920,7 +3920,8 @@
         frameView.layoutOrVisualViewportChanged();
     }
 
-    if (!visibleContentRectUpdateInfo.isChangingObscuredInsetsInteractively())
+    bool isChangingObscuredInsetsInteractively = visibleContentRectUpdateInfo.viewStability().contains(ViewStabilityFlag::ChangingObscuredInsetsInteractively);
+    if (!isChangingObscuredInsetsInteractively)
         frameView.setCustomSizeForResizeEvent(expandedIntSize(visibleContentRectUpdateInfo.unobscuredRectInScrollViewCoordinates().size()));
 
     if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) {
@@ -3927,7 +3928,7 @@
         ViewportRectStability viewportStability = ViewportRectStability::Stable;
         ScrollingLayerPositionAction layerAction = ScrollingLayerPositionAction::Sync;
         
-        if (visibleContentRectUpdateInfo.isChangingObscuredInsetsInteractively()) {
+        if (isChangingObscuredInsetsInteractively) {
             viewportStability = ViewportRectStability::ChangingObscuredInsetsInteractively;
             layerAction = ScrollingLayerPositionAction::SetApproximate;
         } else if (!m_isInStableState) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to