Chromium Code Reviews| Index: Source/core/layout/LayoutBox.cpp |
| diff --git a/Source/core/layout/LayoutBox.cpp b/Source/core/layout/LayoutBox.cpp |
| index 5d9e99c3503e9ad39036aa462f9a9209ad8b2d34..2cf4f696e1e41d95ccd8e90e3a550f84e234755a 100644 |
| --- a/Source/core/layout/LayoutBox.cpp |
| +++ b/Source/core/layout/LayoutBox.cpp |
| @@ -2470,6 +2470,14 @@ LayoutUnit LayoutBox::computePercentageLogicalHeight(const Length& height) const |
| availableHeight = containingBlockChild->containingBlockLogicalWidthForContent(); |
| } else if (hasOverrideContainingBlockLogicalHeight()) { |
| availableHeight = overrideContainingBlockContentLogicalHeight(); |
| + } else if (cbstyle.logicalHeight().isFixed()) { |
| + LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSizing(cbstyle.logicalHeight().value()); |
| + availableHeight = std::max(LayoutUnit(), cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeight - cb->scrollbarLogicalHeight(), -1)); |
| + if (cb->isTableCell()) { |
| + includeBorderPadding = true; |
|
Julien - ping for review
2015/03/16 18:39:54
This really looks like it should be refactored out
|
| + // We're sizing content to the height from the cell's style so don't involve the intrinsic padding used to align the content. |
| + availableHeight -= cb->computedCSSPaddingBefore() + cb->computedCSSPaddingAfter() + cb->borderBefore() + cb->borderAfter(); |
| + } |
| } else if (cb->isTableCell()) { |
| if (!skippedAutoHeightContainingBlock) { |
| // Table cells violate what the CSS spec says to do with heights. Basically we |
| @@ -2491,9 +2499,6 @@ LayoutUnit LayoutBox::computePercentageLogicalHeight(const Length& height) const |
| availableHeight = cb->overrideLogicalContentHeight(); |
| includeBorderPadding = true; |
| } |
| - } else if (cbstyle.logicalHeight().isFixed()) { |
| - LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSizing(cbstyle.logicalHeight().value()); |
| - availableHeight = std::max(LayoutUnit(), cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeight - cb->scrollbarLogicalHeight(), -1)); |
| } else if (cbstyle.logicalHeight().isPercent() && !isOutOfFlowPositionedWithSpecifiedHeight) { |
| // We need to recur and compute the percentage height for our containing block. |
| LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbstyle.logicalHeight()); |
| @@ -2526,10 +2531,8 @@ LayoutUnit LayoutBox::computePercentageLogicalHeight(const Length& height) const |
| LayoutUnit result = valueForLength(height, availableHeight); |
| if (includeBorderPadding) { |
| - // FIXME: Table cells should default to box-sizing: border-box so we can avoid this hack. |
| - // It is necessary to use the border-box to match WinIE's broken |
| - // box model. This is essential for sizing inside |
| - // table cells using percentage heights. |
| + // crbug.com/467378: Doing this for content inside tables cells is wrong, it should fill |
|
Julien - ping for review
2015/03/16 18:39:54
FIXME? TODO?
|
| + // whatever height the cell makes available. |
| result -= borderAndPaddingLogicalHeight(); |
| return std::max(LayoutUnit(), result); |
| } |