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

Side by Side Diff: Source/core/rendering/RenderFlexibleBox.cpp

Issue 290823003: Chrome incorrectly honors "align-content" in "flex-wrap: wrap" flex containers that only have a sin… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 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 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1202 mainAxisOffset -= flowAwareMarginStartForChild(child); 1202 mainAxisOffset -= flowAwareMarginStartForChild(child);
1203 1203
1204 ++seenInFlowPositionedChildren; 1204 ++seenInFlowPositionedChildren;
1205 if (seenInFlowPositionedChildren < numberOfChildrenForJustifyContent) 1205 if (seenInFlowPositionedChildren < numberOfChildrenForJustifyContent)
1206 mainAxisOffset -= justifyContentSpaceBetweenChildren(availableFreeSp ace, style()->justifyContent(), numberOfChildrenForJustifyContent); 1206 mainAxisOffset -= justifyContentSpaceBetweenChildren(availableFreeSp ace, style()->justifyContent(), numberOfChildrenForJustifyContent);
1207 } 1207 }
1208 } 1208 }
1209 1209
1210 static LayoutUnit initialAlignContentOffset(LayoutUnit availableFreeSpace, EAlig nContent alignContent, unsigned numberOfLines) 1210 static LayoutUnit initialAlignContentOffset(LayoutUnit availableFreeSpace, EAlig nContent alignContent, unsigned numberOfLines)
1211 { 1211 {
1212 if (alignContent == AlignContentFlexEnd) 1212 if (numberOfLines > 1) {
tony 2014/05/19 16:43:45 Nit: I would early return so there's less indentio
harpreet.sk 2014/05/20 07:39:43 Done.
1213 return availableFreeSpace; 1213 if (alignContent == AlignContentFlexEnd)
1214 if (alignContent == AlignContentCenter) 1214 return availableFreeSpace;
1215 return availableFreeSpace / 2; 1215 if (alignContent == AlignContentCenter)
1216 if (alignContent == AlignContentSpaceAround) {
1217 if (availableFreeSpace > 0 && numberOfLines)
1218 return availableFreeSpace / (2 * numberOfLines);
1219 if (availableFreeSpace < 0)
1220 return availableFreeSpace / 2; 1216 return availableFreeSpace / 2;
1217 if (alignContent == AlignContentSpaceAround) {
1218 if (availableFreeSpace > 0 && numberOfLines)
1219 return availableFreeSpace / (2 * numberOfLines);
1220 if (availableFreeSpace < 0)
1221 return availableFreeSpace / 2;
1222 }
1221 } 1223 }
1222 return 0; 1224 return 0;
1223 } 1225 }
1224 1226
1225 static LayoutUnit alignContentSpaceBetweenChildren(LayoutUnit availableFreeSpace , EAlignContent alignContent, unsigned numberOfLines) 1227 static LayoutUnit alignContentSpaceBetweenChildren(LayoutUnit availableFreeSpace , EAlignContent alignContent, unsigned numberOfLines)
1226 { 1228 {
1227 if (availableFreeSpace > 0 && numberOfLines > 1) { 1229 if (availableFreeSpace > 0 && numberOfLines > 1) {
1228 if (alignContent == AlignContentSpaceBetween) 1230 if (alignContent == AlignContentSpaceBetween)
1229 return availableFreeSpace / (numberOfLines - 1); 1231 return availableFreeSpace / (numberOfLines - 1);
1230 if (alignContent == AlignContentSpaceAround || alignContent == AlignCont entStretch) 1232 if (alignContent == AlignContentSpaceAround || alignContent == AlignCont entStretch)
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 ASSERT(child); 1413 ASSERT(child);
1412 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent; 1414 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE xtent;
1413 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge; 1415 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset - crossAxisStartEdge;
1414 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent; 1416 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi sExtent;
1415 adjustAlignmentForChild(child, newOffset - originalOffset); 1417 adjustAlignmentForChild(child, newOffset - originalOffset);
1416 } 1418 }
1417 } 1419 }
1418 } 1420 }
1419 1421
1420 } 1422 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698