private void setupAreaDimensions(LayoutContext context) {
autoHeight = false;
int maxbpd = context.getStackLimitBP().getOpt();
int allocBPD;
BlockContainer fo = getBlockContainerFO();
if (height.getEnum() == EN_AUTO
|| (!height.isAbsolute() && getAncestorBlockAreaBPD() <= 0)) {
//auto height when height="auto" or "if that dimension is not specified explicitly
//(i.e., it depends on content's block-progression-dimension)" (XSL 1.0, 7.14.1)
allocBPD = maxbpd;
autoHeight = true;
//Cannot easily inline element list when ref-or<>"0"
inlineElementList = (fo.getReferenceOrientation() == 0);
} else {
allocBPD = height.getValue(this); //this is the content-height
allocBPD += getBPIndents();
}
vpContentBPD = allocBPD - getBPIndents();
referenceIPD = context.getRefIPD();
if (width.getEnum() == EN_AUTO) {
updateContentAreaIPDwithOverconstrainedAdjust();
} else {
int contentWidth = width.getValue(this);
updateContentAreaIPDwithOverconstrainedAdjust(contentWidth);
}
contentRectOffsetX = 0;
contentRectOffsetY = 0;
int level = fo.getBidiLevel();
if ( ( level < 0 ) || ( ( level & 1 ) == 0 ) ) {
contentRectOffsetX += fo.getCommonMarginBlock().startIndent.getValue(this);
} else {
contentRectOffsetX += fo.getCommonMarginBlock().endIndent.getValue(this);
}
contentRectOffsetY += fo.getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
contentRectOffsetY += fo.getCommonBorderPaddingBackground().getPaddingBefore(false, this);
updateRelDims();
int availableIPD = referenceIPD - getIPIndents();
if (getContentAreaIPD() > availableIPD) {
BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
fo.getUserAgent().getEventBroadcaster());
eventProducer.objectTooWide(this, fo.getName(),
getContentAreaIPD(), context.getRefIPD(),
fo.getLocator());
}
}