Changeset 251907 in webkit


Ignore:
Timestamp:
Oct 31, 2019 9:07:37 PM (5 years ago)
Author:
Chris Dumez
Message:

Take down the gesture snapshot early when the back/forward cache is not leveraged
https://bugs.webkit.org/show_bug.cgi?id=203713
<rdar://problem/56803910>

Reviewed by Tim Horton.

Take down the gesture snapshot as soon as the gesture is done when the back/forward cache
is not leveraged. Otherwise, the snapshot may stay up for a long time (while we load, parse
and restore scroll position) and it would look to the user as if the view was unresponsive.
Showing the page slowly loading in such cases is less confusing as the user knows what's
going on and is even able to interact with the partially loaded page.

  • Shared/WebBackForwardListItem.cpp:

(WebKit::WebBackForwardListItem::hasCachedWebPage const):

  • Shared/WebBackForwardListItem.h:
  • UIProcess/ViewGestureController.cpp:

(WebKit::ViewGestureController::endSwipeGesture):

  • UIProcess/ViewGestureController.h:
  • UIProcess/ios/ViewGestureControllerIOS.mm:

(WebKit::ViewGestureController::makeSnapshotBlank):
(WebKit::ViewGestureController::endSwipeGesture):

  • UIProcess/mac/ViewGestureControllerMac.mm:

(WebKit::ViewGestureController::makeSnapshotBlank):

Location:
trunk/Source/WebKit
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r251897 r251907  
     12019-10-31  Chris Dumez  <cdumez@apple.com>
     2
     3        Take down the gesture snapshot early when the back/forward cache is not leveraged
     4        https://bugs.webkit.org/show_bug.cgi?id=203713
     5        <rdar://problem/56803910>
     6
     7        Reviewed by Tim Horton.
     8
     9        Take down the gesture snapshot as soon as the gesture is done when the back/forward cache
     10        is not leveraged. Otherwise, the snapshot may stay up for a long time (while we load, parse
     11        and restore scroll position) and it would look to the user as if the view was unresponsive.
     12        Showing the page slowly loading in such cases is less confusing as the user knows what's
     13        going on and is even able to interact with the partially loaded page.
     14
     15        * Shared/WebBackForwardListItem.cpp:
     16        (WebKit::WebBackForwardListItem::hasCachedWebPage const):
     17        * Shared/WebBackForwardListItem.h:
     18        * UIProcess/ViewGestureController.cpp:
     19        (WebKit::ViewGestureController::endSwipeGesture):
     20        * UIProcess/ViewGestureController.h:
     21        * UIProcess/ios/ViewGestureControllerIOS.mm:
     22        (WebKit::ViewGestureController::makeSnapshotBlank):
     23        (WebKit::ViewGestureController::endSwipeGesture):
     24        * UIProcess/mac/ViewGestureControllerMac.mm:
     25        (WebKit::ViewGestureController::makeSnapshotBlank):
     26
    1272019-10-31  Per Arne Vollan  <pvollan@apple.com>
    228
  • trunk/Source/WebKit/Shared/WebBackForwardListItem.cpp

    r251121 r251907  
    183183}
    184184
     185bool WebBackForwardListItem::hasCachedWebPage() const
     186{
     187    if (!m_backForwardCacheEntry)
     188        return false;
     189    if (!m_backForwardCacheEntry->suspendedPage())
     190        return true; // In-process cached page without suspended page proxy.
     191    // Make sure the suspended page proxy has an associated WebPage.
     192    return !m_backForwardCacheEntry->suspendedPage()->pageIsClosedOrClosing();
     193}
     194
    185195#if !LOG_DISABLED
    186196const char* WebBackForwardListItem::loggingString()
  • trunk/Source/WebKit/Shared/WebBackForwardListItem.h

    r251121 r251907  
    8383    void wasRemovedFromBackForwardList();
    8484
     85    bool hasCachedWebPage() const;
    8586    WebBackForwardCacheEntry* backForwardCacheEntry() const { return m_backForwardCacheEntry.get(); }
    8687    SuspendedPageProxy* suspendedPage() const;
  • trunk/Source/WebKit/UIProcess/ViewGestureController.cpp

    r251220 r251907  
    591591    }
    592592
    593     SnapshotRemovalTracker::Events desiredEvents = SnapshotRemovalTracker::VisuallyNonEmptyLayout
     593    SnapshotRemovalTracker::Events desiredEvents;
     594    if (targetItem->hasCachedWebPage()) {
     595        desiredEvents = SnapshotRemovalTracker::VisuallyNonEmptyLayout
    594596        | SnapshotRemovalTracker::MainFrameLoad
    595597        | SnapshotRemovalTracker::SubresourceLoads
    596598        | SnapshotRemovalTracker::ScrollPositionRestoration;
     599    } else {
     600        desiredEvents = SnapshotRemovalTracker::VisuallyNonEmptyLayout;
     601        makeSnapshotBlank();
     602    }
    597603
    598604    if (renderTreeSizeThreshold) {
  • trunk/Source/WebKit/UIProcess/ViewGestureController.h

    r250820 r251907  
    311311#endif
    312312
     313    void makeSnapshotBlank();
     314
    313315    WebPageProxy& m_webPageProxy;
    314316    ViewGestureType m_activeGestureType { ViewGestureType::None };
  • trunk/Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp

    r250820 r251907  
    571571}
    572572
     573void ViewGestureController::makeSnapshotBlank()
     574{
     575}
     576
    573577} // namespace WebKit
  • trunk/Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm

    r251382 r251907  
    268268}
    269269
     270void ViewGestureController::makeSnapshotBlank()
     271{
     272    [m_snapshotView layer].contents = nil;
     273}
     274
    270275void ViewGestureController::endSwipeGesture(WebBackForwardListItem* targetItem, _UIViewControllerTransitionContext *context, bool cancelled)
    271276{
     
    313318    }
    314319
     320    SnapshotRemovalTracker::Events desiredEvents;
     321    if (targetItem->hasCachedWebPage()) {
     322        desiredEvents = SnapshotRemovalTracker::RenderTreeSizeThreshold
     323            | SnapshotRemovalTracker::RepaintAfterNavigation
     324            | SnapshotRemovalTracker::MainFrameLoad
     325            | SnapshotRemovalTracker::SubresourceLoads
     326            | SnapshotRemovalTracker::ScrollPositionRestoration;
     327    } else {
     328        desiredEvents = SnapshotRemovalTracker::VisuallyNonEmptyLayout;
     329        makeSnapshotBlank();
     330    }
     331
    315332    // FIXME: Should we wait for VisuallyNonEmptyLayout like we do on Mac?
    316     m_snapshotRemovalTracker.start(SnapshotRemovalTracker::RenderTreeSizeThreshold
    317         | SnapshotRemovalTracker::RepaintAfterNavigation
    318         | SnapshotRemovalTracker::MainFrameLoad
    319         | SnapshotRemovalTracker::SubresourceLoads
    320         | SnapshotRemovalTracker::ScrollPositionRestoration, [this] {
     333    m_snapshotRemovalTracker.start(desiredEvents, [this] {
    321334            this->removeSwipeSnapshot();
    322335    });
  • trunk/Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm

    r249275 r251907  
    172172    if (event.phase == NSEventPhaseEnded || event.phase == NSEventPhaseCancelled)
    173173        endMagnificationGesture();
     174}
     175
     176void ViewGestureController::makeSnapshotBlank()
     177{
     178    [m_swipeSnapshotLayer setContents:nil];
    174179}
    175180
Note: See TracChangeset for help on using the changeset viewer.