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

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

Issue 1157853002: [WIP] Implement flexbox spec behavior for flex factor sum between 0 and 1 Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 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 | « Source/core/layout/LayoutFlexibleBox.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/LayoutFlexibleBox.cpp
diff --git a/Source/core/layout/LayoutFlexibleBox.cpp b/Source/core/layout/LayoutFlexibleBox.cpp
index 5de6becb21b9f66ef63b7ed635c9bea88309a265..60a4ab688195e947a6d0d4a8753ce4eeda9dd437 100644
--- a/Source/core/layout/LayoutFlexibleBox.cpp
+++ b/Source/core/layout/LayoutFlexibleBox.cpp
@@ -74,6 +74,8 @@ LayoutFlexibleBox::LayoutFlexibleBox(Element* element)
: LayoutBlock(element)
, m_orderIterator(this)
, m_numberOfInFlowChildrenOnFirstLine(-1)
+ , m_originalAvailableFreeSpaceInitialized(false)
+ , m_originalAvailableFreeSpace(0)
{
ASSERT(!childrenInline());
}
@@ -961,6 +963,18 @@ bool LayoutFlexibleBox::resolveFlexibleLengths(FlexSign flexSign, const OrderedF
if (inflexibleItems.contains(child)) {
childSizes.append(inflexibleItems.get(child));
} else {
+ if (!m_originalAvailableFreeSpaceInitialized) {
+ m_originalAvailableFreeSpace = availableFreeSpace;
+ m_originalAvailableFreeSpaceInitialized = true;
+ }
+ if (totalFlexGrow < 1.0f) {
+ LayoutUnit desiredPortionOfOriginalFreeSpace = LayoutUnit(m_originalAvailableFreeSpace * totalFlexGrow);
+ if (availableFreeSpace > 0)
+ availableFreeSpace = std::min(availableFreeSpace, desiredPortionOfOriginalFreeSpace);
+ else
+ availableFreeSpace = std::max(availableFreeSpace, desiredPortionOfOriginalFreeSpace);
+ }
+
LayoutUnit childInnerFlexBaseSize = computeInnerFlexBaseSizeForChild(*child);
LayoutUnit childSize = childInnerFlexBaseSize;
double extraSpace = 0;
« no previous file with comments | « Source/core/layout/LayoutFlexibleBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698