protected void calcDimensions(LayoutContext c, int cssWidth) {
if (! isDimensionsCalculated()) {
CalculatedStyle style = getStyle();
RectPropertySet padding = getPadding(c);
BorderPropertySet border = getBorder(c);
if (cssWidth != -1 && !isAnonymous() &&
(getStyle().isIdent(CSSName.MARGIN_LEFT, IdentValue.AUTO) ||
getStyle().isIdent(CSSName.MARGIN_RIGHT, IdentValue.AUTO)) &&
getStyle().isNeedAutoMarginResolution()) {
resolveAutoMargins(c, cssWidth, padding, border);
}
recalcMargin(c);
RectPropertySet margin = getMargin(c);
// CLEAN: cast to int
setLeftMBP((int) margin.left() + (int) border.left() + (int) padding.left());
setRightMBP((int) padding.right() + (int) border.right() + (int) margin.right());
if (c.isPrint() && getStyle().isDynamicAutoWidth()) {
setContentWidth(calcEffPageRelativeWidth(c));
} else {
setContentWidth((getContainingBlockWidth() - getLeftMBP() - getRightMBP()));
}