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

Unified Diff: third_party/WebKit/Source/core/layout/ng/ng_length_utils.cc

Issue 2330153002: [layoutng] Better handling of border and padding (Closed)
Patch Set: undo comment change Created 4 years, 3 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/Source/core/layout/ng/ng_length_utils.h ('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/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 93697ed744405fb978dc6e882394fc106a443f42..4a348b81f0ca28f2e02e42f4ddee93c56a293146 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,8 +78,10 @@ LayoutUnit computeInlineSizeForFragment(
extent = std::max(extent, min);
if (style.boxSizing() == BoxSizingContentBox) {
- extent += computeBorderAndPaddingInlineStart(constraintSpace, style);
- extent += computeBorderAndPaddingInlineEnd(constraintSpace, style);
+ // TODO(layout-ng): Don't do this for auto/other keywords
+ NGBoxStrut border_and_padding =
+ computeBorders(style) + computePadding(constraintSpace, style);
+ extent += border_and_padding.InlineSum();
}
return extent;
@@ -111,53 +113,15 @@ LayoutUnit computeBlockSizeForFragment(const NGConstraintSpace& constraintSpace,
extent = std::max(extent, min);
if (style.boxSizing() == BoxSizingContentBox) {
- extent += computeBorderAndPaddingBlockStart(constraintSpace, style);
- extent += computeBorderAndPaddingBlockEnd(constraintSpace, style);
+ // TODO(layout-ng): Don't do this for auto/other keywords
+ NGBoxStrut border_and_padding =
+ computeBorders(style) + computePadding(constraintSpace, style);
+ extent += border_and_padding.BlockSum();
}
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:
« no previous file with comments | « third_party/WebKit/Source/core/layout/ng/ng_length_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698