Closed Bug 793686 Opened 10 years ago Closed 4 months ago

[css3-multicol] Column balancing breaks page-break-inside:avoid child

Categories

(Core :: Layout: Columns, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
105 Branch
Webcompat Priority P2
Tracking Status
firefox105 --- fixed

People

(Reporter: MatsPalmgren_bugz, Assigned: TYLin)

References

(Blocks 2 open bugs, Regressed 1 open bug)

Details

(Keywords: testcase)

Attachments

(3 files)

Attached file Testcase #1
We need to be smarter about page-break-inside:avoid during column
balancing reflows.  See testcase, the desired rendering is a 1x1 inch
blue box in a single column.  Opera gets this right.
Blocks: css-multicol
See Also: → 1712093

Note: per bug 1739561, this is now causing breakage in Gmail's "Trip" view (for travel-related emails), which display extracted bits of information in a multicol 'card' with various break-inside:avoid "units of information" inside of those cards. We're splitting up those units when we shouldn't be, due to this bug (or this category-of-bug).

Yes, column balancing can still breaks a break-inside:avoid child. It is because the helper function ShouldAvoidBreakInside() returns false when a frame is at top of page/column. A parent frame definitely cannot push a break-inside:avoid child at the top of page to the next page/column to avoid breaking it. We might need to propagate the information all the way up to column balancing algorithm, and teach the algorithm to handle the status so that it is aware that the currently chosen column bsize is too small to fit the unbreakable descendant.

See Also: → 1616377
Webcompat Priority: --- → P2

According to nsContainerFrame::ShouldAvoidBreakInside, we allow a frame to
break from inside when it is at the top of page/column, i.e. when mIsTopOfPage
is true.

This patch allows the content at the top of the column to honor the
break-inside:avoid during column balancing, so it can now propagate the
break-before status to nsColumnSetFrame if it needs to report such status.

The reference files are modified to reflect the rendering as of this patch. Note
that browsers do not agree on the rendering of 1420528-1.html. Before this
patch, our rendering is the same as Chrome by placing "Spacer" in the first
column, but now we agree with webkit by placing it in the second column.

This fixed the following assertion in nsColumnSetFrame::ReflowChildren() after
applying part 1 for layout/forms/crashtests/1690166-1.html.

ASSERTION: We have to create a continuation, but the block doesn't want us to reflow it?

Depends on D154048

Assignee: nobody → aethanyc
Status: NEW → ASSIGNED
Pushed by aethanyc@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/fcf30cda2dce
Part 1 - Don't set mIsTopOfPage on -moz-column-content during column-balancing. r=emilio
https://hg.mozilla.org/integration/autoland/rev/b7e8fd18039a
Part 2 - Call SetNextInFlowNeedsReflow() when an absolute containing block is incomplete. r=emilio
Flags: needinfo?(aethanyc)

The reftest failure in comment 7 is due to bug 1784002. I added a workaround in 611574-2.html in my latest revision.

https://treeherder.mozilla.org/jobs?repo=try&revision=9a6cfb1f70e16797747a606f5f280137f4e7ca65

Flags: needinfo?(aethanyc)
Pushed by aethanyc@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/0bfdd40111eb
Part 1 - Don't set mIsTopOfPage on -moz-column-content during column-balancing. r=emilio
https://hg.mozilla.org/integration/autoland/rev/cad5fc248dfe
Part 2 - Call SetNextInFlowNeedsReflow() when an absolute containing block is incomplete. r=emilio
Status: ASSIGNED → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 105 Branch
Component: Layout: Block and Inline → Layout: Columns
Duplicate of this bug: 1686849
Regressions: 1802782
You need to log in before you can comment on or make changes to this bug.