// if height is not auto, but the width is, then use the declared height.
else
{
// A percentage is now relative to the intrinsinc size.
// And yes, I'm aware that this is not what the standard says ..
final RenderLength blockContextWidth =
node.getComputedLayoutProperties().getBlockContextWidth();
height = node.getRequestedHeight().resolve(blockContextWidth.resolve(0));
}
}
else
{
// width is not auto.
// If the height is auto, we have to preserve the aspect ratio ..
if (RenderLength.AUTO.equals(node.getRequestedHeight()))
{
if (contentSize.getWidth() > 0)
{
final RenderLength blockContextWidth =
node.getComputedLayoutProperties().getBlockContextWidth();
final long computedWidth =
node.getRequestedWidth().resolve(blockContextWidth.resolve(0));
// Requested height must be computed to preserve the aspect ratio.
height = computedWidth * contentSize.getHeight()/contentSize.getWidth();
}
else
{
height = 0;
}
}
else
{
// height is something fixed ..
final RenderLength blockContextWidth =
node.getComputedLayoutProperties().getBlockContextWidth();
height = node.getRequestedHeight().resolve(blockContextWidth.resolve(0));
}
}
}