Bug 1903141 Part 1 - Simplify MaybeHasFloats() that checks pushed floats. r=dholbert

After Bug 1902542 Part 5 [1], the pushed floats list is deleted if it is empty.
Therefore, we can simplify `MaybeHasFloats()` as suggested in the XXX comment.

[1] https://hg.mozilla.org/mozilla-central/rev/52a9610fc9f2

Differential Revision: https://phabricator.services.mozilla.com/D214044
This commit is contained in:
Ting-Yu Lin 2024-06-19 21:50:40 +00:00
Родитель f478ee1b96
Коммит 8f8de2d6f5
2 изменённых файлов: 13 добавлений и 14 удалений

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

@ -1224,6 +1224,18 @@ bool nsBlockFrame::IsInLineClampContext() const {
return false;
}
bool nsBlockFrame::MaybeHasFloats() const {
if (!mFloats.IsEmpty()) {
return true;
}
if (HasPushedFloats()) {
return true;
}
// For the OverflowOutOfFlowsProperty I think we do enforce that, but it's
// a mix of out-of-flow frames, so that's why the method name has "Maybe".
return HasAnyStateBits(NS_BLOCK_HAS_OVERFLOW_OUT_OF_FLOWS);
}
/**
* Iterator over all descendant inline line boxes, except for those that are
* under an independent formatting context.

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

@ -667,20 +667,7 @@ class nsBlockFrame : public nsContainerFrame {
* @return false iff this block does not have a float on any child list.
* This function is O(1).
*/
bool MaybeHasFloats() const {
if (!mFloats.IsEmpty()) {
return true;
}
// XXX this could be replaced with HasPushedFloats() if we enforced
// removing the property when the frame list becomes empty.
nsFrameList* list = GetPushedFloats();
if (list && !list->IsEmpty()) {
return true;
}
// For the OverflowOutOfFlowsProperty I think we do enforce that, but it's
// a mix of out-of-flow frames, so that's why the method name has "Maybe".
return HasAnyStateBits(NS_BLOCK_HAS_OVERFLOW_OUT_OF_FLOWS);
}
bool MaybeHasFloats() const;
protected:
/** grab overflow lines from this block's prevInFlow, and make them