Commit 83a64ce3 authored by Botond Ballo's avatar Botond Ballo
Browse files

Bug 1519621 - Make sure ScrollToRestoredPosition() restores both the layout...

Bug 1519621 - Make sure ScrollToRestoredPosition() restores both the layout and visual scroll positions. r=tnikkel

Differential Revision: https://phabricator.services.mozilla.com/D18367

--HG--
extra : moz-landing-system : lando
parent 6a327e3d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ fuzzy-if(Android,0-51,0-22) skip-if(!Android) pref(apz.allow_zooming,true) == sc
skip-if(!Android) pref(apz.allow_zooming,true) == initial-scale-1.html initial-scale-1-ref.html

# Bug 1520320 is tracking the effort to make this test pass again.
skip-if(!asyncPan) fails-if(Android) == frame-reconstruction-scroll-clamping.html frame-reconstruction-scroll-clamping-ref.html
skip-if(!asyncPan) random-if(Android) == frame-reconstruction-scroll-clamping.html frame-reconstruction-scroll-clamping-ref.html

# Test that position:fixed and position:sticky elements are attached to the
# layout viewport.
+12 −2
Original line number Diff line number Diff line
@@ -4423,12 +4423,22 @@ void ScrollFrameHelper::ScrollToRestoredPosition() {
  // logical scroll position, but we scroll to the physical scroll position in
  // all cases

  // Continue restoring until both the layout and visual scroll positions
  // reach the destination. (Note that the two can only be different for
  // the root content document's root scroll frame, and when zoomed in).
  // This is necessary to avoid situations where the two offsets get stuck
  // at different values and nothing reconciles them (see bug 1519621 comment
  // 8).
  nsPoint logicalLayoutScrollPos = GetLogicalScrollPosition();

  // if we didn't move, we still need to restore
  if (GetLogicalVisualViewportOffset() == mLastPos) {
  if (GetLogicalVisualViewportOffset() == mLastPos ||
      logicalLayoutScrollPos == mLastPos) {
    // if our desired position is different to the scroll position, scroll.
    // remember that we could be incrementally loading so we may enter
    // and scroll many times.
    if (mRestorePos != mLastPos /* GetLogicalVisualViewportOffset() */) {
    if (mRestorePos != mLastPos /* GetLogicalVisualViewportOffset() */ ||
        mRestorePos != logicalLayoutScrollPos) {
      LoadingState state = GetPageLoadingState();
      if (state == LoadingState::Stopped && !NS_SUBTREE_DIRTY(mOuter)) {
        return;
+0 −5
Original line number Diff line number Diff line
[scroll-behavior-smooth.html]
  [BODY element scroll-behavior should not propagate to viewport]
    expected: FAIL

  [Smooth scrolling while doing history navigation.]
    expected:
      if (os == "android"): FAIL