Title: [291663] branches/safari-613-branch/Source/WebCore
Revision
291663
Author
[email protected]
Date
2022-03-22 10:56:32 -0700 (Tue, 22 Mar 2022)

Log Message

Cherry-pick r291175. rdar://problem/88549631

    Fix WebContent jetsam that occurs when selecting text in a large e-mail
    https://bugs.webkit.org/show_bug.cgi?id=237698

    Reviewed by Simon Fraser.

    When selecting text in a large e-mail in MobileMail, we often jetsam. This is due to this
    chain of events:

     1. If the selection extends enough to start causing the content to pan (which is easy
        to do when zoomed in on the mail content), then AutoscrollController ends up changing
        the scroll position of the FrameView to perform the pan.
     2. FrameView::requestScrollPositionUpdate tries to prepopulate tiles around the endpoint
        of the pan by calling TileController::prepopulateRect with visibleContentRect's size.

    The problem is that MobileMail resizes their web view (and therefore FrameView) to match
    the size of the content. This causes FrameView's visibleContentRect to be very large (>100k
    pts high for some emails). As a result, we end up prepopulating every single tile in the
    email, causing a huge spike in IOSurface memory usage that leads to a jetsam.

    To fix this, we make FrameView::requestScrollPositionUpdate act more like
    RenderLayerCompositor::visibleRectForLayerFlushing. In particular, on iOS, we now use
    exposedContentRect instead of visibleContentRect. Since exposedContentRect is derived from
    contentOffset/contentSize of the scroll view in the UIProcess, it's more correct and is much
    smaller than visibleContentRect in this case.

    * page/FrameView.cpp:
    (WebCore::FrameView::requestScrollPositionUpdate):

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

Modified Paths

Diff

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (291662 => 291663)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-03-22 17:56:28 UTC (rev 291662)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-03-22 17:56:32 UTC (rev 291663)
@@ -1,5 +1,70 @@
 2022-03-21  Alan Coon  <[email protected]>
 
+        Cherry-pick r291175. rdar://problem/88549631
+
+    Fix WebContent jetsam that occurs when selecting text in a large e-mail
+    https://bugs.webkit.org/show_bug.cgi?id=237698
+    
+    Reviewed by Simon Fraser.
+    
+    When selecting text in a large e-mail in MobileMail, we often jetsam. This is due to this
+    chain of events:
+    
+     1. If the selection extends enough to start causing the content to pan (which is easy
+        to do when zoomed in on the mail content), then AutoscrollController ends up changing
+        the scroll position of the FrameView to perform the pan.
+     2. FrameView::requestScrollPositionUpdate tries to prepopulate tiles around the endpoint
+        of the pan by calling TileController::prepopulateRect with visibleContentRect's size.
+    
+    The problem is that MobileMail resizes their web view (and therefore FrameView) to match
+    the size of the content. This causes FrameView's visibleContentRect to be very large (>100k
+    pts high for some emails). As a result, we end up prepopulating every single tile in the
+    email, causing a huge spike in IOSurface memory usage that leads to a jetsam.
+    
+    To fix this, we make FrameView::requestScrollPositionUpdate act more like
+    RenderLayerCompositor::visibleRectForLayerFlushing. In particular, on iOS, we now use
+    exposedContentRect instead of visibleContentRect. Since exposedContentRect is derived from
+    contentOffset/contentSize of the scroll view in the UIProcess, it's more correct and is much
+    smaller than visibleContentRect in this case.
+    
+    * page/FrameView.cpp:
+    (WebCore::FrameView::requestScrollPositionUpdate):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@291175 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-11  Ben Nham  <[email protected]>
+
+            Fix WebContent jetsam that occurs when selecting text in a large e-mail
+            https://bugs.webkit.org/show_bug.cgi?id=237698
+
+            Reviewed by Simon Fraser.
+
+            When selecting text in a large e-mail in MobileMail, we often jetsam. This is due to this
+            chain of events:
+
+             1. If the selection extends enough to start causing the content to pan (which is easy
+                to do when zoomed in on the mail content), then AutoscrollController ends up changing
+                the scroll position of the FrameView to perform the pan.
+             2. FrameView::requestScrollPositionUpdate tries to prepopulate tiles around the endpoint
+                of the pan by calling TileController::prepopulateRect with visibleContentRect's size.
+
+            The problem is that MobileMail resizes their web view (and therefore FrameView) to match
+            the size of the content. This causes FrameView's visibleContentRect to be very large (>100k
+            pts high for some emails). As a result, we end up prepopulating every single tile in the
+            email, causing a huge spike in IOSurface memory usage that leads to a jetsam.
+
+            To fix this, we make FrameView::requestScrollPositionUpdate act more like
+            RenderLayerCompositor::visibleRectForLayerFlushing. In particular, on iOS, we now use
+            exposedContentRect instead of visibleContentRect. Since exposedContentRect is derived from
+            contentOffset/contentSize of the scroll view in the UIProcess, it's more correct and is much
+            smaller than visibleContentRect in this case.
+
+            * page/FrameView.cpp:
+            (WebCore::FrameView::requestScrollPositionUpdate):
+
+2022-03-21  Alan Coon  <[email protected]>
+
         Cherry-pick r291141. rdar://problem/90035071
 
     Main document is leaking on haaretz.co.il due to lazy image loading

Modified: branches/safari-613-branch/Source/WebCore/page/FrameView.cpp (291662 => 291663)


--- branches/safari-613-branch/Source/WebCore/page/FrameView.cpp	2022-03-22 17:56:28 UTC (rev 291662)
+++ branches/safari-613-branch/Source/WebCore/page/FrameView.cpp	2022-03-22 17:56:32 UTC (rev 291663)
@@ -2713,9 +2713,15 @@
     LOG_WITH_STREAM(Scrolling, stream << "FrameView::requestScrollPositionUpdate " << position);
 
 #if ENABLE(ASYNC_SCROLLING)
-    if (TiledBacking* tiledBacking = this->tiledBacking())
-        tiledBacking->prepopulateRect(FloatRect(position, visibleContentRect().size()));
+    if (TiledBacking* tiledBacking = this->tiledBacking()) {
+#if PLATFORM(IOS_FAMILY)
+        auto contentSize = exposedContentRect().size();
+#else
+        auto contentSize = visibleContentRect().size();
 #endif
+        tiledBacking->prepopulateRect(FloatRect(position, contentSize));
+    }
+#endif
 
 #if ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS)
     if (auto scrollingCoordinator = this->scrollingCoordinator())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to