Bug 1441048 Part 2 - Use NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR to detect block-fragmented context when marking a line dirty. r=emilio

We can move a float frame into its block parent's PushedFloatsList during column
balancing when it cannot fit in the available block-size.

Later, when the column balancing algorithm reflows the last column in an
unconstrained block-size (in the very last reflow if needed [1]), we have to
reflow the line which contains the float's placeholder. The old code uses
`GetPrevInFlow() || GetNextInFlow()` to detect this scenario, which is
insufficient because the float's block parent might not have any continuation.
This patch uses `NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR` bit to detect this instead.

[1] https://searchfox.org/mozilla-central/rev/5c04fc7016eb7f52cf835d482f1125c8f139c959/layout/generic/nsColumnSetFrame.cpp#1144-1154

Differential Revision: https://phabricator.services.mozilla.com/D154860
This commit is contained in:
Ting-Yu Lin 2022-08-17 17:18:00 +00:00
Родитель 169f235b0c
Коммит 27be7e6ac4
3 изменённых файлов: 46 добавлений и 3 удалений

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

@ -2670,10 +2670,10 @@ void nsBlockFrame::ReflowDirtyLines(BlockReflowState& aState) {
if (!line->IsDirty()) {
const bool isPaginated =
// Last column can be reflowed unconstrained during column balancing.
// Hence the additional GetPrevInFlow() and GetNextInFlow() as a
// fail-safe fallback.
// Hence the additional NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR bit check
// as a fail-safe fallback.
aState.mReflowInput.AvailableBSize() != NS_UNCONSTRAINEDSIZE ||
GetPrevInFlow() || GetNextInFlow() ||
HasAnyStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR) ||
// Table can also be reflowed unconstrained during printing.
aState.mPresContext->IsPaginated();
if (isPaginated) {

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

@ -0,0 +1,20 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<link rel="stylesheet" href="/fonts/ahem.css">
<style>
.multicol {
column-count: 2;
column-gap: 0;
width: 200px;
font: 50px/1 Ahem;
}
</style>
<div class="multicol">
<div>AX</div>
<div>BX</div>
<div>CX</div>
</div>

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

@ -0,0 +1,23 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-break/#possible-breaks">
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1441048">
<link rel="stylesheet" href="/fonts/ahem.css">
<link rel="match" href="float-009-ref.html">
<style>
.multicol {
column-count: 2;
column-gap: 0;
width: 200px;
font: 50px/1 Ahem;
}
</style>
<div class="multicol">
<div>A<div style="float:left">X</div></div>
<div>B<div style="float:left">X</div></div>
<div>C<div style="float:left">X</div></div>
</div>