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

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

Issue 2714803002: [LayoutNG] Allow block-flow layout to be fragmented using new approach. (Closed)
Patch Set: rebase. Created 3 years, 10 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
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 525d91815e4e45ee5f4fe69ea6fa507e49ede062..9aa9f6b24d6f90f5802fcc6a862bf64be2f0cecf 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
@@ -56,8 +56,8 @@ LayoutUnit ResolveInlineLength(
// computing it as an optimization and to simplify the code below.
NGBoxStrut border_and_padding;
if (type != LengthResolveType::kMarginBorderPaddingSize) {
- border_and_padding =
- ComputeBorders(style) + ComputePadding(constraint_space, style);
+ border_and_padding = ComputeBorders(constraint_space, style) +
+ ComputePadding(constraint_space, style);
}
switch (length.type()) {
case Auto:
@@ -138,8 +138,8 @@ LayoutUnit ResolveBlockLength(const NGConstraintSpace& constraint_space,
// computing it as an optimization and to simplify the code below.
NGBoxStrut border_and_padding;
if (type != LengthResolveType::kMarginBorderPaddingSize) {
- border_and_padding =
- ComputeBorders(style) + ComputePadding(constraint_space, style);
+ border_and_padding = ComputeBorders(constraint_space, style) +
+ ComputePadding(constraint_space, style);
}
switch (length.type()) {
case FillAvailable: {
@@ -199,7 +199,7 @@ MinAndMaxContentSizes ComputeMinAndMaxContentContribution(
if (inline_size.isAuto()) {
CHECK(min_and_max.has_value());
NGBoxStrut border_and_padding =
- ComputeBorders(style) + ComputePadding(*space, style);
+ ComputeBorders(*space, style) + ComputePadding(*space, style);
computed_sizes.min_content =
min_and_max->min_content + border_and_padding.InlineSum();
computed_sizes.max_content =
@@ -354,7 +354,13 @@ NGBoxStrut ComputeMargins(const NGConstraintSpace& constraint_space,
return physical_dim.ConvertToLogical(writing_mode, direction);
}
-NGBoxStrut ComputeBorders(const ComputedStyle& style) {
+NGBoxStrut ComputeBorders(const NGConstraintSpace& constraint_space,
+ const ComputedStyle& style) {
+ // If we are producing an anonymous fragment (e.g. a column) we shouldn't
+ // have any borders.
+ if (constraint_space.IsAnonymous())
+ return NGBoxStrut();
+
NGBoxStrut borders;
borders.inline_start = LayoutUnit(style.borderStartWidth());
borders.inline_end = LayoutUnit(style.borderEndWidth());
@@ -365,6 +371,11 @@ NGBoxStrut ComputeBorders(const ComputedStyle& style) {
NGBoxStrut ComputePadding(const NGConstraintSpace& constraint_space,
const ComputedStyle& style) {
+ // If we are producing an anonymous fragment (e.g. a column) we shouldn't
+ // have any padding.
+ if (constraint_space.IsAnonymous())
+ return NGBoxStrut();
+
// We don't need these for padding computations
MinAndMaxContentSizes empty_sizes;
// Padding always gets computed relative to the inline size:

Powered by Google App Engine
This is Rietveld 408576698