Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| index 8588a9ee471d14759253cfbc14b99f30e791445d..8c700a1521d3d7b7c8fc2885ec69c6148f43f143 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp |
| @@ -2753,6 +2753,14 @@ LayoutUnit LayoutBox::computePercentageLogicalHeight(const Length& height) const |
| availableHeight = stretchedFlexHeight; |
| } 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(), LayoutUnit(-1))); |
|
eae
2016/06/02 22:50:34
Please wrap this line. Also consider using clampNe
|
| + if (cb->isTableCell()) { |
| + includeBorderPadding = true; |
| + // 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 |
| @@ -2774,9 +2782,6 @@ LayoutUnit LayoutBox::computePercentageLogicalHeight(const Length& height) const |
| availableHeight = cb->overrideLogicalContentHeight(); |
| includeBorderPadding = true; |
| } |
| - } else if (cbstyle.logicalHeight().isFixed()) { |
| - LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSizing(LayoutUnit(cbstyle.logicalHeight().value())); |
| - availableHeight = std::max(LayoutUnit(), cb->constrainContentBoxLogicalHeightByMinMax(contentBoxHeight - cb->scrollbarLogicalHeight(), LayoutUnit(-1))); |
| } else if (cbstyle.logicalHeight().hasPercent() && !isOutOfFlowPositionedWithSpecifiedHeight) { |
| // We need to recur and compute the percentage height for our containing block. |
| LayoutUnit heightWithScrollbar = cb->computePercentageLogicalHeight(cbstyle.logicalHeight()); |
| @@ -2809,10 +2814,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. |
| + // TODO(rhogan) crbug.com/467378: Doing this for content inside tables cells is wrong, it should fill |
| + // whatever height the cell makes available. |
| result -= borderAndPaddingLogicalHeight(); |
| return std::max(LayoutUnit(), result); |
| } |