Closed Bug 1106669 Opened 10 years ago Closed 10 years ago

nsLayoutUtils::IntrinsicForContainer needs to work with logical coordinates

Categories

(Core :: Layout: Block and Inline, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37

People

(Reporter: jfkthame, Assigned: jfkthame)

References

Details

Attachments

(2 files, 1 obsolete file)

nsLayoutUtils::IntrinsicForContainer is used when sizing a <button> to fit around an <img>, and this is why the buttons that contain images in bug 1106667's testcase don't size themselves properly.
With this, those buttons size themselves properly.
Attachment #8531026 - Flags: review?(smontagu)
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Actually, IntrinsicForContainer is primarily interested in the parent's writing mode, as it is an inline size in that WM that we're computing. If aFrame is orthogonal to its parent, it'd be its block-size that we need, but that probably isn't known yet... so we lose. But this is probably close enough for a start.
Attachment #8531682 - Flags: review?(smontagu)
Attachment #8531026 - Attachment is obsolete: true
Attachment #8531026 - Flags: review?(smontagu)
Comment on attachment 8531682 [details] [diff] [review] Convert nsLayoutUtils::IntrinsicForContainer to work with logical coordinates Review of attachment 8531682 [details] [diff] [review]: ----------------------------------------------------------------- Tests? ::: layout/base/nsLayoutUtils.cpp @@ +4101,5 @@ > + isVertical ? stylePos->mHeight : stylePos->mWidth; > + const nsStyleCoord &styleMinISize = > + isVertical ? stylePos->mMinHeight : stylePos->mMinWidth; > + const nsStyleCoord &styleMaxISize = > + isVertical ? stylePos->mMaxHeight : stylePos->mMaxWidth; I think it's better to make this one if/else rather than three ternaries in a row with the same condition. @@ +4185,5 @@ > + isVertical ? stylePos->mWidth : stylePos->mHeight; > + const nsStyleCoord &styleMinBSize = > + isVertical ? stylePos->mMinWidth : stylePos->mMinHeight; > + const nsStyleCoord &styleMaxBSize = > + isVertical ? stylePos->mMaxWidth : stylePos->mMaxHeight; Same here @@ +4188,5 @@ > + const nsStyleCoord &styleMaxBSize = > + isVertical ? stylePos->mMaxWidth : stylePos->mMaxHeight; > + > + if (styleBSize.GetUnit() != eStyleUnit_Auto || > + !(styleMinBSize.GetUnit() == eStyleUnit_Auto || Nit: remove trailing whitespace
Attachment #8531682 - Flags: review?(smontagu) → review+
This seems to work OK as a testcase; it uses the sizing of a button to check whether it is using the intrinsic size of its contents properly.
Attachment #8531762 - Flags: review?(smontagu)
Attachment #8531762 - Flags: review?(smontagu) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: