Closed Bug 917032 Opened 11 years ago Closed 11 years ago

Refactor flexbox layout logic some more, to make pagination more straightforward

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla27

People

(Reporter: dholbert, Assigned: dholbert)

References

Details

Attachments

(3 files)

I split out some of my flexbox-pagination code into some simpler minor-refactoring patches, which my pagination patches stack on top of.

(This is much like bug 885424, just with a few new patches.)
So right now, nsFlexboxFrame runs the flexbox layout algorithm using coordinates that are relative to its border-box.

This turned out to make things a bit tricky for pagination patches, because it means there are several places where we need GetSkipSides() checks to find out whether the container's border/padding should be discounted.

SO: This patch makes things simpler by doing flexbox layout in content-box space -- i.e. *ignoring* borders and padding on the container -- and then adding them in at the last minute, when we give each child their final reflow.
Attachment #805768 - Flags: review?(matspal)
(Note: The two "EnterMargin(ReflowState.mComputedBorderPadding)" calls removed in Part 1 are what currently move our PositionTracker "current position" representation past the flex container's border/padding, so that flex items end up inside of the border/padding instead of on top of it.  Since the patch makes us ignore the container's border/padding until the very end, it can also drop those calls.)
This patch abstracts some logic into PhysicalPositionFromLogicalPosition().

If we have a right-to-left flexbox that's 200px wide, and we end up with a flex item at main-axis-position 50px, we need to convert that "50px from right edge" into "x-position of 200px-50px = 150px" to get x-position where we should reflow the child.

This patch just pushes that polarity-flipping code into PhysicalPositionFromLogicalPosition(), to make Reflow a little cleaner/clearer.
Attachment #805771 - Flags: review?(matspal)
This patch just moves some code up a bit -- in particular, it makes us compute a flex item's "physical" (x,y) position in its container *before* we create its nsReflowState.

Right now, it doesn't matter where we do this computation, but it'll be needed in the earlier spot for pagination support, because when we switch to giving the flex item's reflow state a meaningful availableHeight, we'll need to have its physical y-position in order to compute the right available height to give it.
Attachment #805772 - Flags: review?(matspal)
Green try run w/ these 3 patches: https://tbpl.mozilla.org/?tree=Try&rev=9410251ffa4a
Comment on attachment 805768 [details] [diff] [review]
part 1: do flex layout in container's content-box space

These changes looks good to me.  r=mats
Attachment #805768 - Flags: review?(matspal) → review+
Attachment #805771 - Flags: review?(matspal) → review+
Attachment #805772 - Flags: review?(matspal) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: