Index: third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc |
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc b/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc |
index f01a9e9353c377e4ddb5b572c52ba2769d9ac944..0a2b7e287b76f78c40317a0e63232232a6aecce8 100644 |
--- a/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc |
+++ b/third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc |
@@ -78,7 +78,8 @@ LayoutUnit computeInlineSizeForFragment( |
extent = std::max(extent, min); |
if (style.boxSizing() == BoxSizingContentBox) { |
- // TODO(layout-ng): Compute border/padding size and add it |
+ extent += computeBorderAndPaddingStart(constraintSpace, style); |
+ extent += computeBorderAndPaddingEnd(constraintSpace, style); |
} |
return extent; |
@@ -110,12 +111,52 @@ LayoutUnit computeBlockSizeForFragment(const NGConstraintSpace& constraintSpace, |
extent = std::max(extent, min); |
if (style.boxSizing() == BoxSizingContentBox) { |
- // TODO(layout-ng): Compute border/padding size and add it |
+ extent += computeBorderAndPaddingBefore(constraintSpace, style); |
+ extent += computeBorderAndPaddingAfter(constraintSpace, style); |
} |
return extent; |
} |
+LayoutUnit computeBorderAndPaddingBefore( |
ikilpatrick
2016/09/09 16:33:06
small nit; trying to be consistent with css and on
|
+ const NGConstraintSpace& constraintSpace, |
+ const ComputedStyle& style) { |
+ // Percentages on block-direction padding are resolved against the containing |
+ // block *inline size* - hence the call to resolveInlineLength(). |
+ LayoutUnit padding = |
+ resolveInlineLength(constraintSpace, style.paddingBefore(), |
+ LengthResolveType::MarginBorderPaddingSize); |
+ return padding + LayoutUnit(style.borderBeforeWidth()); |
+} |
+ |
+LayoutUnit computeBorderAndPaddingAfter( |
+ const NGConstraintSpace& constraintSpace, |
+ const ComputedStyle& style) { |
+ // Percentages on block-direction padding are resolved against the containing |
+ // block *inline size* - hence the call to resolveInlineLength(). |
+ LayoutUnit padding = |
+ resolveInlineLength(constraintSpace, style.paddingAfter(), |
+ LengthResolveType::MarginBorderPaddingSize); |
+ return padding + LayoutUnit(style.borderAfterWidth()); |
+} |
+ |
+LayoutUnit computeBorderAndPaddingStart( |
+ const NGConstraintSpace& constraintSpace, |
+ const ComputedStyle& style) { |
+ LayoutUnit padding = |
+ resolveInlineLength(constraintSpace, style.paddingStart(), |
+ LengthResolveType::MarginBorderPaddingSize); |
+ return padding + LayoutUnit(style.borderStartWidth()); |
+} |
+ |
+LayoutUnit computeBorderAndPaddingEnd(const NGConstraintSpace& constraintSpace, |
+ const ComputedStyle& style) { |
+ LayoutUnit padding = |
+ resolveInlineLength(constraintSpace, style.paddingEnd(), |
+ LengthResolveType::MarginBorderPaddingSize); |
+ return padding + LayoutUnit(style.borderEndWidth()); |
+} |
+ |
NGBoxStrut computeMargins(const NGConstraintSpace& constraintSpace, |
const ComputedStyle& style) { |
// Margins always get computed relative to the inline size: |