Closed Bug 1158290 Opened 9 years ago Closed 9 years ago

Use "ISize" instead of "Width", and "BSize" instead of "Height", throughout flex layout

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla41
Tracking Status
firefox40 --- affected

People

(Reporter: dholbert, Assigned: dholbert)

References

Details

Attachments

(6 files)

Filing this bug to cover various s/Width/ISize/ and s/Height/BSize/ conversions throughout flex layout. (in support of bug 1079155)
Assignee: nobody → dholbert
Status: NEW → ASSIGNED
This patch was auto-generated with the following command:
  sed -i "s/vailableHeight/vailableBSize/g" nsFlexContainerFrame.*
Attachment #8597462 - Flags: review?(mats)
Since the previous patch was automated, it leaves us in a somewhat inconsistent state, when working with the renamed values.

This patch converts the code that finalizes "availableBSizeForContent" (formerly "availableHeightForContent") to use logical information instead of physical information. (I converted/clarified the adjoining comment, too.)
Attachment #8597466 - Flags: review?(mats)
This patch converts nsFlexContainerFrame::GenerateFlexLines to be purely logical.

In particular:
 - Previously we checked if we were vertical (!IsMainAxisHorizontal) when deciding if we should try to wrap our flex items to avoid running out of AvailableHeight. Now, we need to check if we're "column-oriented" (flex-direction:column/column-reverse), i.e. "is our main axis in the block axis", when deciding if we should try to wrap our flex items to avoid running out of *AvailableBSize*.
 - I also logicalized a "max-main-size" lookup in adjacent code, which leaves GenerateFlexLines 100% logical.
Attachment #8597462 - Flags: review?(mats) → review+
Attachment #8597466 - Flags: review?(mats) → review+
Did you forget to ask for review on part 3, or is that part not done yet?
Flags: needinfo?(dholbert)
Comment on attachment 8597471 [details] [diff] [review]
part 3: Logicalize nsFlexContainerFrame::GenerateFlexLines (prevent it from assuming "aAvailableBSizeForContent" is a vertical quantity)

r=mats assuming it's finished.
Attachment #8597471 - Flags: review+
Yup, thanks -- meant to ask for review on part 3.
Flags: needinfo?(dholbert)
(^ is parts 1, 2, and 3. More parts coming.)
Keywords: leave-open
This renames & improves the documentation of "ClampFlexContainerMainSize". This is the method that resolves our maybe-unresolved "tentative main size" into something that we can actually use for the Flex Layout Algorithm, using the distance to the next page break, and the lengths of our flex lines.

This patch is basically all (minor) renaming and documentation. It's not ISize/BSize-related; I'm only putting it on this bug because it sets the stage more clearly for the next patch (which will do ISize/BSize cleanup in this function).
Attachment #8606127 - Flags: review?(mats)
This patch removes width/height/vertical/horizontal language (and does related cleanup/clarification) in 3 functions, which are related to computing the main & cross size of our flex container:
 1) nsFlexContainerFrame::GetMainSizeFromReflowState, which just grabs a "tentative" size from the reflow state (which we use to form flex lines).

 2) ResolveFlexContainerMainSize(), which further-resolves that "tentative" size once we know how big our lines are. (Formerly ClampFlexContainerMainSize; renamed in previous patch)

 3) nsFlexContainerFrame::ComputeCrossSize(), which is the same as those ^ two functions combined, but for the cross axis.

As noted in several XXXdholbert comments in the patch, right now it's possible for us to have an unconstrained ComputedISize; I *think* this is a bug in our nsHTMLReflowState code, and that's tracked over in bug 1163238.  (For now, that just means situations that trigger this -- a flex container whose writing-mode differs from its praent, basically -- can end up being NS_UNCONSTRAINEDSIZE tall. This is silly, but can be fixed separately from this bug; probably in bug 1163238 or a followup.)

As a side effect, this patch fixes bug 1149383 (some test failures in flexbox + writing-mode reftests), so I'm updating the reftest manifest here to reflect that.
Attachment #8606132 - Flags: review?(mats)
This patch reduces explicit width/height usage by using some _LOGICAL macros (which take args "ISize, BSize" & select the main/cross-axis arg) in place of physical macros (which take args "width, height" & select the main/cross-axis one).
Attachment #8606134 - Flags: review?(mats)
Attachment #8606127 - Flags: review?(mats) → review+
Comment on attachment 8606132 [details] [diff] [review]
part 5: logicalize functions about computing main/cross size of flex container

The added comment on line 3318-3319 feels a bit redundant.
Attachment #8606132 - Flags: review?(mats) → review+
Attachment #8606134 - Flags: review?(mats) → review+
(In reply to Mats Palmgren (:mats) from comment #13)
> Comment on attachment 8606132 [details] [diff] [review]
> part 5: logicalize functions about computing main/cross size of flex
> container
> 
> The added comment on line 3318-3319 feels a bit redundant.

Fair enough -- I removed both versions of that comment before landing (the one in ResolveFlexContainerMainSize & the one in ComputeCrossSize). Thanks for the reviews!
(I have another couple patches that I'd meant to post here -- but, given that the trains have now changed tracks & having a single bug span work that happens in multiple releases is awkward, I'm going to close this out and file a new bug for remaining patches.)
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Keywords: leave-open
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
Blocks: 1180107
Blocks: 1267462
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: