Backed out 2 changesets (bug 1745969) for causing wpt/mochitest failures.

Backed out changeset a23bb92cb6fe (bug 1745969)
Backed out changeset aec681965be3 (bug 1745969)
This commit is contained in:
Sandor Molnar 2022-11-08 05:51:09 +02:00
Родитель ce6661d379
Коммит 1ae11a4732
10 изменённых файлов: 191 добавлений и 25 удалений

Просмотреть файл

@ -641,7 +641,7 @@ bool nsHTMLScrollFrame::TryLayout(ScrollReflowInput& aState,
mHelper.mMinimumScaleSize.height - overflowRect.YMost();
}
nsRect scrolledRect =
mHelper.GetScrolledRectInternal(overflowRect, scrollPortSize);
mHelper.GetUnsnappedScrolledRectInternal(overflowRect, scrollPortSize);
ROOT_SCROLLBAR_LOG(
"TryLayout scrolledRect:%s overflowRect:%s scrollportSize:%s\n",
ToString(scrolledRect).c_str(), ToString(overflowRect).c_str(),
@ -1000,7 +1000,7 @@ void nsHTMLScrollFrame::ReflowContents(ScrollReflowInput& aState,
nsSize kidSize = GetContainSizeAxes().ContainSize(
kidDesiredSize.PhysicalSize(), *aState.mReflowInput.mFrame);
nsSize insideBorderSize = ComputeInsideBorderSize(aState, kidSize);
nsRect scrolledRect = mHelper.GetScrolledRectInternal(
nsRect scrolledRect = mHelper.GetUnsnappedScrolledRectInternal(
kidDesiredSize.ScrollableOverflow(), insideBorderSize);
if (nsRect(nsPoint(0, 0), insideBorderSize).Contains(scrolledRect)) {
// Let's pretend we had no scrollbars coming in here
@ -1074,7 +1074,7 @@ void nsHTMLScrollFrame::PlaceScrollArea(ScrollReflowInput& aState,
// Preserve the width or height of empty rects
const nsSize portSize = mHelper.ScrollPort().Size();
nsRect scrolledRect = mHelper.GetScrolledRectInternal(
nsRect scrolledRect = mHelper.GetUnsnappedScrolledRectInternal(
aState.mContentsOverflowAreas.ScrollableOverflow(), portSize);
nsRect scrolledArea =
scrolledRect.UnionEdges(nsRect(nsPoint(0, 0), portSize));
@ -4234,8 +4234,8 @@ void ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// of the scrolled area.
DisplayListClipState::AutoSaveRestore scrolledRectClipState(aBuilder);
nsRect scrolledRectClip =
GetScrolledRectInternal(mScrolledFrame->ScrollableOverflowRect(),
mScrollPort.Size()) +
GetUnsnappedScrolledRectInternal(
mScrolledFrame->ScrollableOverflowRect(), mScrollPort.Size()) +
mScrolledFrame->GetPosition();
bool clippedToDisplayPort = false;
if (mWillBuildScrollableLayer && aBuilder->IsPaintingToWindow()) {
@ -7332,9 +7332,93 @@ bool ScrollFrameHelper::GetBorderRadii(const nsSize& aFrameSize,
return true;
}
static nscoord SnapCoord(nscoord aCoord, double aRes,
nscoord aAppUnitsPerPixel) {
double snappedToLayerPixels = NS_round((aRes * aCoord) / aAppUnitsPerPixel);
return NSToCoordRoundWithClamp(snappedToLayerPixels * aAppUnitsPerPixel /
aRes);
}
nsRect ScrollFrameHelper::GetScrolledRect() const {
return GetScrolledRectInternal(mScrolledFrame->ScrollableOverflowRect(),
mScrollPort.Size());
nsRect result = GetUnsnappedScrolledRectInternal(
mScrolledFrame->ScrollableOverflowRect(), mScrollPort.Size());
#if 0
// This happens often enough.
if (result.width < mScrollPort.width || result.height < mScrollPort.height) {
NS_WARNING("Scrolled rect smaller than scrollport?");
}
#endif
// Expand / contract the result by up to half a layer pixel so that scrolling
// to the right / bottom edge does not change the layer pixel alignment of
// the scrolled contents.
if (result.x == 0 && result.y == 0 && result.width == mScrollPort.width &&
result.height == mScrollPort.height) {
// The edges that we would snap are already aligned with the scroll port,
// so we can skip all the work below.
return result;
}
// For that, we first convert the scroll port and the scrolled rect to rects
// relative to the reference frame, since that's the space where painting does
// snapping.
nsSize visualViewportSize = GetVisualViewportSize();
const nsIFrame* referenceFrame =
mReferenceFrameDuringPainting ? mReferenceFrameDuringPainting
: nsLayoutUtils::GetReferenceFrame(mOuter);
nsPoint toReferenceFrame = mOuter->GetOffsetToCrossDoc(referenceFrame);
nsRect scrollPort(mScrollPort.TopLeft() + toReferenceFrame,
visualViewportSize);
nsRect scrolledRect = result + scrollPort.TopLeft();
if (scrollPort.Overflows() || scrolledRect.Overflows()) {
return result;
}
// Now, snap the bottom right corner of both of these rects.
// We snap to layer pixels, so we need to respect the layer's scale.
nscoord appUnitsPerDevPixel =
mScrolledFrame->PresContext()->AppUnitsPerDevPixel();
MatrixScales scale = GetPaintedLayerScaleForFrame(mScrolledFrame);
if (scale.xScale == 0 || scale.yScale == 0) {
scale = MatrixScales();
}
// Compute bounds for the scroll position, and computed the snapped scrolled
// rect from the scroll position bounds.
nscoord snappedScrolledAreaBottom =
SnapCoord(scrolledRect.YMost(), scale.yScale, appUnitsPerDevPixel);
nscoord snappedScrollPortBottom =
SnapCoord(scrollPort.YMost(), scale.yScale, appUnitsPerDevPixel);
nscoord maximumScrollOffsetY =
snappedScrolledAreaBottom - snappedScrollPortBottom;
result.SetBottomEdge(scrollPort.height + maximumScrollOffsetY);
if (GetScrolledFrameDir() == StyleDirection::Ltr) {
nscoord snappedScrolledAreaRight =
SnapCoord(scrolledRect.XMost(), scale.xScale, appUnitsPerDevPixel);
nscoord snappedScrollPortRight =
SnapCoord(scrollPort.XMost(), scale.xScale, appUnitsPerDevPixel);
nscoord maximumScrollOffsetX =
snappedScrolledAreaRight - snappedScrollPortRight;
result.SetRightEdge(scrollPort.width + maximumScrollOffsetX);
} else {
// In RTL, the scrolled area's right edge is at scrollPort.XMost(),
// and the scrolled area's x position is zero or negative. We want
// the right edge to stay flush with the scroll port, so we snap the
// left edge.
nscoord snappedScrolledAreaLeft =
SnapCoord(scrolledRect.x, scale.xScale, appUnitsPerDevPixel);
nscoord snappedScrollPortLeft =
SnapCoord(scrollPort.x, scale.xScale, appUnitsPerDevPixel);
nscoord minimumScrollOffsetX =
snappedScrolledAreaLeft - snappedScrollPortLeft;
result.SetLeftEdge(minimumScrollOffsetX);
}
return result;
}
StyleDirection ScrollFrameHelper::GetScrolledFrameDir() const {
@ -7352,9 +7436,11 @@ StyleDirection ScrollFrameHelper::GetScrolledFrameDir() const {
return IsBidiLTR() ? StyleDirection::Ltr : StyleDirection::Rtl;
}
nsRect ScrollFrameHelper::GetScrolledRectInternal(
const nsRect& aScrolledOverflowArea, const nsSize& aScrollPortSize) const {
return nsLayoutUtils::GetScrolledRect(mScrolledFrame, aScrolledOverflowArea,
nsRect ScrollFrameHelper::GetUnsnappedScrolledRectInternal(
const nsRect& aScrolledFrameOverflowArea,
const nsSize& aScrollPortSize) const {
return nsLayoutUtils::GetScrolledRect(mScrolledFrame,
aScrolledFrameOverflowArea,
aScrollPortSize, GetScrolledFrameDir());
}

Просмотреть файл

@ -372,7 +372,7 @@ class ScrollFrameHelper : public nsIReflowCallback {
nsRect GetScrolledRect() const;
/**
* GetScrolledRectInternal is designed to encapsulate deciding which
* GetUnsnappedScrolledRectInternal is designed to encapsulate deciding which
* directions of overflow should be reachable by scrolling and which
* should not. Callers should NOT depend on it having any particular
* behavior (although nsXULScrollFrame currently does).
@ -382,8 +382,8 @@ class ScrollFrameHelper : public nsIReflowCallback {
* nsXULScrollFrames, and allows scrolling down and to the left for
* nsHTMLScrollFrames with RTL directionality.
*/
nsRect GetScrolledRectInternal(const nsRect& aScrolledOverflowArea,
const nsSize& aScrollPortSize) const;
nsRect GetUnsnappedScrolledRectInternal(const nsRect& aScrolledOverflowArea,
const nsSize& aScrollPortSize) const;
layers::ScrollDirections GetAvailableScrollingDirectionsForUserInputEvents()
const;

Просмотреть файл

@ -28,12 +28,8 @@ function handleLoad() {
});
} else {
childWin.waitForAllPaintsFlushed(function() {
// Verify that the scroll position was retained.
// NOTE: Window.scrollMaY is a long value, so we need to round
// Window.scrollY which is double.
// NOTE: Window.scrollMaxY is non-standard, so difference < 1.0 would not
// be a big problem.
is(Math.round(childWin.scrollY), childWin.scrollMaxY);
// Verify that the scroll position was retained
is(childWin.scrollY, childWin.scrollMaxY);
childWin.close();
SimpleTest.finish();
});

Просмотреть файл

@ -18,10 +18,10 @@ q {
}
</style>
<script>
document.addEventListener("MozReftestInvalidate", () => {
onload = function () {
scrollTo(0, 3450);
document.documentElement.classList.remove("reftest-wait");
});
}
</script>
<body>
<q>But these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytelling</q>

Просмотреть файл

@ -18,17 +18,17 @@ q {
}
</style>
<script>
document.addEventListener("MozReftestInvalidate", () => {
onload = function () {
requestAnimationFrame(function () {
scrollTo(0, 300);
requestAnimationFrame(function () {
requestAnimationFrame(function () {
scrollTo(0, 3450);
document.documentElement.classList.remove("reftest-wait");
});
})
});
});
});
})
}
</script>
<body>
<q>But these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytellingBut these are real problems worth exploring in storytelling</q>

Просмотреть файл

@ -1,38 +1,98 @@
[scrollable-overflow-padding.html]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[scrollable-container 1]
expected:
if os == "android": FAIL
[scrollable-container 2]
expected: FAIL
[scrollable-container 3]
expected:
if os == "android": FAIL
[scrollable-container 4]
expected: FAIL
[scrollable-container 5]
expected:
if os == "android": FAIL
[scrollable-container 6]
expected:
if os == "android": FAIL
[scrollable-container 7]
expected: FAIL
[scrollable-container 8]
expected:
if os == "android": FAIL
[scrollable-container 9]
expected: FAIL
[scrollable-container 10]
expected:
if os == "android": FAIL
[scrollable-container 12]
expected: FAIL
[scrollable-container 14]
expected: FAIL
[scrollable-container 16]
expected:
if os == "android": FAIL
[scrollable-container 17]
expected: FAIL
[scrollable-container 18]
expected:
if os == "android": FAIL
[scrollable-container 19]
expected: FAIL
[scrollable-container 20]
expected:
if os == "android": FAIL
[scrollable-container 21]
expected:
if os == "android": FAIL
[scrollable-container 22]
expected: FAIL
[scrollable-container 23]
expected:
if os == "android": FAIL
[scrollable-container 24]
expected: FAIL
[scrollable-container 25]
expected:
if os == "android": FAIL
[scrollable-container 26]
expected:
if os == "android": FAIL
[scrollable-container 27]
expected: FAIL
[scrollable-container 28]
expected:
if os == "android": FAIL
[scrollable-container 29]
expected: FAIL
[scrollable-container 30]
expected:
if os == "android": FAIL

Просмотреть файл

@ -1,3 +1,6 @@
[scrollable-overflow-self-collapsing.html]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[.target 3]
expected:
if os == "android": FAIL

Просмотреть файл

@ -1,3 +1,10 @@
[scrollable-overflow-transform-001.html]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[.container 1]
expected:
if os == "android": FAIL
[.container 3]
expected:
if os == "android": FAIL

Просмотреть файл

@ -1,3 +1,10 @@
[scrollable-overflow-transform-002.html]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[.container 1]
expected:
if os == "android": FAIL
[.container 3]
expected:
if os == "android": FAIL

Просмотреть файл

@ -1,3 +1,10 @@
[scrollable-overflow-transform-003.html]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[.container 1]
expected:
if os == "android": FAIL
[.container 3]
expected:
if os == "android": FAIL