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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 } 971 }
972 972
973 if (inflexibleItems.contains(child)) { 973 if (inflexibleItems.contains(child)) {
974 childSizes.append(inflexibleItems.get(child)); 974 childSizes.append(inflexibleItems.get(child));
975 } else { 975 } else {
976 LayoutUnit childInnerFlexBaseSize = computeInnerFlexBaseSizeForChild (*child); 976 LayoutUnit childInnerFlexBaseSize = computeInnerFlexBaseSizeForChild (*child);
977 LayoutUnit childSize = childInnerFlexBaseSize; 977 LayoutUnit childSize = childInnerFlexBaseSize;
978 double extraSpace = 0; 978 double extraSpace = 0;
979 bool childShrunk = false; 979 bool childShrunk = false;
980 if (availableFreeSpace > 0 && totalFlexGrow > 0 && flexSign == Posit iveFlexibility && std::isfinite(totalFlexGrow)) { 980 if (availableFreeSpace > 0 && totalFlexGrow > 0 && flexSign == Posit iveFlexibility && std::isfinite(totalFlexGrow)) {
981 extraSpace = availableFreeSpace * child->style()->flexGrow() / t otalFlexGrow; 981 if (totalFlexGrow > 0 && totalFlexGrow < 1)
982 extraSpace = availableFreeSpace * child->style()->flexGrow() ;
983 else
984 extraSpace = availableFreeSpace * child->style()->flexGrow() / totalFlexGrow;
982 } else if (availableFreeSpace < 0 && totalWeightedFlexShrink > 0 && flexSign == NegativeFlexibility && std::isfinite(totalWeightedFlexShrink) && chi ld->style()->flexShrink()) { 985 } else if (availableFreeSpace < 0 && totalWeightedFlexShrink > 0 && flexSign == NegativeFlexibility && std::isfinite(totalWeightedFlexShrink) && chi ld->style()->flexShrink()) {
983 extraSpace = availableFreeSpace * child->style()->flexShrink() * childInnerFlexBaseSize / totalWeightedFlexShrink; 986 extraSpace = availableFreeSpace * child->style()->flexShrink() * childInnerFlexBaseSize / totalWeightedFlexShrink;
984 childShrunk = true; 987 childShrunk = true;
985 } 988 }
986 if (std::isfinite(extraSpace)) 989 if (std::isfinite(extraSpace))
987 childSize += LayoutUnit::fromFloatRound(extraSpace); 990 childSize += LayoutUnit::fromFloatRound(extraSpace);
988 991
989 LayoutUnit adjustedChildSize = adjustChildSizeForMinAndMax(*child, c hildSize, childShrunk); 992 LayoutUnit adjustedChildSize = adjustChildSizeForMinAndMax(*child, c hildSize, childShrunk);
990 ASSERT(adjustedChildSize >= 0); 993 ASSERT(adjustedChildSize >= 0);
991 childSizes.append(adjustedChildSize); 994 childSizes.append(adjustedChildSize);
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 ASSERT(child); 1473 ASSERT(child);
1471 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1474 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1472 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1475 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1473 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1476 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1474 adjustAlignmentForChild(*child, newOffset - originalOffset); 1477 adjustAlignmentForChild(*child, newOffset - originalOffset);
1475 } 1478 }
1476 } 1479 }
1477 } 1480 }
1478 1481
1479 } 1482 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698