Closed Bug 1494694 Opened 3 years ago Closed 3 years ago

FlexItem mainDeltaSize is not well-documented


(Core :: Layout: Flexbox, defect)

Not set



Tracking Status
firefox64 --- fixed


(Reporter: pbro, Assigned: bradwerth)





(1 file)

- open the test URL
data:text/html,<div style="display:flex"><div style="flex-basis:400px;flex-grow:1;max-width:500px;">test item</div></div>
- run the chrome-only API getAsFlexContainer on the parent <div> element
- access the only item in there (I think getLines()[0].getItems()[0] or something like this)
- check the main sizing properties returned.

In my case it returns:

mainBaseSize: 400 --> This makes sense, because flex-basis is 400px
mainMaxSize: 500 --> This makes sense too, max-width:500px is defined too

mainDeltaSize: 1024 --> This does not make sense at all, the item's final size is 500px, and that should be equal to mainBaseSize + mainDeltaSize
Brad, this is the bug we discussed just now. Do you mind taking a look at why this might be?
Blocks: 1478396
Flags: needinfo?(bwerth)
Assignee: nobody → bwerth
Flags: needinfo?(bwerth)
Okay, in my determination, this is working as intended. It's explained here in a comment that I need to improve:

The mainDeltaSize is the value applied to the mainBaseSize, which is then clamped by the mainMinSize and mainMaxSize. You can think of this as how much the flex algorithm "wants" to adjust the base size, but might not be allowed to due to the min and max constraints. So the final size is base + delta, clamped. I argue that this is what we want, because we can always calculate the difference between the final size and the base size, but we need the delta value to provide insight into what size the item would have been without clamping.

I'm going to use this bug to improve the comment.
Summary: Chrome-only getAsFlexContainer returns an odd mainDeltaSize in a specific case → FlexItem mainDeltaSize is not well-documented
Comment on attachment 9012670 [details]
Bug 1494694: Improve a comment in the ComputedFlexItemInfo structure header. r=dholbert!

Daniel Holbert [:dholbert] has approved the revision.
Attachment #9012670 - Flags: review+
Pushed by
Improve a comment in the ComputedFlexItemInfo structure header. r=dholbert
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in before you can comment on or make changes to this bug.