Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2148513002: Calculate border-box dimensions correctly for cells (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@619509-2
Patch Set: bug 627305 Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/linux/fast/table/dynamic-descendant-percentage-height-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6b443a587a2ce3eacddf7d97d75734b7ee46f0d8..fe11f946c89510e2de20157e5a6010a412e9efa2 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -1173,9 +1173,21 @@ void LayoutBox::clearExtraInlineAndBlockOffests()
gExtraBlockOffsetMap->remove(this);
}
+static LayoutUnit borderPaddingWidthForBoxSizing(const LayoutBox* box)
+{
+ // This excludes intrinsic padding on cells. It includes width from collapsed borders.
+ return box->computedCSSPaddingStart() + box->computedCSSPaddingEnd() + box->borderStart() + box->borderEnd();
+}
+
+static LayoutUnit borderPaddingHeightForBoxSizing(const LayoutBox* box)
+{
+ // This excludes intrinsic padding on cells. It includes height from collapsed borders.
+ return box->computedCSSPaddingBefore() + box->computedCSSPaddingAfter() + box->borderBefore() + box->borderAfter();
+}
+
LayoutUnit LayoutBox::adjustBorderBoxLogicalWidthForBoxSizing(float width) const
{
- LayoutUnit bordersPlusPadding = borderAndPaddingLogicalWidth();
+ LayoutUnit bordersPlusPadding = borderPaddingWidthForBoxSizing(this);
LayoutUnit result(width);
if (style()->boxSizing() == BoxSizingContentBox)
return result + bordersPlusPadding;
@@ -1184,7 +1196,7 @@ LayoutUnit LayoutBox::adjustBorderBoxLogicalWidthForBoxSizing(float width) const
LayoutUnit LayoutBox::adjustBorderBoxLogicalHeightForBoxSizing(float height) const
{
- LayoutUnit bordersPlusPadding = borderAndPaddingLogicalHeight();
+ LayoutUnit bordersPlusPadding = borderPaddingHeightForBoxSizing(this);
LayoutUnit result(height);
if (style()->boxSizing() == BoxSizingContentBox)
return result + bordersPlusPadding;
@@ -1195,7 +1207,7 @@ LayoutUnit LayoutBox::adjustContentBoxLogicalWidthForBoxSizing(float width) cons
{
LayoutUnit result(width);
if (style()->boxSizing() == BoxSizingBorderBox)
- result -= borderAndPaddingLogicalWidth();
+ result -= borderPaddingWidthForBoxSizing(this);
return std::max(LayoutUnit(), result);
}
@@ -1203,7 +1215,7 @@ LayoutUnit LayoutBox::adjustContentBoxLogicalHeightForBoxSizing(float height) co
{
LayoutUnit result(height);
if (style()->boxSizing() == BoxSizingBorderBox)
- result -= borderAndPaddingLogicalHeight();
+ result -= borderPaddingHeightForBoxSizing(this);
return std::max(LayoutUnit(), result);
}
@@ -2737,8 +2749,6 @@ LayoutUnit LayoutBox::computePercentageLogicalHeight(const Length& height) const
LayoutUnit contentBoxHeight = cb->adjustContentBoxLogicalHeightForBoxSizing(cbstyle.logicalHeight().value());
availableHeight = cb->constrainContentBoxLogicalHeightByMinMax(
contentBoxHeight - cb->scrollbarLogicalHeight(), LayoutUnit(-1)).clampNegativeToZero();
- if (cb->isTableCell())
- includeBorderPadding = true;
} else if (cb->isTableCell()) {
if (!skippedAutoHeightContainingBlock) {
// Table cells violate what the CSS spec says to do with heights. Basically we
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/linux/fast/table/dynamic-descendant-percentage-height-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698