Closed Bug 1752658 Opened 3 years ago Closed 3 years ago

Some refactor around DoFlexLayout

Categories

(Core :: Layout: Flexbox, task)

task

Tracking

()

RESOLVED FIXED
99 Branch
Tracking Status
firefox99 --- fixed

People

(Reporter: TYLin, Assigned: TYLin)

Details

Attachments

(7 files)

It's been a while since I think about flexbox algorithm & fragmentation. This time when I look at DoFlexLayout and its data flow, I found some opportunities to make it clearer. See the upcoming patches.

Move the assertion for unconstrained isize to the beginning of Reflow() because
we check it in all cases -- in GetMainSizeFromReflowInput when a flex container
is row-oriented, or in the old code computing gap size and ComputeCrossSize()
when a flex container is column-oriented.

DoFlexLayout() and ComputeCrossSize() are only called in first-in-flow, so
aConsumedBSize are always 0.

Depends on D137361

The StrutInfo array is used only within DoFlexLayout, so we can restart the
flex layout within DoFlexLayout to make Reflow() simpler.

Depends on D137362

I found in/out parameters confusing when reasoning the data flow. Aggregating
DoFlexLayout's output data in a struct also reduces DoFlexLayout's number of
arguments.

Depends on D137363

We've got the tentative cross size before calling DoFlexLayout() in Reflow(). In
DoFlexLayout and a few other methods and just use that value.

Depends on D137364

Attachment #9261372 - Attachment description: Bug 1752658 Part 3 - Implement the flex layout restart in DoFlexLayout. → Bug 1752658 Part 3 - Reduce scope of the struts array in Reflow().

Currently, we pass all the five fields in FlexLayoutResult separately into
ReflowChildren(), but we really should just pass FlexLayoutResult instead.

Depends on D137365

Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/88181dec11e8 Part 1 - Compute gap sizes only in flex container's first-in-flow. r=dholbert https://hg.mozilla.org/integration/autoland/rev/112d24a3a280 Part 2 - Remove aConsumedBSize from DoFlexLayout() and ComputeCrossSize(). r=dholbert https://hg.mozilla.org/integration/autoland/rev/25f556801924 Part 3 - Reduce scope of the struts array in Reflow(). r=dholbert https://hg.mozilla.org/integration/autoland/rev/dd2291e298d0 Part 4 - Aggregate DoFlexLayout's output data in a struct instead of output arguments. r=dholbert https://hg.mozilla.org/integration/autoland/rev/68cc1c64bb66 Part 5 - Pass flex container's tentative cross size into DoFlexLayout and others. r=dholbert https://hg.mozilla.org/integration/autoland/rev/8eebe46df776 Part 6 - Pass FlexLayoutResult into ReflowChildren(). r=dholbert https://hg.mozilla.org/integration/autoland/rev/d295fb16a0cb Part 7 - Generalize GenerateFlexLines to populate FlexLayoutResult. r=dholbert
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: