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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp

Issue 2832503003: [css-flex] Implement the space-evenly content-distribution value (Closed)
Patch Set: Created 3 years, 8 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/LayoutTests/css3/flexbox/true-centering.html ('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/LayoutFlexibleBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
index ae3f5d5196e7e557e76a443cab7ebb0c62449414..be528ccafe4b3eec5c309aad7105d53f62f765ed 100644
--- a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
@@ -1516,6 +1516,12 @@ static LayoutUnit InitialJustifyContentOffset(
return available_free_space / 2;
}
+ if (justify_content_distribution == kContentDistributionSpaceEvenly) {
+ if (available_free_space > 0 && number_of_children)
+ return available_free_space / (number_of_children + 1);
+ // Fallback to 'center'
Manuel Rego 2017/04/20 08:57:06 Supernit: End comment with dot.
+ return available_free_space / 2;
+ }
return LayoutUnit();
}
@@ -1528,6 +1534,8 @@ static LayoutUnit JustifyContentSpaceBetweenChildren(
return available_free_space / (number_of_children - 1);
if (justify_content_distribution == kContentDistributionSpaceAround)
return available_free_space / number_of_children;
+ if (justify_content_distribution == kContentDistributionSpaceEvenly)
+ return available_free_space / (number_of_children + 1);
}
return LayoutUnit();
}
@@ -1965,6 +1973,12 @@ static LayoutUnit InitialAlignContentOffset(
if (available_free_space < 0)
return available_free_space / 2;
}
+ if (align_content_distribution == kContentDistributionSpaceEvenly) {
+ if (available_free_space > 0)
+ return available_free_space / (number_of_lines + 1);
+ // Fallback to 'center'
Manuel Rego 2017/04/20 08:57:06 Ditto.
+ return available_free_space / 2;
+ }
return LayoutUnit();
}
@@ -1978,6 +1992,8 @@ static LayoutUnit AlignContentSpaceBetweenChildren(
if (align_content_distribution == kContentDistributionSpaceAround ||
align_content_distribution == kContentDistributionStretch)
return available_free_space / number_of_lines;
+ if (align_content_distribution == kContentDistributionSpaceEvenly)
+ return available_free_space / (number_of_lines + 1);
}
return LayoutUnit();
}
« no previous file with comments | « third_party/WebKit/LayoutTests/css3/flexbox/true-centering.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698