Backed out changeset 68a1543cecb8 (bug 1789464) for causing Wr failures at massive-element-left-of-viewport-partially-onscreen-new.html

This commit is contained in:
Cristina Horotan
2025-02-26 06:17:58 +02:00
parent 28f90383e3
commit 02ec389420
13 changed files with 191 additions and 44 deletions

View File

@@ -805,15 +805,15 @@ void Element::ScrollIntoView(const ScrollIntoViewOptions& aOptions) {
const auto block = ToWhereToScroll(aOptions.mBlock); const auto block = ToWhereToScroll(aOptions.mBlock);
const auto inline_ = ToWhereToScroll(aOptions.mInline); const auto inline_ = ToWhereToScroll(aOptions.mInline);
ScrollFlags scrollFlags = ScrollFlags::ScrollOverflowHidden | ScrollFlags scrollFlags =
ScrollFlags::TriggeredByScript | ScrollFlags::ScrollOverflowHidden | ScrollFlags::TriggeredByScript;
ScrollFlags::AxesAreLogical;
if (aOptions.mBehavior == ScrollBehavior::Smooth) { if (aOptions.mBehavior == ScrollBehavior::Smooth) {
scrollFlags |= ScrollFlags::ScrollSmooth; scrollFlags |= ScrollFlags::ScrollSmooth;
} else if (aOptions.mBehavior == ScrollBehavior::Auto) { } else if (aOptions.mBehavior == ScrollBehavior::Auto) {
scrollFlags |= ScrollFlags::ScrollSmoothAuto; scrollFlags |= ScrollFlags::ScrollSmoothAuto;
} }
// TODO: Propagate whether the axes are logical or not down (via scrollflags).
presShell->ScrollContentIntoView( presShell->ScrollContentIntoView(
this, ScrollAxis(block, WhenToScroll::Always), this, ScrollAxis(block, WhenToScroll::Always),
ScrollAxis(inline_, WhenToScroll::Always), scrollFlags); ScrollAxis(inline_, WhenToScroll::Always), scrollFlags);

View File

@@ -3849,38 +3849,6 @@ void PresShell::ScrollFrameIntoVisualViewport(Maybe<nsPoint>& aDestination,
bool PresShell::ScrollFrameIntoView( bool PresShell::ScrollFrameIntoView(
nsIFrame* aTargetFrame, const Maybe<nsRect>& aKnownRectRelativeToTarget, nsIFrame* aTargetFrame, const Maybe<nsRect>& aKnownRectRelativeToTarget,
ScrollAxis aVertical, ScrollAxis aHorizontal, ScrollFlags aScrollFlags) { ScrollAxis aVertical, ScrollAxis aHorizontal, ScrollFlags aScrollFlags) {
// If the AxesAreLogical flag is set, the aVertical and aHorizontal params
// actually refer to block and inline axes respectively, so we resolve them
// to physical axes/directions here.
// XXX Maybe we should convert more of the following code to logical axes,
// if it's convenient for more callers to work that way?
if (aScrollFlags & ScrollFlags::AxesAreLogical) {
// The aVertical parameter actually refers to the element's block axis,
// and aHorizontal to its inline axis. Potentially reverse/swap them,
// according to its writing mode and directionality.
WritingMode wm = aTargetFrame->GetWritingMode();
if (wm.IsVerticalRL()) {
// Reverse the block-axis percentage.
if (aVertical.mWhereToScroll.mPercentage) {
aVertical.mWhereToScroll.mPercentage =
Some(100 - aVertical.mWhereToScroll.mPercentage.value());
}
}
if (wm.IsInlineReversed()) {
// Reverse the inline-axis percentage.
if (aHorizontal.mWhereToScroll.mPercentage) {
aHorizontal.mWhereToScroll.mPercentage =
Some(100 - aHorizontal.mWhereToScroll.mPercentage.value());
}
}
if (wm.IsVertical()) {
std::swap(aVertical, aHorizontal);
}
// Remove the AxesAreLogical flag, to make it clear that methods we call
// always get physical axes from here on.
aScrollFlags &= ~ScrollFlags::AxesAreLogical;
}
// The scroll margin only applies to the whole bounds of the element, so don't // The scroll margin only applies to the whole bounds of the element, so don't
// apply it if we get an arbitrary rect / point to scroll to. // apply it if we get an arbitrary rect / point to scroll to.
const nsMargin scrollMargin = const nsMargin scrollMargin =

View File

@@ -606,9 +606,6 @@ class PresShell final : public nsStubDocumentObserver,
* If ScrollNoParentFrames is set then we only scroll * If ScrollNoParentFrames is set then we only scroll
* nodes in this document, not in any parent documents which * nodes in this document, not in any parent documents which
* contain this document in a iframe or the like. * contain this document in a iframe or the like.
* If AxesAreLogical is set, then the aVertical param actually refers to the
* frame's block axis, and the aHorizontal param to its inline axis, rather
* than to physical directions.
* @return true if any scrolling happened, false if no scrolling happened * @return true if any scrolling happened, false if no scrolling happened
*/ */
MOZ_CAN_RUN_SCRIPT MOZ_CAN_RUN_SCRIPT
@@ -1652,10 +1649,6 @@ class PresShell final : public nsStubDocumentObserver,
* using ScrollContainerFrame::ScrollMode::SMOOTH_MSD; * using ScrollContainerFrame::ScrollMode::SMOOTH_MSD;
* otherwise, ScrollContainerFrame::ScrollMode::INSTANT * otherwise, ScrollContainerFrame::ScrollMode::INSTANT
* will be used. * will be used.
* If ScrollFlags::AxesAreLogical is set, then the
* aVertical param actually refers to the element's
* block axis, and the aHorizontal param to its inline
* axis, rather than to physical directions.
*/ */
MOZ_CAN_RUN_SCRIPT MOZ_CAN_RUN_SCRIPT
nsresult ScrollContentIntoView(nsIContent* aContent, ScrollAxis aVertical, nsresult ScrollContentIntoView(nsIContent* aContent, ScrollAxis aVertical,

View File

@@ -146,12 +146,11 @@ enum class ScrollFlags : uint8_t {
ScrollSmooth = 1 << 3, ScrollSmooth = 1 << 3,
ScrollSmoothAuto = 1 << 4, ScrollSmoothAuto = 1 << 4,
TriggeredByScript = 1 << 5, TriggeredByScript = 1 << 5,
AxesAreLogical = 1 << 6,
// NOTE: `Anchor` means here is "scrolling to an anchor", not "CSS scroll // NOTE: `Anchor` means here is "scrolling to an anchor", not "CSS scroll
// anchoring". // anchoring".
AnchorScrollFlags = AnchorScrollFlags =
ScrollOverflowHidden | ScrollNoParentFrames | TriggeredByScript, ScrollOverflowHidden | ScrollNoParentFrames | TriggeredByScript,
ALL_BITS = (1 << 7) - 1, ALL_BITS = (1 << 6) - 1,
}; };
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(ScrollFlags) MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(ScrollFlags)

View File

@@ -0,0 +1,20 @@
[scrollIntoView-horizontal-tb-writing-mode-and-rtl-direction.html]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[scrollIntoView({"block":"end","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"center","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"end","inline":"end"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"end"})]
expected: FAIL
[scrollIntoView({"block":"center","inline":"end"})]
expected: FAIL

View File

@@ -0,0 +1,3 @@
[scrollIntoView-horizontal-tb-writing-mode.html]
expected:
if (os == "android") and fission: [OK, TIMEOUT]

View File

@@ -0,0 +1,20 @@
[scrollIntoView-sideways-lr-writing-mode-and-rtl-direction.html]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[scrollIntoView({"block":"end","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"center"})]
expected: FAIL
[scrollIntoView({"block":"center","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"end","inline":"center"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"end"})]
expected: FAIL
[scrollIntoView({"block":"center","inline":"end"})]
expected: FAIL

View File

@@ -0,0 +1,26 @@
[scrollIntoView-sideways-lr-writing-mode.html]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[scrollIntoView({"block":"end","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"center"})]
expected: FAIL
[scrollIntoView({"block":"center","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"end","inline":"center"})]
expected: FAIL
[scrollIntoView({"block":"end","inline":"end"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"end"})]
expected: FAIL
[scrollIntoView({"block":"center","inline":"end"})]
expected: FAIL

View File

@@ -0,0 +1,20 @@
[scrollIntoView-sideways-rl-writing-mode-and-rtl-direction.html]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[scrollIntoView({"block":"start","inline":"center"})]
expected: FAIL
[scrollIntoView({"block":"center","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"end","inline":"center"})]
expected: FAIL
[scrollIntoView({"block":"end","inline":"end"})]
expected: FAIL
[scrollIntoView({"block":"center","inline":"end"})]
expected: FAIL

View File

@@ -0,0 +1,26 @@
[scrollIntoView-sideways-rl-writing-mode.html]
expected:
if (os == "android") and fission: [TIMEOUT, OK]
[scrollIntoView({"block":"end","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"center"})]
expected: FAIL
[scrollIntoView({"block":"center","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"end","inline":"center"})]
expected: FAIL
[scrollIntoView({"block":"end","inline":"end"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"end"})]
expected: FAIL
[scrollIntoView({"block":"center","inline":"end"})]
expected: FAIL

View File

@@ -0,0 +1,26 @@
[scrollIntoView-vertical-lr-writing-mode-and-rtl-direction.html]
expected:
if (os == "android") and fission: [TIMEOUT, OK]
[scrollIntoView({"block":"end","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"center"})]
expected: FAIL
[scrollIntoView({"block":"center","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"end","inline":"center"})]
expected: FAIL
[scrollIntoView({"block":"end","inline":"end"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"end"})]
expected: FAIL
[scrollIntoView({"block":"center","inline":"end"})]
expected: FAIL

View File

@@ -0,0 +1,20 @@
[scrollIntoView-vertical-lr-writing-mode.html]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[scrollIntoView({"block":"end","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"center"})]
expected: FAIL
[scrollIntoView({"block":"center","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"end","inline":"center"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"end"})]
expected: FAIL
[scrollIntoView({"block":"center","inline":"end"})]
expected: FAIL

View File

@@ -0,0 +1,26 @@
[scrollIntoView-vertical-rl-writing-mode.html]
expected:
if (os == "android") and fission: [OK, TIMEOUT]
[scrollIntoView({"block":"end","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"center"})]
expected: FAIL
[scrollIntoView({"block":"center","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"start"})]
expected: FAIL
[scrollIntoView({"block":"end","inline":"center"})]
expected: FAIL
[scrollIntoView({"block":"end","inline":"end"})]
expected: FAIL
[scrollIntoView({"block":"start","inline":"end"})]
expected: FAIL
[scrollIntoView({"block":"center","inline":"end"})]
expected: FAIL