OLD | NEW |
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 Loading... |
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 (numberOfLines <= 1) |
| 1213 return 0; |
1212 if (alignContent == AlignContentFlexEnd) | 1214 if (alignContent == AlignContentFlexEnd) |
1213 return availableFreeSpace; | 1215 return availableFreeSpace; |
1214 if (alignContent == AlignContentCenter) | 1216 if (alignContent == AlignContentCenter) |
1215 return availableFreeSpace / 2; | 1217 return availableFreeSpace / 2; |
1216 if (alignContent == AlignContentSpaceAround) { | 1218 if (alignContent == AlignContentSpaceAround) { |
1217 if (availableFreeSpace > 0 && numberOfLines) | 1219 if (availableFreeSpace > 0 && numberOfLines) |
1218 return availableFreeSpace / (2 * numberOfLines); | 1220 return availableFreeSpace / (2 * numberOfLines); |
1219 if (availableFreeSpace < 0) | 1221 if (availableFreeSpace < 0) |
1220 return availableFreeSpace / 2; | 1222 return availableFreeSpace / 2; |
1221 } | 1223 } |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |