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

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

Issue 2191683003: [css-flexbox] align-content should apply even when there's just a single line (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mark Firefox tests as failing; they haven't fixed this bug yet Created 4 years, 5 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/multiline-align-content.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 dc2278b9f51f64d1ef5fd56b50cc0bd3f673827f..feffbf8b2ab90cff37852e419f63960549f9eac6 100644
--- a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
@@ -1734,9 +1734,9 @@ void LayoutFlexibleBox::layoutColumnReverse(const OrderedFlexItemList& children,
}
}
-static LayoutUnit initialAlignContentOffset(LayoutUnit availableFreeSpace, ContentPosition alignContent, ContentDistributionType alignContentDistribution, unsigned numberOfLines)
+static LayoutUnit initialAlignContentOffset(LayoutUnit availableFreeSpace, ContentPosition alignContent, ContentDistributionType alignContentDistribution, bool isMultiline, unsigned numberOfLines)
{
- if (numberOfLines <= 1)
+ if (!isMultiline)
return LayoutUnit();
if (alignContent == ContentPositionFlexEnd)
return availableFreeSpace;
@@ -1764,13 +1764,15 @@ static LayoutUnit alignContentSpaceBetweenChildren(LayoutUnit availableFreeSpace
void LayoutFlexibleBox::alignFlexLines(Vector<LineContext>& lineContexts)
{
+ if (!lineContexts.size())
+ return;
+
ContentPosition position = styleRef().resolvedAlignContentPosition(normalValueBehavior());
ContentDistributionType distribution = styleRef().resolvedAlignContentDistribution(normalValueBehavior());
- // If we have a single line flexbox or a multiline line flexbox with only one flex line,
- // the line height is all the available space.
+ // If we have a single line flexbox the line height is all the available space.
// For flex-direction: row, this means we need to use the height, so we do this after calling updateLogicalHeight.
- if (lineContexts.size() == 1) {
+ if (!isMultiline()) {
lineContexts[0].crossAxisExtent = crossAxisContentExtent();
return;
}
@@ -1783,7 +1785,7 @@ void LayoutFlexibleBox::alignFlexLines(Vector<LineContext>& lineContexts)
availableCrossAxisSpace -= lineContexts[i].crossAxisExtent;
LayoutBox* child = m_orderIterator.first();
- LayoutUnit lineOffset = initialAlignContentOffset(availableCrossAxisSpace, position, distribution, lineContexts.size());
+ LayoutUnit lineOffset = initialAlignContentOffset(availableCrossAxisSpace, position, distribution, isMultiline(), lineContexts.size());
for (unsigned lineNumber = 0; lineNumber < lineContexts.size(); ++lineNumber) {
lineContexts[lineNumber].crossAxisOffset += lineOffset;
for (size_t childNumber = 0; childNumber < lineContexts[lineNumber].numberOfChildren; ++childNumber, child = m_orderIterator.next())
« no previous file with comments | « third_party/WebKit/LayoutTests/css3/flexbox/multiline-align-content.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698