⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 254552 in webkit


Ignore:
Timestamp:
Jan 14, 2020, 6:03:37 PM (7 years ago)
Author:
timothy_horton@apple.com
Message:

REGRESSION (r253394): After swiping back during a navigation, WKWebView gets stuck with the forward content, stops repainting
​https://bugs.webkit.org/show_bug.cgi?id=206268
<rdar://problem/58536702>

Reviewed by Simon Fraser.

  • UIProcess/ViewGestureController.cpp:

(WebKit::ViewGestureController::endSwipeGesture):

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

(WebKit::ViewGestureController::beginSwipeGesture):
(WebKit::ViewGestureController::endSwipeGesture):
(WebKit::ViewGestureController::removeSwipeSnapshot):

  • UIProcess/mac/ViewGestureControllerMac.mm:

(WebKit::ViewGestureController::beginSwipeGesture):
(WebKit::ViewGestureController::removeSwipeSnapshot):
After r253394, we start loading the destination page in willEndSwipeGesture,
when we know the gesture will complete, instead of in endSwipeGesture,
when it is actually done.

This means that if we decide that we should tear down the snapshot immediately,
this can now happen in the window between willEndSwipeGesture and endSwipeGesture.

However, removeSwipeSnapshot has numerous dependencies on endSwipeGesture
(especially on iOS, where there are /also/ dependencies in the other direction -
endSwipeGesture will never be called after removeSwipeSnapshot because
of the gestureID mismatch).

Regardless, it does not make sense to remove the snapshot while the animation
is still running. So, if something causes removeSwipeSnapshot to be called
before endSwipeGesture, we just set a bit and call it inside endSwipeGesture instead.

This ends up putting the snapshot removal ordering back as it was before r253394.

Location:
trunk/Source/WebKit
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r254550 r254552  
     12020-01-14  Tim Horton  <timothy_horton@apple.com>
     2
     3        REGRESSION (r253394): After swiping back during a navigation, WKWebView gets stuck with the forward content, stops repainting
     4        https://bugs.webkit.org/show_bug.cgi?id=206268
     5        <rdar://problem/58536702>
     6
     7        Reviewed by Simon Fraser.
     8
     9        * UIProcess/ViewGestureController.cpp:
     10        (WebKit::ViewGestureController::endSwipeGesture):
     11        * UIProcess/ViewGestureController.h:
     12        * UIProcess/ios/ViewGestureControllerIOS.mm:
     13        (WebKit::ViewGestureController::beginSwipeGesture):
     14        (WebKit::ViewGestureController::endSwipeGesture):
     15        (WebKit::ViewGestureController::removeSwipeSnapshot):
     16        * UIProcess/mac/ViewGestureControllerMac.mm:
     17        (WebKit::ViewGestureController::beginSwipeGesture):
     18        (WebKit::ViewGestureController::removeSwipeSnapshot):
     19        After r253394, we start loading the destination page in willEndSwipeGesture,
     20        when we know the gesture will complete, instead of in endSwipeGesture,
     21        when it is actually done.
     22
     23        This means that if we decide that we should tear down the snapshot immediately,
     24        this can now happen in the window between willEndSwipeGesture and endSwipeGesture.
     25
     26        However, removeSwipeSnapshot has numerous dependencies on endSwipeGesture
     27        (especially on iOS, where there are /also/ dependencies in the other direction -
     28        endSwipeGesture will never be called after removeSwipeSnapshot because
     29        of the gestureID mismatch).
     30
     31        Regardless, it does not make sense to remove the snapshot while the animation
     32        is still running. So, if something causes removeSwipeSnapshot to be called
     33        before endSwipeGesture, we just set a bit and call it inside endSwipeGesture instead.
     34
     35        This ends up putting the snapshot removal ordering back as it was before r253394.
     36
    1372020-01-14  Per Arne Vollan  <pvollan@apple.com>
    238
  • trunk/Source/WebKit/UIProcess/ViewGestureController.cpp

    r254514 r254552  
    606606#endif
    607607
     608    m_didCallEndSwipeGesture = true;
     609
    608610    if (cancelled) {
    609611        removeSwipeSnapshot();
    … …  
    615617
    616618    m_snapshotRemovalTracker.eventOccurred(SnapshotRemovalTracker::SwipeAnimationEnd, SnapshotRemovalTracker::ShouldIgnoreEventIfPaused::No);
     619
     620    // removeSwipeSnapshot() was called between willEndSwipeGesture() and endSwipeGesture().
     621    // We couldn't remove it then, because the animation was still running, but now we can!
     622    if (m_removeSnapshotImmediatelyWhenGestureEnds) {
     623        removeSwipeSnapshot();
     624        return;
     625    }
    617626}
    618627
  • trunk/Source/WebKit/UIProcess/ViewGestureController.h

    r253514 r254552  
    436436    bool m_didStartProvisionalLoad { false };
    437437
     438    bool m_didCallEndSwipeGesture { false };
     439    bool m_removeSnapshotImmediatelyWhenGestureEnds { false };
     440
    438441    SnapshotRemovalTracker m_snapshotRemovalTracker;
    439442    WTF::Function<void()> m_loadCallback;
  • trunk/Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm

    r253450 r254552  
    259259    [m_swipeTransitionContext _setTransitionIsInFlight:YES];
    260260    m_didCallWillEndSwipeGesture = false;
     261    m_didCallEndSwipeGesture = false;
     262    m_removeSnapshotImmediatelyWhenGestureEnds = false;
    261263    [m_swipeTransitionContext _setInteractiveUpdateHandler:^(BOOL finish, CGFloat percent, BOOL transitionCompleted, _UIViewControllerTransitionContext *) {
    262264        if (finish)
    … …  
    317319        willEndSwipeGesture(*targetItem, cancelled);
    318320
     321    m_didCallEndSwipeGesture = true;
     322
    319323    [context _setTransitionIsInFlight:NO];
    320324    [context _setInteractor:nil];
    … …  
    347351    }
    348352
     353    // removeSwipeSnapshot() was called between willEndSwipeGesture() and endSwipeGesture().
     354    // We couldn't remove it then, because the animation was still running, but now we can!
     355    if (m_removeSnapshotImmediatelyWhenGestureEnds) {
     356        removeSwipeSnapshot();
     357        return;
     358    }
     359
    349360    auto pageID = m_webPageProxy.identifier();
    350361    GestureID gestureID = m_currentGestureID;
    … …  
    399410        return;
    400411
     412    if (!m_didCallEndSwipeGesture) {
     413        m_removeSnapshotImmediatelyWhenGestureEnds = true;
     414        return;
     415    }
     416
    401417    [m_snapshotView removeFromSuperview];
    402418    m_snapshotView = nullptr;
  • trunk/Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm

    r252155 r254552  
    467467    if (m_webPageProxy.preferences().viewGestureDebuggingEnabled())
    468468        applyDebuggingPropertiesToSwipeViews();
     469
     470    m_didCallEndSwipeGesture = false;
     471    m_removeSnapshotImmediatelyWhenGestureEnds = false;
    469472
    470473    CALayer *layerAdjacentToSnapshot = determineLayerAdjacentToSnapshotForParent(direction, snapshotLayerParent);
    … …  
    600603        return;
    601604
     605    if (!m_didCallEndSwipeGesture) {
     606        m_removeSnapshotImmediatelyWhenGestureEnds = true;
     607        return;
     608    }
     609
    602610    if (m_currentSwipeSnapshot)
    603611        m_currentSwipeSnapshot->setVolatile(true);
Note: See TracChangeset for help on using the changeset viewer.