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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 { | 309 { |
310 for (RenderBox* child = m_orderIterator.first(); child; child = m_orderItera
tor.next()) | 310 for (RenderBox* child = m_orderIterator.first(); child; child = m_orderItera
tor.next()) |
311 paintChildAsInlineBlock(child, paintInfo, paintOffset); | 311 paintChildAsInlineBlock(child, paintInfo, paintOffset); |
312 } | 312 } |
313 | 313 |
314 void RenderFlexibleBox::repositionLogicalHeightDependentFlexItems(Vector<LineCon
text>& lineContexts) | 314 void RenderFlexibleBox::repositionLogicalHeightDependentFlexItems(Vector<LineCon
text>& lineContexts) |
315 { | 315 { |
316 LayoutUnit crossAxisStartEdge = lineContexts.isEmpty() ? LayoutUnit() : line
Contexts[0].crossAxisOffset; | 316 LayoutUnit crossAxisStartEdge = lineContexts.isEmpty() ? LayoutUnit() : line
Contexts[0].crossAxisOffset; |
317 alignFlexLines(lineContexts); | 317 alignFlexLines(lineContexts); |
318 | 318 |
319 // If we have a single line flexbox or a multiline line flexbox with only on
e flex line, | |
320 // the line height is all the available space. | |
321 // For flex-direction: row, this means we need to use the height, so we do t
his after calling updateLogicalHeight. | |
322 if (lineContexts.size() == 1) | |
323 lineContexts[0].crossAxisExtent = crossAxisContentExtent(); | |
324 alignChildren(lineContexts); | 319 alignChildren(lineContexts); |
325 | 320 |
326 if (style()->flexWrap() == FlexWrapReverse) | 321 if (style()->flexWrap() == FlexWrapReverse) |
327 flipForWrapReverse(lineContexts, crossAxisStartEdge); | 322 flipForWrapReverse(lineContexts, crossAxisStartEdge); |
328 | 323 |
329 // direction:rtl + flex-direction:column means the cross-axis direction is f
lipped. | 324 // direction:rtl + flex-direction:column means the cross-axis direction is f
lipped. |
330 flipForRightToLeftColumn(); | 325 flipForRightToLeftColumn(); |
331 } | 326 } |
332 | 327 |
333 LayoutUnit RenderFlexibleBox::clientLogicalBottomAfterRepositioning() | 328 LayoutUnit RenderFlexibleBox::clientLogicalBottomAfterRepositioning() |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 if (alignContent == AlignContentSpaceBetween) | 1228 if (alignContent == AlignContentSpaceBetween) |
1234 return availableFreeSpace / (numberOfLines - 1); | 1229 return availableFreeSpace / (numberOfLines - 1); |
1235 if (alignContent == AlignContentSpaceAround || alignContent == AlignCont
entStretch) | 1230 if (alignContent == AlignContentSpaceAround || alignContent == AlignCont
entStretch) |
1236 return availableFreeSpace / numberOfLines; | 1231 return availableFreeSpace / numberOfLines; |
1237 } | 1232 } |
1238 return 0; | 1233 return 0; |
1239 } | 1234 } |
1240 | 1235 |
1241 void RenderFlexibleBox::alignFlexLines(Vector<LineContext>& lineContexts) | 1236 void RenderFlexibleBox::alignFlexLines(Vector<LineContext>& lineContexts) |
1242 { | 1237 { |
1243 if (!isMultiline() || style()->alignContent() == AlignContentFlexStart) | 1238 // If we have a single line flexbox or a multiline line flexbox with only on
e flex line, |
| 1239 // the line height is all the available space. |
| 1240 // For flex-direction: row, this means we need to use the height, so we do t
his after calling updateLogicalHeight. |
| 1241 if (lineContexts.size() == 1) { |
| 1242 lineContexts[0].crossAxisExtent = crossAxisContentExtent(); |
| 1243 return; |
| 1244 } |
| 1245 |
| 1246 if (style()->alignContent() == AlignContentFlexStart) |
1244 return; | 1247 return; |
1245 | 1248 |
1246 LayoutUnit availableCrossAxisSpace = crossAxisContentExtent(); | 1249 LayoutUnit availableCrossAxisSpace = crossAxisContentExtent(); |
1247 for (size_t i = 0; i < lineContexts.size(); ++i) | 1250 for (size_t i = 0; i < lineContexts.size(); ++i) |
1248 availableCrossAxisSpace -= lineContexts[i].crossAxisExtent; | 1251 availableCrossAxisSpace -= lineContexts[i].crossAxisExtent; |
1249 | 1252 |
1250 RenderBox* child = m_orderIterator.first(); | 1253 RenderBox* child = m_orderIterator.first(); |
1251 LayoutUnit lineOffset = initialAlignContentOffset(availableCrossAxisSpace, s
tyle()->alignContent(), lineContexts.size()); | 1254 LayoutUnit lineOffset = initialAlignContentOffset(availableCrossAxisSpace, s
tyle()->alignContent(), lineContexts.size()); |
1252 for (unsigned lineNumber = 0; lineNumber < lineContexts.size(); ++lineNumber
) { | 1255 for (unsigned lineNumber = 0; lineNumber < lineContexts.size(); ++lineNumber
) { |
1253 lineContexts[lineNumber].crossAxisOffset += lineOffset; | 1256 lineContexts[lineNumber].crossAxisOffset += lineOffset; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1416 ASSERT(child); | 1419 ASSERT(child); |
1417 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; | 1420 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; |
1418 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; | 1421 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; |
1419 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; | 1422 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; |
1420 adjustAlignmentForChild(child, newOffset - originalOffset); | 1423 adjustAlignmentForChild(child, newOffset - originalOffset); |
1421 } | 1424 } |
1422 } | 1425 } |
1423 } | 1426 } |
1424 | 1427 |
1425 } | 1428 } |
OLD | NEW |