mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Backed out 2 changesets (bug 1516722) for wpt failures on scroll-restoration-fragment-scrolling-samedoc.html. a=backout
Backed out changeset 8f2db95f0610 (bug 1516722) Backed out changeset 55c8e6f3e522 (bug 1516722)
This commit is contained in:
parent
b378f30b76
commit
29261f02c1
@ -19,8 +19,6 @@ function convertEntries(entries) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// TODO: Clean up these rect-handling functions so that e.g. a rect returned
|
||||
// by Element.getBoundingClientRect() Just Works with them.
|
||||
function parseRect(str) {
|
||||
var pieces = str.replace(/[()\s]+/g, "").split(",");
|
||||
SimpleTest.is(pieces.length, 4, "expected string of form (x,y,w,h)");
|
||||
@ -41,11 +39,6 @@ function rectContains(haystack, needle) {
|
||||
function rectToString(rect) {
|
||||
return "(" + rect.x + "," + rect.y + "," + rect.w + "," + rect.h + ")";
|
||||
}
|
||||
function assertRectContainment(haystackRect, haystackDesc, needleRect, needleDesc) {
|
||||
SimpleTest.ok(rectContains(haystackRect, needleRect),
|
||||
haystackDesc + " " + rectToString(haystackRect) + " should contain " +
|
||||
needleDesc + " " + rectToString(needleRect));
|
||||
}
|
||||
|
||||
function getPropertyAsRect(scrollFrames, scrollId, prop) {
|
||||
SimpleTest.ok(scrollId in scrollFrames,
|
||||
|
@ -73,8 +73,9 @@
|
||||
y: vv.offsetTop,
|
||||
w: vv.width,
|
||||
h: vv.height };
|
||||
assertRectContainment(fixedPosDisplayport, "fixed-pos displayport",
|
||||
vvRect, "visual viewport");
|
||||
ok(rectContains(fixedPosDisplayport, vvRect),
|
||||
"fixed-pos displayport " + rectToString(fixedPosDisplayport) +
|
||||
" should contain visual viewport " + rectToString(vvRect));
|
||||
}
|
||||
|
||||
function* test(testDriver) {
|
||||
|
@ -19,22 +19,14 @@
|
||||
<body>
|
||||
<div id="target"></div>
|
||||
<script>
|
||||
let vv = window.visualViewport;
|
||||
function getVisualScrollRange() {
|
||||
let rootScroller = document.scrollingElement;
|
||||
let vv = window.visualViewport;
|
||||
return {
|
||||
width: rootScroller.scrollWidth - vv.width,
|
||||
height: rootScroller.scrollHeight - vv.height,
|
||||
};
|
||||
}
|
||||
function getVisualViewportRect() {
|
||||
return {
|
||||
x: vv.pageLeft,
|
||||
y: vv.pageTop,
|
||||
w: vv.width,
|
||||
h: vv.height,
|
||||
};
|
||||
}
|
||||
function* test(testDriver) {
|
||||
SimpleTest.is(window.scrollMaxX, 0, "page should have a zero horizontal layout scroll range");
|
||||
SimpleTest.is(window.scrollMaxY, 0, "page should have a zero vertical layout scroll range");
|
||||
@ -42,24 +34,9 @@
|
||||
SimpleTest.ok(visualScrollRange.width > 0, "page should have a nonzero horizontal visual scroll range");
|
||||
SimpleTest.ok(visualScrollRange.height > 0, "page should have a nonzero vertical visual scroll range");
|
||||
let target = document.getElementById("target");
|
||||
|
||||
// Scroll target element into view. Wait until any visual scrolling is done before doing checks.
|
||||
vv.addEventListener("scroll", testDriver, { once: true });
|
||||
target.scrollIntoView();
|
||||
yield; // wait for visual viewport "scroll" event
|
||||
yield waitForApzFlushedRepaints(testDriver);
|
||||
|
||||
// Test that scrollIntoView() respected the layout scroll range.
|
||||
SimpleTest.is(window.scrollX, 0, "page should not layout-scroll with a zero layout scroll range");
|
||||
SimpleTest.is(window.scrollY, 0, "page should not layout-scroll with a zero layout scroll range");
|
||||
|
||||
// Test that scrollIntoView() did perform visual scrolling.
|
||||
let vvRect = getVisualViewportRect();
|
||||
let targetBounds = target.getBoundingClientRect();
|
||||
// set property names expected by rectContains()
|
||||
targetBounds.w = targetBounds.width;
|
||||
targetBounds.h = targetBounds.height;
|
||||
assertRectContainment(vvRect, "visual viewport", targetBounds, "target element bounding rect");
|
||||
}
|
||||
waitUntilApzStable().then(runContinuation(test)).then(subtestDone);
|
||||
</script>
|
||||
|
@ -3313,8 +3313,7 @@ static nscoord ComputeWhereToScroll(WhereToScroll aWhereToScroll,
|
||||
* stop there, even if it could get closer to the desired position by
|
||||
* moving the visual viewport within the layout viewport.
|
||||
*/
|
||||
static void ScrollToShowRect(nsIPresShell* aPresShell,
|
||||
nsIScrollableFrame* aFrameAsScrollable,
|
||||
static void ScrollToShowRect(nsIScrollableFrame* aFrameAsScrollable,
|
||||
const nsRect& aRect,
|
||||
nsIPresShell::ScrollAxis aVertical,
|
||||
nsIPresShell::ScrollAxis aHorizontal,
|
||||
@ -3386,15 +3385,6 @@ static void ScrollToShowRect(nsIPresShell* aPresShell,
|
||||
aScrollFlags & ScrollFlags::ScrollSnap
|
||||
? nsIScrollbarMediator::ENABLE_SNAP
|
||||
: nsIScrollbarMediator::DISABLE_SNAP);
|
||||
// If this is the RCD-RSF, also call ScrollToVisual() since we want to
|
||||
// scroll the rect into view visually, and that may require scrolling
|
||||
// the visual viewport in scenarios where there is not enough layout
|
||||
// scroll range.
|
||||
if (aFrameAsScrollable->IsRootScrollFrameOfDocument() &&
|
||||
aPresShell->GetPresContext()->IsRootContentDocument()) {
|
||||
aPresShell->ScrollToVisual(scrollPt, FrameMetrics::eMainThread,
|
||||
scrollMode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3560,8 +3550,7 @@ bool nsIPresShell::ScrollFrameRectIntoView(nsIFrame* aFrame,
|
||||
targetRect = targetRect.Intersect(sf->GetScrolledRect());
|
||||
}
|
||||
|
||||
ScrollToShowRect(this, sf, targetRect, aVertical, aHorizontal,
|
||||
aScrollFlags);
|
||||
ScrollToShowRect(sf, targetRect, aVertical, aHorizontal, aScrollFlags);
|
||||
|
||||
nsPoint newPosition = sf->LastScrollDestination();
|
||||
// If the scroll position increased, that means our content moved up,
|
||||
|
Loading…
Reference in New Issue
Block a user