diff options
Diffstat (limited to 'Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp')
| -rw-r--r-- | Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp b/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp index 8f7151a47..05aecae03 100644 --- a/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp +++ b/Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp @@ -151,6 +151,20 @@ static bool childDoesNotAffectWidthOrFlexing(RenderObject* child) return child->isOutOfFlowPositioned() || child->style()->visibility() == COLLAPSE; } +static LayoutUnit contentWidthForChild(RenderBox* child) +{ + if (child->hasOverrideWidth()) + return child->overrideLogicalContentWidth(); + return child->logicalWidth() - child->borderAndPaddingLogicalWidth(); +} + +static LayoutUnit contentHeightForChild(RenderBox* child) +{ + if (child->hasOverrideHeight()) + return child->overrideLogicalContentHeight(); + return child->logicalHeight() - child->borderAndPaddingLogicalHeight(); +} + void RenderDeprecatedFlexibleBox::styleWillChange(StyleDifference diff, const RenderStyle* newStyle) { RenderStyle* oldStyle = style(); @@ -538,7 +552,7 @@ void RenderDeprecatedFlexibleBox::layoutHorizontalBox(bool relayoutChildren) if (allowedChildFlex(child, expanding, i)) { LayoutUnit spaceAdd = LayoutUnit(spaceAvailableThisPass * (child->style()->boxFlex() / totalFlex)); if (spaceAdd) { - child->setOverrideLogicalContentWidth(child->overrideLogicalContentWidth() + spaceAdd); + child->setOverrideLogicalContentWidth(contentWidthForChild(child) + spaceAdd); flexingChildren = true; relayoutChildren = true; } @@ -555,7 +569,7 @@ void RenderDeprecatedFlexibleBox::layoutHorizontalBox(bool relayoutChildren) LayoutUnit spaceAdd = groupRemainingSpace > 0 ? 1 : -1; for (RenderBox* child = iterator.first(); child && groupRemainingSpace; child = iterator.next()) { if (allowedChildFlex(child, expanding, i)) { - child->setOverrideLogicalContentWidth(child->overrideLogicalContentWidth() + spaceAdd); + child->setOverrideLogicalContentWidth(contentWidthForChild(child) + spaceAdd); flexingChildren = true; relayoutChildren = true; remainingSpace -= spaceAdd; @@ -789,7 +803,7 @@ void RenderDeprecatedFlexibleBox::layoutVerticalBox(bool relayoutChildren) if (allowedChildFlex(child, expanding, i)) { LayoutUnit spaceAdd = static_cast<LayoutUnit>(spaceAvailableThisPass * (child->style()->boxFlex() / totalFlex)); if (spaceAdd) { - child->setOverrideLogicalContentHeight(child->overrideLogicalContentHeight() + spaceAdd); + child->setOverrideLogicalContentHeight(contentHeightForChild(child) + spaceAdd); flexingChildren = true; relayoutChildren = true; } @@ -806,7 +820,7 @@ void RenderDeprecatedFlexibleBox::layoutVerticalBox(bool relayoutChildren) LayoutUnit spaceAdd = groupRemainingSpace > 0 ? 1 : -1; for (RenderBox* child = iterator.first(); child && groupRemainingSpace; child = iterator.next()) { if (allowedChildFlex(child, expanding, i)) { - child->setOverrideLogicalContentHeight(child->overrideLogicalContentHeight() + spaceAdd); + child->setOverrideLogicalContentHeight(contentHeightForChild(child) + spaceAdd); flexingChildren = true; relayoutChildren = true; remainingSpace -= spaceAdd; @@ -1019,7 +1033,7 @@ LayoutUnit RenderDeprecatedFlexibleBox::allowedChildFlex(RenderBox* child, bool if (isHorizontal()) { // FIXME: For now just handle fixed values. LayoutUnit maxWidth = MAX_LAYOUT_UNIT; - LayoutUnit width = child->overrideLogicalContentWidth(); + LayoutUnit width = contentWidthForChild(child); if (!child->style()->maxWidth().isUndefined() && child->style()->maxWidth().isFixed()) maxWidth = child->style()->maxWidth().value(); else if (child->style()->maxWidth().type() == Intrinsic) @@ -1032,7 +1046,7 @@ LayoutUnit RenderDeprecatedFlexibleBox::allowedChildFlex(RenderBox* child, bool } else { // FIXME: For now just handle fixed values. LayoutUnit maxHeight = MAX_LAYOUT_UNIT; - LayoutUnit height = child->overrideLogicalContentHeight(); + LayoutUnit height = contentHeightForChild(child); if (!child->style()->maxHeight().isUndefined() && child->style()->maxHeight().isFixed()) maxHeight = child->style()->maxHeight().value(); if (maxHeight == MAX_LAYOUT_UNIT) @@ -1044,7 +1058,7 @@ LayoutUnit RenderDeprecatedFlexibleBox::allowedChildFlex(RenderBox* child, bool // FIXME: For now just handle fixed values. if (isHorizontal()) { LayoutUnit minWidth = child->minPreferredLogicalWidth(); - LayoutUnit width = child->overrideLogicalContentWidth(); + LayoutUnit width = contentWidthForChild(child); if (child->style()->minWidth().isFixed()) minWidth = child->style()->minWidth().value(); else if (child->style()->minWidth().type() == Intrinsic) @@ -1060,7 +1074,7 @@ LayoutUnit RenderDeprecatedFlexibleBox::allowedChildFlex(RenderBox* child, bool Length minHeight = child->style()->minHeight(); if (minHeight.isFixed() || minHeight.isAuto()) { LayoutUnit minHeight = child->style()->minHeight().value(); - LayoutUnit height = child->overrideLogicalContentHeight(); + LayoutUnit height = contentHeightForChild(child); LayoutUnit allowedShrinkage = min<LayoutUnit>(0, minHeight - height); return allowedShrinkage; } |
