Bug 1108277 - part 1 - Make Get{Min,Pref}ISize for the <canvas> element aware of vertical writing mode. r=smontagu

This commit is contained in:
Jonathan Kew 2014-12-09 14:00:38 +00:00
parent 64b894a6b9
commit 2fdafce3a4

View File

@ -185,7 +185,9 @@ nsHTMLCanvasFrame::GetMinISize(nsRenderingContext *aRenderingContext)
{
// XXX The caller doesn't account for constraints of the height,
// min-height, and max-height properties.
nscoord result = nsPresContext::CSSPixelsToAppUnits(GetCanvasSize().width);
bool vertical = GetWritingMode().IsVertical();
nscoord result = nsPresContext::CSSPixelsToAppUnits(
vertical ? GetCanvasSize().height : GetCanvasSize().width);
DISPLAY_MIN_WIDTH(this, result);
return result;
}
@ -195,7 +197,9 @@ nsHTMLCanvasFrame::GetPrefISize(nsRenderingContext *aRenderingContext)
{
// XXX The caller doesn't account for constraints of the height,
// min-height, and max-height properties.
nscoord result = nsPresContext::CSSPixelsToAppUnits(GetCanvasSize().width);
bool vertical = GetWritingMode().IsVertical();
nscoord result = nsPresContext::CSSPixelsToAppUnits(
vertical ? GetCanvasSize().height : GetCanvasSize().width);
DISPLAY_PREF_WIDTH(this, result);
return result;
}