Open Bug 1927861 Opened 17 days ago Updated 7 days ago

Spike - Investigate definite block size in continuation context

Categories

(Core :: Layout: Positioned, enhancement)

enhancement

Tracking

()

People

(Reporter: dshin, Unassigned)

References

Details

(Whiteboard: [anchorpositioning:m1])

We need a definite block size for resolving the stretch sizing, but it's set as unconstrained size - need to confirm if stretch sizing is still possible.

Hi David. Does this bug need to be added to triage for Anchoring?

Flags: needinfo?(dshin)

Yeah - let's triage it, since it would have an impact when paginating (i.e. printing) documents with anchor positioned elements...

Flags: needinfo?(dshin)
Whiteboard: [anchorpositioning:triage]
Summary: Investigate definite block size in continuation context → Spike - Investigate definite block size in continuation context
Whiteboard: [anchorpositioning:triage] → [anchorpositioning:m1]

multicol is affected as well, which uses continuations.
Crash trace from hitting an assert here
Cleaned up trace:

nsIFrame::ComputeAbsoluteAutoSize(gfxContext*, mozilla::WritingMode, mozilla::LogicalSize const&, int, mozilla::LogicalSize const&, mozilla::LogicalSize const&, mozilla::StyleSizeOverrides const&, mozilla::EnumSet<mozilla::ComputeSizeFlag, unsigned char>) [nsIFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 6792 + 0x0]
nsIFrame::ComputeSize(gfxContext*, mozilla::WritingMode, mozilla::LogicalSize const&, int, mozilla::LogicalSize const&, mozilla::LogicalSize const&, mozilla::StyleSizeOverrides const&, mozilla::EnumSet<mozilla::ComputeSizeFlag, unsigned char>) [nsIFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 6333 + 0x33]
mozilla::ReflowInput::InitConstraints(nsPresContext*, mozilla::Maybe<mozilla::LogicalSize> const&, mozilla::Maybe<mozilla::LogicalMargin> const&, mozilla::Maybe<mozilla::LogicalMargin> const&, mozilla::LayoutFrameType) [ReflowInput.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 2391 + 0x34]
mozilla::ReflowInput::Init(nsPresContext*, mozilla::Maybe<mozilla::LogicalSize> const&, mozilla::Maybe<mozilla::LogicalMargin> const&, mozilla::Maybe<mozilla::LogicalMargin> const&) [ReflowInput.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 385 + 0x15]
mozilla::ReflowInput::ReflowInput(nsPresContext*, mozilla::ReflowInput const&, nsIFrame*, mozilla::LogicalSize const&, mozilla::Maybe<mozilla::LogicalSize> const&, mozilla::EnumSet<mozilla::ReflowInput::InitFlag, unsigned char>, mozilla::StyleSizeOverrides const&, mozilla::EnumSet<mozilla::ComputeSizeFlag, unsigned char>) [ReflowInput.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 253 + 0x11]
nsContainerFrame::ReflowOverflowContainerChildren(nsPresContext*, mozilla::ReflowInput const&, mozilla::OverflowAreas&, nsIFrame::ReflowChildFlags, nsReflowStatus&, void (*)(nsFrameList&, nsFrameList&, nsContainerFrame*), mozilla::Maybe<nsSize>) [nsContainerFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 1168 + 0x3e]
nsBlockFrame::TrialReflow(nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, nsBlockFrame::TrialReflowState&) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 1875 + 0x21]
nsBlockFrame::Reflow(nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, nsReflowStatus&) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 1553 + 0x1e]
nsContainerFrame::ReflowChild(nsIFrame*, nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, mozilla::WritingMode const&, mozilla::LogicalPoint const&, nsSize const&, nsIFrame::ReflowChildFlags, nsReflowStatus&, nsOverflowContinuationTracker*) [nsContainerFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 892 + 0x1b]
nsContainerFrame::ReflowOverflowContainerChildren(nsPresContext*, mozilla::ReflowInput const&, mozilla::OverflowAreas&, nsIFrame::ReflowChildFlags, nsReflowStatus&, void (*)(nsFrameList&, nsFrameList&, nsContainerFrame*), mozilla::Maybe<nsSize>) [nsContainerFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 1176 + 0x51]
nsBlockFrame::TrialReflow(nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, nsBlockFrame::TrialReflowState&) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 1875 + 0x21]
nsBlockFrame::Reflow(nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, nsReflowStatus&) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 1553 + 0x1e]
nsContainerFrame::ReflowChild(nsIFrame*, nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, mozilla::WritingMode const&, mozilla::LogicalPoint const&, nsSize const&, nsIFrame::ReflowChildFlags, nsReflowStatus&, nsOverflowContinuationTracker*) [nsContainerFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 892 + 0x1b]
nsColumnSetFrame::ReflowColumns(mozilla::ReflowOutput&, mozilla::ReflowInput const&, nsReflowStatus&, nsColumnSetFrame::ReflowConfig const&, bool) [nsColumnSetFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 701 + 0x39]
nsColumnSetFrame::Reflow(nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, nsReflowStatus&) [nsColumnSetFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 1245 + 0x3a]
nsBlockReflowContext::ReflowBlock(mozilla::LogicalRect const&, bool, mozilla::CollapsingMargin&, int, nsLineBox*, mozilla::ReflowInput&, nsReflowStatus&, mozilla::BlockReflowState&) [nsBlockReflowContext.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 290 + 0xb]
nsBlockFrame::ReflowBlockFrame(mozilla::BlockReflowState&, GenericLineListIterator<nsLineLink, false>, bool*) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 4391 + 0x43]
nsBlockFrame::ReflowLine(mozilla::BlockReflowState&, GenericLineListIterator<nsLineLink, false>, bool*) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 3721 + 0x13]
nsBlockFrame::ReflowDirtyLines(mozilla::BlockReflowState&) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 3228 + 0x1b]
nsBlockFrame::TrialReflow(nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, nsBlockFrame::TrialReflowState&) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 1914 + 0x7]
nsBlockFrame::Reflow(nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, nsReflowStatus&) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 1553 + 0x1e]
nsBlockReflowContext::ReflowBlock(mozilla::LogicalRect const&, bool, mozilla::CollapsingMargin&, int, nsLineBox*, mozilla::ReflowInput&, nsReflowStatus&, mozilla::BlockReflowState&) [nsBlockReflowContext.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 290 + 0xb]
nsBlockFrame::ReflowBlockFrame(mozilla::BlockReflowState&, GenericLineListIterator<nsLineLink, false>, bool*) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 4391 + 0x43]
nsBlockFrame::ReflowLine(mozilla::BlockReflowState&, GenericLineListIterator<nsLineLink, false>, bool*) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 3721 + 0x13]
nsBlockFrame::ReflowDirtyLines(mozilla::BlockReflowState&) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 3228 + 0x1b]
nsBlockFrame::TrialReflow(nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, nsBlockFrame::TrialReflowState&) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 1914 + 0x7]
nsBlockFrame::Reflow(nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, nsReflowStatus&) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 1553 + 0x1e]
nsBlockReflowContext::ReflowBlock(mozilla::LogicalRect const&, bool, mozilla::CollapsingMargin&, int, nsLineBox*, mozilla::ReflowInput&, nsReflowStatus&, mozilla::BlockReflowState&) [nsBlockReflowContext.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 290 + 0xb]
nsBlockFrame::ReflowBlockFrame(mozilla::BlockReflowState&, GenericLineListIterator<nsLineLink, false>, bool*) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 4391 + 0x43]
nsBlockFrame::ReflowLine(mozilla::BlockReflowState&, GenericLineListIterator<nsLineLink, false>, bool*) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 3721 + 0x13]
nsBlockFrame::ReflowDirtyLines(mozilla::BlockReflowState&) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 3228 + 0x1b]
nsBlockFrame::TrialReflow(nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, nsBlockFrame::TrialReflowState&) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 1914 + 0x7]
nsBlockFrame::Reflow(nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, nsReflowStatus&) [nsBlockFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 1553 + 0x1e]
nsContainerFrame::ReflowChild(nsIFrame*, nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, mozilla::WritingMode const&, mozilla::LogicalPoint const&, nsSize const&, nsIFrame::ReflowChildFlags, nsReflowStatus&, nsOverflowContinuationTracker*) [nsContainerFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 892 + 0x1b]
nsCanvasFrame::Reflow(nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, nsReflowStatus&) [nsCanvasFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 710 + 0x51]
nsContainerFrame::ReflowChild(nsIFrame*, nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, mozilla::WritingMode const&, mozilla::LogicalPoint const&, nsSize const&, nsIFrame::ReflowChildFlags, nsReflowStatus&, nsOverflowContinuationTracker*) [nsContainerFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 892 + 0x1b]
mozilla::ScrollContainerFrame::ReflowScrolledFrame(mozilla::ScrollReflowInput&, bool, bool, mozilla::ReflowOutput*) [ScrollContainerFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 914 + 0x4d]
mozilla::ScrollContainerFrame::ReflowContents(mozilla::ScrollReflowInput&, mozilla::ReflowOutput const&) [ScrollContainerFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 1049 + 0x14]
mozilla::ScrollContainerFrame::Reflow(nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, nsReflowStatus&) [ScrollContainerFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 1509 + 0xa]
nsContainerFrame::ReflowChild(nsIFrame*, nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, int, int, nsIFrame::ReflowChildFlags, nsReflowStatus&, nsOverflowContinuationTracker*) [nsContainerFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 933 + 0x17]
mozilla::ViewportFrame::Reflow(nsPresContext*, mozilla::ReflowOutput&, mozilla::ReflowInput const&, nsReflowStatus&) [ViewportFrame.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 358 + 0x17]
mozilla::PresShell::DoReflow(nsIFrame*, bool, mozilla::OverflowChangedTracker*) [PresShell.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 9955 + 0x18]
mozilla::PresShell::ProcessReflowCommands(bool) [PresShell.cpp:f674da7f1bb583855d138b6b0b0611aa599a1eb9 : 10125 + 0x11]

(Thanks :dholbert for helping me track this down)

It all starts from ReflowOverflowContainerChildren - Which is a special abs-position reflow case outside of the usual reflow. Note that we pass Nothing for containing block.
This feeds to here, where we try to calculate the containing block size manually by calling ComputeContainingBlockRectangle.
In that function, I see a TODO for continuation-related workaround. This seems like a pretty good place to investigate.

Bug 154892 links from that comment.
Another one of interest, again thanks to :dholbert - Bug 546559.

Given the low bug numbers, this is a longstanding issue (That may still interfere with use cases for anchor positioning mentioned in this ticket).

(In reply to David Shin[:dshin] from comment #4)

Given the low bug numbers, this is a longstanding issue (That may still interfere with use cases for anchor positioning mentioned in this ticket).

Yup -- probably not a case we need to worry about too much, other than to be sure that the new code is handling it in a way that's ~reasonable (i.e. we're not gonna end up with content that's not-laid-out-at-all, or nscoord_MAX in size/position, or something along those lines).

i.e. if we don't fix the longstanding issue in the near term (i.e. if we don't tidy up how ReflowOverflowContainerChildren handles abspos elements in overflow continuations), then we'll need to be sure that our recently-added workaround[1] is ~robust for the time being.

[1] As I understand it, we're working around this in some recently-added code via calls to a new IsAbsolutelyPositionedWithDefiniteContainingBlock() function (here and here and here). And we need to double-check that abspos-frames-in-overflow-containers (which elicit are abspos but elicit a false response from this IsAbsolutelyPositionedWithDefiniteContainingBlock API) will still end up getting sized/positioned in a somewhat reasonable way (as reasonably as they have been up until now, at least).

You need to log in before you can comment on or make changes to this bug.