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

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

Issue 1314703006: Flex grow wrongly calculated for value between 0 and 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
Index: Source/core/layout/LayoutFlexibleBox.cpp
diff --git a/Source/core/layout/LayoutFlexibleBox.cpp b/Source/core/layout/LayoutFlexibleBox.cpp
index 0aef4d7a635139b21d387f428a3f2689479fdfad..2dd4b2aa78c4eac26280c4a4f74bbba256c3d4db 100644
--- a/Source/core/layout/LayoutFlexibleBox.cpp
+++ b/Source/core/layout/LayoutFlexibleBox.cpp
@@ -978,7 +978,10 @@ bool LayoutFlexibleBox::resolveFlexibleLengths(FlexSign flexSign, const OrderedF
double extraSpace = 0;
bool childShrunk = false;
if (availableFreeSpace > 0 && totalFlexGrow > 0 && flexSign == PositiveFlexibility && std::isfinite(totalFlexGrow)) {
- extraSpace = availableFreeSpace * child->style()->flexGrow() / totalFlexGrow;
+ if (totalFlexGrow > 0 && totalFlexGrow < 1)
+ extraSpace = availableFreeSpace * child->style()->flexGrow();
+ else
+ extraSpace = availableFreeSpace * child->style()->flexGrow() / totalFlexGrow;
} else if (availableFreeSpace < 0 && totalWeightedFlexShrink > 0 && flexSign == NegativeFlexibility && std::isfinite(totalWeightedFlexShrink) && child->style()->flexShrink()) {
extraSpace = availableFreeSpace * child->style()->flexShrink() * childInnerFlexBaseSize / totalWeightedFlexShrink;
childShrunk = true;

Powered by Google App Engine
This is Rietveld 408576698