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 97c79543d977b06764c0c0f78739f925d2f6eee4..05e419cfbb8134110351dc542dea8f2c617bb8b3 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 |
@@ -14,6 +14,7 @@ namespace blink { |
// - Handle border-box correctly |
// - positioned and/or replaced calculations |
// - Handle margins for fill-available and width: auto |
+// - Take scrollbars into account |
LayoutUnit resolveInlineLength(const NGConstraintSpace& constraintSpace, |
const Length& length, |
@@ -131,4 +132,29 @@ NGBoxStrut computeMargins(const NGConstraintSpace& constraintSpace, |
return margins; |
} |
+NGBoxStrut computeBorders(const ComputedStyle& style) { |
+ NGBoxStrut borders; |
+ borders.inline_start = LayoutUnit(style.borderStartWidth()); |
+ borders.inline_end = LayoutUnit(style.borderEndWidth()); |
+ borders.block_start = LayoutUnit(style.borderBeforeWidth()); |
+ borders.block_end = LayoutUnit(style.borderAfterWidth()); |
+ return borders; |
+} |
+ |
+NGBoxStrut computePadding(const NGConstraintSpace& constraintSpace, |
+ const ComputedStyle& style) { |
+ // Padding always gets computed relative to the inline size: |
+ // https://www.w3.org/TR/CSS2/box.html#value-def-padding-width |
+ NGBoxStrut padding; |
+ padding.inline_start = resolveInlineLength( |
+ constraintSpace, style.paddingStart(), LengthResolveType::MarginSize); |
+ padding.inline_end = resolveInlineLength(constraintSpace, style.paddingEnd(), |
+ LengthResolveType::MarginSize); |
+ padding.block_start = resolveInlineLength( |
+ constraintSpace, style.paddingBefore(), LengthResolveType::MarginSize); |
ikilpatrick
2016/08/30 20:30:44
Is LengthResolveType::MarginSize better named some
cbiesinger
2016/08/30 20:32:59
Oh right. I guess I'll go with MarginBorderPadding
|
+ padding.block_end = resolveInlineLength(constraintSpace, style.paddingAfter(), |
+ LengthResolveType::MarginSize); |
+ return padding; |
+} |
+ |
} // namespace blink |