Closed Bug 1494694 Opened 3 years ago Closed 3 years ago
Item main Delta Size is not well-documented
46 bytes, text/x-phabricator-request
|Details | Review|
STR: - 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().getItems() 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?
Assignee: nobody → bwerth
Okay, in my determination, this is working as intended. It's explained here in a comment that I need to improve: https://searchfox.org/mozilla-central/source/layout/generic/nsFlexContainerFrame.h#43 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 email@example.com: https://hg.mozilla.org/integration/autoland/rev/72d5f7a7f6ec Improve a comment in the ComputedFlexItemInfo structure header. r=dholbert
You need to log in before you can comment on or make changes to this bug.