Bug 1123284 - pt 2 - Fix Get{Min,Pref}ISize in nsLeafBoxFrame for vertical mode. r=smontagu

This commit is contained in:
Jonathan Kew 2015-03-03 16:38:49 +00:00
parent 1c1ccf6ac7
commit 50ff3c3302

View File

@ -129,16 +129,18 @@ nsLeafBoxFrame::GetMinISize(nsRenderingContext *aRenderingContext)
nscoord result;
DISPLAY_MIN_WIDTH(this, result);
nsBoxLayoutState state(PresContext(), aRenderingContext);
nsSize minSize = GetMinSize(state);
// GetMinSize returns border-box width, and we want to return content
// width. Since Reflow uses the reflow state's border and padding, we
WritingMode wm = GetWritingMode();
LogicalSize minSize(wm, GetMinSize(state));
// GetMinSize returns border-box size, and we want to return content
// inline-size. Since Reflow uses the reflow state's border and padding, we
// actually just want to subtract what GetMinSize added, which is the
// result of GetBorderAndPadding.
nsMargin bp;
GetBorderAndPadding(bp);
result = minSize.width - bp.LeftRight();
result = minSize.ISize(wm) - LogicalMargin(wm, bp).IStartEnd(wm);
return result;
}
@ -149,16 +151,18 @@ nsLeafBoxFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
nscoord result;
DISPLAY_PREF_WIDTH(this, result);
nsBoxLayoutState state(PresContext(), aRenderingContext);
nsSize prefSize = GetPrefSize(state);
// GetPrefSize returns border-box width, and we want to return content
// width. Since Reflow uses the reflow state's border and padding, we
WritingMode wm = GetWritingMode();
LogicalSize prefSize(wm, GetPrefSize(state));
// GetPrefSize returns border-box size, and we want to return content
// inline-size. Since Reflow uses the reflow state's border and padding, we
// actually just want to subtract what GetPrefSize added, which is the
// result of GetBorderAndPadding.
nsMargin bp;
GetBorderAndPadding(bp);
result = prefSize.width - bp.LeftRight();
result = prefSize.ISize(wm) - LogicalMargin(wm, bp).IStartEnd(wm);
return result;
}