if (! isReplaced()) { applyCSSMinMaxWidth(c); }
    private void layoutBlock(LayoutContext c) {        CalculatedStyle style = getStyle();                if (style.isFixedBackground()) {            c.getRootLayer().setFixedBackground(true);        }                boolean pushedLayer = false;        if (isRoot() || style.requiresLayer()) {            pushedLayer = true;            if (getLayer() == null) {                c.pushLayer(this);                if (c.isPrint() && isRoot()) {                    c.getLayer().addPage(c);                }            } else {                c.pushLayer(getLayer());            }        }        if (isRoot() || getStyle().establishesBFC()) {            BlockFormattingContext bfc = new BlockFormattingContext(this, c);            c.pushBFC(bfc);        }                collapseMargins(c);                BorderPropertySet border = style.getBorder(c);        RectPropertySet margin = getMargin(c);        RectPropertySet padding = getPadding(c);                // CLEAN: cast to int        this.leftMBP = (int) margin.left() + (int) border.left() + (int) padding.left();        this.rightMBP = (int) padding.right() + (int) border.right() + (int) margin.right();        this.contentWidth = (int) (getContainingBlockWidth() - this.leftMBP - this.rightMBP);        this.height = 0;                if (! (this instanceof AnonymousBlockBox)) {            int cssWidth = getCSSWidth(c);            if (cssWidth != -1) {                this.contentWidth = cssWidth;            }                        int cssHeight = getCSSHeight(c);            if (cssHeight != -1) {                this.height = cssHeight;            }                        //check if replaced            ReplacedElement re = getReplacedElement();            if (re == null) {                re = c.getReplacedElementFactory().createReplacedElement(                    c, this, c.getUac(), cssWidth, cssHeight);            }            if (re != null) {                this.contentWidth = re.getIntrinsicWidth();                this.height = re.getIntrinsicHeight();                setReplacedElement(re);            } else if (cssWidth == -1 &&                     (style.isInlineBlock() || style.isFloated() ||                             style.isAbsolute() || style.isFixed())) {                 this.contentWidth = calcShrinkToFitWidth(c) - this.leftMBP - this.rightMBP;            }        }                if (isResetMargins()) {            resetCollapsedMargin();            setResetMargins(false);        }                // save height incase fixed height        int originalHeight = this.height;        if (! isReplaced()) {            this.height = 0;        }                boolean didSetMarkerData = false;        if (this instanceof BlockBox && getStyle().isListItem()) {            StrutMetrics strutMetrics = InlineBoxing.createDefaultStrutMetrics(c, this);            createMarkerData(c, strutMetrics);            c.setCurrentMarkerData(getMarkerData());            didSetMarkerData = true;        }                // do children's layout        int tx = (int) margin.left() + (int) border.left() + (int) padding.left();        int ty = (int) margin.top() + (int) border.top() + (int) padding.top();        this.tx = tx;        this.ty = ty;                c.translate(this.tx, this.ty);        if (! isReplaced())            layoutChildren(c);        else {            setState(Box.DONE);        }        c.translate(-this.tx, -this.ty);        if (! isAutoHeight()) {            this.height = originalHeight;        }        if (isRoot() || getStyle().establishesBFC()) {            if (getStyle().isAutoHeight()) {                int delta =                     c.getBlockFormattingContext().getFloatManager().getClearDelta(                            c, this.ty + this.height);                if (delta > 0) {                    this.height += delta ;                }            }            c.popBFC();        }                if (didSetMarkerData) {            c.setCurrentMarkerData(null);        }        this.height += (int) margin.top() + (int) border.top() + (int) padding.top() +             (int) padding.bottom() + (int) border.bottom() + (int) margin.bottom();                if (pushedLayer) {            c.popLayer();        }    }    