Move m_exposedContentRect into the DelegatedScrollingGeometry optional
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Dec 2019 17:01:24 +0000 (17:01 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Dec 2019 17:01:24 +0000 (17:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=205377

Reviewed by Tim Horton.
Source/WebCore:

ScrollView's m_exposedContentRect is only set for delegated scrolling, so move it into
DelegatedScrollingGeometry and remove the iOS #ifdefs around it. Move the WAK/NSView-related
code into platformExposedContentRect() for iOS WK1. Stub out exposedContentRect() functions
on TiledCoreAnimationDrawingArea.

* platform/ScrollView.cpp:
(WebCore::ScrollView::exposedContentRect const):
(WebCore::ScrollView::setExposedContentRect):
(WebCore::ScrollView::platformExposedContentRect const):
* platform/ScrollView.h:
* platform/ios/ScrollViewIOS.mm:
(WebCore::ScrollView::platformExposedContentRect const):
(WebCore::ScrollView::exposedContentRect const): Deleted.
(WebCore::ScrollView::setExposedContentRect): Deleted.

Source/WebKit:

ScrollView's m_exposedContentRect is only set for delegated scrolling, so move it into
DelegatedScrollingGeometry and remove the iOS #ifdefs around it. Move the WAK/NSView-related
code into platformExposedContentRect() for iOS WK1. Stub out exposedContentRect() functions
on TiledCoreAnimationDrawingArea.

* WebProcess/WebPage/DrawingArea.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::setExposedContentRect):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
(WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange):
(WebKit::TiledCoreAnimationDrawingArea::setViewExposedRect):
(WebKit::TiledCoreAnimationDrawingArea::exposedContentRect const):
(WebKit::TiledCoreAnimationDrawingArea::setExposedContentRect):
(WebKit::TiledCoreAnimationDrawingArea::adjustLayerFlushThrottling):

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

Source/WebCore/ChangeLog
Source/WebCore/platform/ScrollView.cpp
Source/WebCore/platform/ScrollView.h
Source/WebCore/platform/ios/ScrollViewIOS.mm
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/DrawingArea.h
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h
Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm
Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h
Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm

index da2e4ae..e5e5110 100644 (file)
@@ -1,3 +1,25 @@
+2019-12-18  Simon Fraser  <simon.fraser@apple.com>
+
+        Move m_exposedContentRect into the DelegatedScrollingGeometry optional
+        https://bugs.webkit.org/show_bug.cgi?id=205377
+
+        Reviewed by Tim Horton.
+
+        ScrollView's m_exposedContentRect is only set for delegated scrolling, so move it into
+        DelegatedScrollingGeometry and remove the iOS #ifdefs around it. Move the WAK/NSView-related
+        code into platformExposedContentRect() for iOS WK1. Stub out exposedContentRect() functions
+        on TiledCoreAnimationDrawingArea.        
+
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::exposedContentRect const):
+        (WebCore::ScrollView::setExposedContentRect):
+        (WebCore::ScrollView::platformExposedContentRect const):
+        * platform/ScrollView.h:
+        * platform/ios/ScrollViewIOS.mm:
+        (WebCore::ScrollView::platformExposedContentRect const):
+        (WebCore::ScrollView::exposedContentRect const): Deleted.
+        (WebCore::ScrollView::setExposedContentRect): Deleted.
+
 2019-12-18  Chris Dumez  <cdumez@apple.com>
 
         REGRESSION: 32 Tests Crashing on Mac Debug wk2 with ASSERTION FAILED: m_pendingActivityForEventDispatch
index 178523a..4f2137d 100644 (file)
@@ -220,6 +220,33 @@ void ScrollView::setContentsScrollPosition(const IntPoint& position)
     setScrollPosition(position);
 }
 
+FloatRect ScrollView::exposedContentRect() const
+{
+#if PLATFORM(IOS_FAMILY)
+    if (platformWidget())
+        return platformExposedContentRect();
+#endif
+    
+    const ScrollView* parent = this->parent();
+    if (!parent)
+        return m_delegatedScrollingGeometry ? m_delegatedScrollingGeometry->exposedContentRect : FloatRect();
+
+    IntRect parentViewExtentContentRect = enclosingIntRect(parent->exposedContentRect());
+    IntRect selfExtentContentRect = rootViewToContents(parentViewExtentContentRect);
+    selfExtentContentRect.intersect(boundsRect());
+    return selfExtentContentRect;
+}
+
+void ScrollView::setExposedContentRect(const FloatRect& rect)
+{
+    ASSERT(!platformWidget());
+
+    if (!m_delegatedScrollingGeometry)
+        m_delegatedScrollingGeometry = DelegatedScrollingGeometry();
+
+    m_delegatedScrollingGeometry->exposedContentRect = rect;
+}
+
 FloatSize ScrollView::unobscuredContentSize() const
 {
     ASSERT(m_delegatedScrollingGeometry);
@@ -1590,6 +1617,11 @@ IntRect ScrollView::platformUnobscuredContentRect(VisibleContentRectIncludesScro
     return { };
 }
 
+FloatRect ScrollView::platformExposedContentRect() const
+{
+    return { };
+}
+
 void ScrollView::platformSetContentsSize()
 {
 }
index 0842859..e93b104 100644 (file)
@@ -475,6 +475,7 @@ private:
     IntSize platformVisibleContentSizeIncludingObscuredArea(bool includeScrollbars) const;
 
     IntRect platformUnobscuredContentRect(VisibleContentRectIncludesScrollbars) const;
+    FloatRect platformExposedContentRect() const;
 
     void platformSetContentsSize();
 
@@ -499,11 +500,11 @@ private:
     ScrollbarMode m_horizontalScrollbarMode { ScrollbarAuto };
     ScrollbarMode m_verticalScrollbarMode { ScrollbarAuto };
 
-    FloatRect m_exposedContentRect;
 
     // FIXME: More things will move into here.
     struct DelegatedScrollingGeometry {
         FloatSize unobscuredContentSize;
+        FloatRect exposedContentRect;
     };
     Optional<DelegatedScrollingGeometry> m_delegatedScrollingGeometry;
 
index c81da64..267f978 100644 (file)
@@ -113,36 +113,21 @@ IntRect ScrollView::platformUnobscuredContentRect(VisibleContentRectIncludesScro
     return enclosingIntRect(r);
 }
 
-FloatRect ScrollView::exposedContentRect() const
+FloatRect ScrollView::platformExposedContentRect() const
 {
-    if (NSScrollView *view = static_cast<NSScrollView *>(platformWidget())) {
-        CGRect r = CGRectZero;
-        BEGIN_BLOCK_OBJC_EXCEPTIONS;
-        if ([view isKindOfClass:[NSScrollView class]])
-            r = [view exposedContentRect];
-        else {
-            r.origin = [view visibleRect].origin;
-            r.size = [view bounds].size;
-        }
-
-        END_BLOCK_OBJC_EXCEPTIONS;
-        return r;
+    ASSERT(platformWidget());
+    NSScrollView *view = static_cast<NSScrollView *>(platformWidget());
+    CGRect r = CGRectZero;
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    if ([view isKindOfClass:[NSScrollView class]])
+        r = [view exposedContentRect];
+    else {
+        r.origin = [view visibleRect].origin;
+        r.size = [view bounds].size;
     }
 
-    const ScrollView* parent = this->parent();
-    if (!parent)
-        return m_exposedContentRect;
-
-    IntRect parentViewExtentContentRect = enclosingIntRect(parent->exposedContentRect());
-    IntRect selfExtentContentRect = rootViewToContents(parentViewExtentContentRect);
-    selfExtentContentRect.intersect(boundsRect());
-    return selfExtentContentRect;
-}
-
-void ScrollView::setExposedContentRect(const FloatRect& rect)
-{
-    ASSERT(!platformWidget());
-    m_exposedContentRect = rect;
+    END_BLOCK_OBJC_EXCEPTIONS;
+    return r;
 }
 
 void ScrollView::setActualScrollPosition(const IntPoint& position)
index d1032c9..3615d9d 100644 (file)
@@ -1,3 +1,28 @@
+2019-12-18  Simon Fraser  <simon.fraser@apple.com>
+
+        Move m_exposedContentRect into the DelegatedScrollingGeometry optional
+        https://bugs.webkit.org/show_bug.cgi?id=205377
+
+        Reviewed by Tim Horton.
+        
+        ScrollView's m_exposedContentRect is only set for delegated scrolling, so move it into
+        DelegatedScrollingGeometry and remove the iOS #ifdefs around it. Move the WAK/NSView-related
+        code into platformExposedContentRect() for iOS WK1. Stub out exposedContentRect() functions
+        on TiledCoreAnimationDrawingArea.        
+
+        * WebProcess/WebPage/DrawingArea.h:
+        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
+        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
+        (WebKit::RemoteLayerTreeDrawingArea::setExposedContentRect):
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea):
+        (WebKit::TiledCoreAnimationDrawingArea::activityStateDidChange):
+        (WebKit::TiledCoreAnimationDrawingArea::setViewExposedRect):
+        (WebKit::TiledCoreAnimationDrawingArea::exposedContentRect const):
+        (WebKit::TiledCoreAnimationDrawingArea::setExposedContentRect):
+        (WebKit::TiledCoreAnimationDrawingArea::adjustLayerFlushThrottling):
+
 2019-12-18  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Enable the async clipboard API by default on macOS and iOS
index 16d09bf..bab1d4b 100644 (file)
@@ -98,11 +98,11 @@ public:
     virtual void acceleratedAnimationDidStart(uint64_t /*layerID*/, const String& /*key*/, MonotonicTime /*startTime*/) { }
     virtual void acceleratedAnimationDidEnd(uint64_t /*layerID*/, const String& /*key*/) { }
     virtual void addFence(const WTF::MachSendRight&) { }
-#endif
-#if PLATFORM(IOS_FAMILY)
+
     virtual WebCore::FloatRect exposedContentRect() const = 0;
     virtual void setExposedContentRect(const WebCore::FloatRect&) = 0;
 #endif
+
     virtual void mainFrameScrollabilityChanged(bool) { }
 
     virtual bool supportsAsyncScrolling() const { return false; }
index ccd963f..f111683 100644 (file)
@@ -95,10 +95,8 @@ private:
     void acceleratedAnimationDidStart(uint64_t layerID, const String& key, MonotonicTime startTime) override;
     void acceleratedAnimationDidEnd(uint64_t layerID, const String& key) override;
 
-#if PLATFORM(IOS_FAMILY)
     WebCore::FloatRect exposedContentRect() const override;
     void setExposedContentRect(const WebCore::FloatRect&) override;
-#endif
 
     void didUpdate() override;
 
index c80af5d..26a0303 100644 (file)
@@ -228,7 +228,6 @@ void RemoteLayerTreeDrawingArea::setViewExposedRect(Optional<WebCore::FloatRect>
     updateScrolledExposedRect();
 }
 
-#if PLATFORM(IOS_FAMILY)
 WebCore::FloatRect RemoteLayerTreeDrawingArea::exposedContentRect() const
 {
     FrameView* frameView = m_webPage.mainFrameView();
@@ -249,7 +248,6 @@ void RemoteLayerTreeDrawingArea::setExposedContentRect(const FloatRect& exposedC
     frameView->setExposedContentRect(exposedContentRect);
     scheduleCompositingLayerFlush();
 }
-#endif
 
 void RemoteLayerTreeDrawingArea::updateScrolledExposedRect()
 {
index d85dc41..a76f1eb 100644 (file)
@@ -75,6 +75,9 @@ private:
     void setViewExposedRect(Optional<WebCore::FloatRect>) override;
     Optional<WebCore::FloatRect> viewExposedRect() const override { return m_scrolledViewExposedRect; }
 
+    WebCore::FloatRect exposedContentRect() const override;
+    void setExposedContentRect(const WebCore::FloatRect&) override;
+
     bool supportsAsyncScrolling() const override { return true; }
 
     void dispatchAfterEnsuringUpdatedScrollPosition(WTF::Function<void ()>&&) override;
index 9972fe1..1469a4b 100644 (file)
@@ -87,7 +87,7 @@ TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea(WebPage& webPage, c
     [m_hostingLayer setOpaque:YES];
     [m_hostingLayer setGeometryFlipped:YES];
 
-    m_layerFlushRunLoopObserver = makeUnique<WebCore::RunLoopObserver>(static_cast<CFIndex>(RunLoopObserver::WellKnownRunLoopOrders::LayerFlush), [this]() {
+    m_layerFlushRunLoopObserver = makeUnique<RunLoopObserver>(static_cast<CFIndex>(RunLoopObserver::WellKnownRunLoopOrders::LayerFlush), [this]() {
         this->layerFlushRunLoopCallback();
     });
 
@@ -514,7 +514,7 @@ void TiledCoreAnimationDrawingArea::flushLayers(FlushType flushType)
     }
 }
 
-void TiledCoreAnimationDrawingArea::activityStateDidChange(OptionSet<WebCore::ActivityState::Flag> changed, ActivityStateChangeID activityStateChangeID, const Vector<CallbackID>& nextActivityStateChangeCallbackIDs)
+void TiledCoreAnimationDrawingArea::activityStateDidChange(OptionSet<ActivityState::Flag> changed, ActivityStateChangeID activityStateChangeID, const Vector<CallbackID>& nextActivityStateChangeCallbackIDs)
 {
     m_nextActivityStateChangeCallbackIDs.appendVector(nextActivityStateChangeCallbackIDs);
     m_activityStateChangeID = std::max(m_activityStateChangeID, activityStateChangeID);
@@ -566,12 +566,23 @@ void TiledCoreAnimationDrawingArea::resumePainting()
     [[NSNotificationCenter defaultCenter] postNotificationName:@"NSCAViewRenderDidResumeNotification" object:nil userInfo:[NSDictionary dictionaryWithObject:m_hostingLayer.get() forKey:@"layer"]];
 }
 
-void TiledCoreAnimationDrawingArea::setViewExposedRect(Optional<WebCore::FloatRect> viewExposedRect)
+void TiledCoreAnimationDrawingArea::setViewExposedRect(Optional<FloatRect> viewExposedRect)
 {
     m_viewExposedRect = viewExposedRect;
     updateScrolledExposedRect();
 }
 
+FloatRect TiledCoreAnimationDrawingArea::exposedContentRect() const
+{
+    ASSERT_NOT_REACHED();
+    return { };
+}
+
+void TiledCoreAnimationDrawingArea::setExposedContentRect(const FloatRect&)
+{
+    ASSERT_NOT_REACHED();
+}
+
 void TiledCoreAnimationDrawingArea::updateScrolledExposedRect()
 {
     FrameView* frameView = m_webPage.mainFrameView();
@@ -941,11 +952,11 @@ void TiledCoreAnimationDrawingArea::scheduleLayerFlushRunLoopObserver()
     m_layerFlushRunLoopObserver->schedule(CFRunLoopGetCurrent());
 }
 
-bool TiledCoreAnimationDrawingArea::adjustLayerFlushThrottling(WebCore::LayerFlushThrottleState::Flags flags)
+bool TiledCoreAnimationDrawingArea::adjustLayerFlushThrottling(LayerFlushThrottleState::Flags flags)
 {
     bool wasThrottlingLayerFlushes = m_isThrottlingLayerFlushes;
-    m_isThrottlingLayerFlushes = flags & WebCore::LayerFlushThrottleState::Enabled;
-    m_isLayerFlushThrottlingTemporarilyDisabledForInteraction = flags & WebCore::LayerFlushThrottleState::UserIsInteracting;
+    m_isThrottlingLayerFlushes = flags & LayerFlushThrottleState::Enabled;
+    m_isLayerFlushThrottlingTemporarilyDisabledForInteraction = flags & LayerFlushThrottleState::UserIsInteracting;
 
     if (wasThrottlingLayerFlushes == m_isThrottlingLayerFlushes)
         return true;