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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 234 |
235 LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); | 235 LayoutRepainter repainter(*this, checkForRepaintDuringLayout()); |
236 LayoutRectRecorder recorder(*this); | 236 LayoutRectRecorder recorder(*this); |
237 | 237 |
238 if (updateLogicalWidthAndColumnWidth()) | 238 if (updateLogicalWidthAndColumnWidth()) |
239 relayoutChildren = true; | 239 relayoutChildren = true; |
240 | 240 |
241 LayoutUnit previousHeight = logicalHeight(); | 241 LayoutUnit previousHeight = logicalHeight(); |
242 setLogicalHeight(borderAndPaddingLogicalHeight() + scrollbarLogicalHeight())
; | 242 setLogicalHeight(borderAndPaddingLogicalHeight() + scrollbarLogicalHeight())
; |
243 | 243 |
244 LayoutStateMaintainer statePusher(*this, locationOffset()); | |
245 | |
246 RenderFlowThread* flowThread = flowThreadContainingBlock(); | 244 RenderFlowThread* flowThread = flowThreadContainingBlock(); |
247 if (updateRegionsAndShapesLogicalSize(flowThread)) | 245 if (updateRegionsAndShapesLogicalSize(flowThread)) |
248 relayoutChildren = true; | 246 relayoutChildren = true; |
249 | 247 |
250 m_numberOfInFlowChildrenOnFirstLine = -1; | 248 m_numberOfInFlowChildrenOnFirstLine = -1; |
251 | 249 |
252 RenderBlock::startDelayUpdateScrollInfo(); | 250 RenderBlock::startDelayUpdateScrollInfo(); |
253 | 251 |
254 prepareOrderIteratorAndMargins(); | 252 prepareOrderIteratorAndMargins(); |
255 | 253 |
256 ChildFrameRects oldChildRects; | 254 ChildFrameRects oldChildRects; |
257 appendChildFrameRects(oldChildRects); | 255 appendChildFrameRects(oldChildRects); |
258 | 256 |
259 Vector<LineContext> lineContexts; | 257 layoutFlexItems(relayoutChildren); |
260 layoutFlexItems(relayoutChildren, lineContexts); | |
261 | |
262 updateLogicalHeight(); | |
263 repositionLogicalHeightDependentFlexItems(lineContexts); | |
264 | 258 |
265 RenderBlock::finishDelayUpdateScrollInfo(); | 259 RenderBlock::finishDelayUpdateScrollInfo(); |
266 | 260 |
267 if (logicalHeight() != previousHeight) | 261 if (logicalHeight() != previousHeight) |
268 relayoutChildren = true; | 262 relayoutChildren = true; |
269 | 263 |
270 layoutPositionedObjects(relayoutChildren || isRoot()); | 264 layoutPositionedObjects(relayoutChildren || isRoot()); |
271 | 265 |
272 computeRegionRangeForBlock(flowThread); | 266 computeRegionRangeForBlock(flowThread); |
273 | 267 |
274 repaintChildrenDuringLayoutIfMoved(oldChildRects); | 268 repaintChildrenDuringLayoutIfMoved(oldChildRects); |
275 // FIXME: css3/flexbox/repaint-rtl-column.html seems to repaint more overflo
w than it needs to. | 269 // FIXME: css3/flexbox/repaint-rtl-column.html seems to repaint more overflo
w than it needs to. |
276 computeOverflow(clientLogicalBottomAfterRepositioning()); | 270 computeOverflow(clientLogicalBottomAfterRepositioning()); |
277 statePusher.pop(); | |
278 | 271 |
279 updateLayerTransform(); | 272 updateLayerTransform(); |
280 | 273 |
281 // Update our scroll information if we're overflow:auto/scroll/hidden now th
at we know if | 274 // Update our scroll information if we're overflow:auto/scroll/hidden now th
at we know if |
282 // we overflow or not. | 275 // we overflow or not. |
283 updateScrollInfoAfterLayout(); | 276 updateScrollInfoAfterLayout(); |
284 | 277 |
285 repainter.repaintAfterLayout(); | 278 repainter.repaintAfterLayout(); |
286 | 279 |
287 clearNeedsLayout(); | 280 clearNeedsLayout(); |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 mainAxisExtent = m_intrinsicSizeAlongMainAxis.get(child); | 656 mainAxisExtent = m_intrinsicSizeAlongMainAxis.get(child); |
664 } else { | 657 } else { |
665 mainAxisExtent = child->maxPreferredLogicalWidth(); | 658 mainAxisExtent = child->maxPreferredLogicalWidth(); |
666 } | 659 } |
667 ASSERT(mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child) >=
0); | 660 ASSERT(mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child) >=
0); |
668 return mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child); | 661 return mainAxisExtent - mainAxisBorderAndPaddingExtentForChild(child); |
669 } | 662 } |
670 return std::max(LayoutUnit(0), computeMainAxisExtentForChild(child, MainOrPr
eferredSize, flexBasis)); | 663 return std::max(LayoutUnit(0), computeMainAxisExtentForChild(child, MainOrPr
eferredSize, flexBasis)); |
671 } | 664 } |
672 | 665 |
673 void RenderFlexibleBox::layoutFlexItems(bool relayoutChildren, Vector<LineContex
t>& lineContexts) | 666 void RenderFlexibleBox::layoutFlexItems(bool relayoutChildren) |
674 { | 667 { |
| 668 LayoutStateMaintainer statePusher(*this, locationOffset()); |
| 669 Vector<LineContext> lineContexts; |
675 OrderedFlexItemList orderedChildren; | 670 OrderedFlexItemList orderedChildren; |
676 LayoutUnit sumFlexBaseSize; | 671 LayoutUnit sumFlexBaseSize; |
677 double totalFlexGrow; | 672 double totalFlexGrow; |
678 double totalWeightedFlexShrink; | 673 double totalWeightedFlexShrink; |
679 LayoutUnit sumHypotheticalMainSize; | 674 LayoutUnit sumHypotheticalMainSize; |
680 | 675 |
681 Vector<LayoutUnit, 16> childSizes; | 676 Vector<LayoutUnit, 16> childSizes; |
682 | 677 |
683 m_orderIterator.first(); | 678 m_orderIterator.first(); |
684 LayoutUnit crossAxisOffset = flowAwareBorderBefore() + flowAwarePaddingBefor
e(); | 679 LayoutUnit crossAxisOffset = flowAwareBorderBefore() + flowAwarePaddingBefor
e(); |
(...skipping 15 matching lines...) Expand all Loading... |
700 // Even if computeNextFlexLine returns true, the flexbox might not have | 695 // Even if computeNextFlexLine returns true, the flexbox might not have |
701 // a line because all our children might be out of flow positioned. | 696 // a line because all our children might be out of flow positioned. |
702 // Instead of just checking if we have a line, make sure the flexbox | 697 // Instead of just checking if we have a line, make sure the flexbox |
703 // has at least a line's worth of height to cover this case. | 698 // has at least a line's worth of height to cover this case. |
704 LayoutUnit minHeight = borderAndPaddingLogicalHeight() | 699 LayoutUnit minHeight = borderAndPaddingLogicalHeight() |
705 + lineHeight(true, isHorizontalWritingMode() ? HorizontalLine : Vert
icalLine, PositionOfInteriorLineBoxes) | 700 + lineHeight(true, isHorizontalWritingMode() ? HorizontalLine : Vert
icalLine, PositionOfInteriorLineBoxes) |
706 + scrollbarLogicalHeight(); | 701 + scrollbarLogicalHeight(); |
707 if (height() < minHeight) | 702 if (height() < minHeight) |
708 setLogicalHeight(minHeight); | 703 setLogicalHeight(minHeight); |
709 } | 704 } |
| 705 |
| 706 updateLogicalHeight(); |
| 707 repositionLogicalHeightDependentFlexItems(lineContexts); |
710 } | 708 } |
711 | 709 |
712 LayoutUnit RenderFlexibleBox::autoMarginOffsetInMainAxis(const OrderedFlexItemLi
st& children, LayoutUnit& availableFreeSpace) | 710 LayoutUnit RenderFlexibleBox::autoMarginOffsetInMainAxis(const OrderedFlexItemLi
st& children, LayoutUnit& availableFreeSpace) |
713 { | 711 { |
714 if (availableFreeSpace <= 0) | 712 if (availableFreeSpace <= 0) |
715 return 0; | 713 return 0; |
716 | 714 |
717 int numberOfAutoMargins = 0; | 715 int numberOfAutoMargins = 0; |
718 bool isHorizontal = isHorizontalFlow(); | 716 bool isHorizontal = isHorizontalFlow(); |
719 for (size_t i = 0; i < children.size(); ++i) { | 717 for (size_t i = 0; i < children.size(); ++i) { |
(...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1402 ASSERT(child); | 1400 ASSERT(child); |
1403 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; | 1401 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; |
1404 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; | 1402 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; |
1405 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; | 1403 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; |
1406 adjustAlignmentForChild(child, newOffset - originalOffset); | 1404 adjustAlignmentForChild(child, newOffset - originalOffset); |
1407 } | 1405 } |
1408 } | 1406 } |
1409 } | 1407 } |
1410 | 1408 |
1411 } | 1409 } |
OLD | NEW |