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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp

Issue 1375163002: Flex grow wrongly calculated for value between 0 and 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « third_party/WebKit/LayoutTests/css3/flexbox/flex-grow-less-than-one-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 } 978 }
979 979
980 if (inflexibleItems.contains(child)) { 980 if (inflexibleItems.contains(child)) {
981 childSizes.append(inflexibleItems.get(child)); 981 childSizes.append(inflexibleItems.get(child));
982 } else { 982 } else {
983 LayoutUnit childInnerFlexBaseSize = computeInnerFlexBaseSizeForChild (*child); 983 LayoutUnit childInnerFlexBaseSize = computeInnerFlexBaseSizeForChild (*child);
984 LayoutUnit childSize = childInnerFlexBaseSize; 984 LayoutUnit childSize = childInnerFlexBaseSize;
985 double extraSpace = 0; 985 double extraSpace = 0;
986 bool childShrunk = false; 986 bool childShrunk = false;
987 if (availableFreeSpace > 0 && totalFlexGrow > 0 && flexSign == Posit iveFlexibility && std::isfinite(totalFlexGrow)) { 987 if (availableFreeSpace > 0 && totalFlexGrow > 0 && flexSign == Posit iveFlexibility && std::isfinite(totalFlexGrow)) {
988 extraSpace = availableFreeSpace * child->style()->flexGrow() / t otalFlexGrow; 988 if (totalFlexGrow < 1)
989 extraSpace = availableFreeSpace * child->style()->flexGrow() ;
990 else
991 extraSpace = availableFreeSpace * child->style()->flexGrow() / totalFlexGrow;
989 } else if (availableFreeSpace < 0 && totalWeightedFlexShrink > 0 && flexSign == NegativeFlexibility && std::isfinite(totalWeightedFlexShrink) && chi ld->style()->flexShrink()) { 992 } else if (availableFreeSpace < 0 && totalWeightedFlexShrink > 0 && flexSign == NegativeFlexibility && std::isfinite(totalWeightedFlexShrink) && chi ld->style()->flexShrink()) {
990 extraSpace = availableFreeSpace * child->style()->flexShrink() * childInnerFlexBaseSize / totalWeightedFlexShrink; 993 extraSpace = availableFreeSpace * child->style()->flexShrink() * childInnerFlexBaseSize / totalWeightedFlexShrink;
991 childShrunk = true; 994 childShrunk = true;
992 } 995 }
993 if (std::isfinite(extraSpace)) 996 if (std::isfinite(extraSpace))
994 childSize += LayoutUnit::fromFloatRound(extraSpace); 997 childSize += LayoutUnit::fromFloatRound(extraSpace);
995 998
996 LayoutUnit adjustedChildSize = adjustChildSizeForMinAndMax(*child, c hildSize, childShrunk); 999 LayoutUnit adjustedChildSize = adjustChildSizeForMinAndMax(*child, c hildSize, childShrunk);
997 ASSERT(adjustedChildSize >= 0); 1000 ASSERT(adjustedChildSize >= 0);
998 childSizes.append(adjustedChildSize); 1001 childSizes.append(adjustedChildSize);
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 ASSERT(child); 1499 ASSERT(child);
1497 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1500 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1498 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1501 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1499 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1502 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1500 adjustAlignmentForChild(*child, newOffset - originalOffset); 1503 adjustAlignmentForChild(*child, newOffset - originalOffset);
1501 } 1504 }
1502 } 1505 }
1503 } 1506 }
1504 1507
1505 } 1508 }
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/css3/flexbox/flex-grow-less-than-one-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698