| 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..93697ed744405fb978dc6e882394fc106a443f42 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 += computeBorderAndPaddingInlineStart(constraintSpace, style);
|
| + extent += computeBorderAndPaddingInlineEnd(constraintSpace, style);
|
| }
|
|
|
| return extent;
|
| @@ -110,12 +111,53 @@ 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 += computeBorderAndPaddingBlockStart(constraintSpace, style);
|
| + extent += computeBorderAndPaddingBlockEnd(constraintSpace, style);
|
| }
|
|
|
| return extent;
|
| }
|
|
|
| +LayoutUnit computeBorderAndPaddingBlockStart(
|
| + 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 computeBorderAndPaddingBlockEnd(
|
| + 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 computeBorderAndPaddingInlineStart(
|
| + const NGConstraintSpace& constraintSpace,
|
| + const ComputedStyle& style) {
|
| + LayoutUnit padding =
|
| + resolveInlineLength(constraintSpace, style.paddingStart(),
|
| + LengthResolveType::MarginBorderPaddingSize);
|
| + return padding + LayoutUnit(style.borderStartWidth());
|
| +}
|
| +
|
| +LayoutUnit computeBorderAndPaddingInlineEnd(
|
| + 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:
|
|
|