| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 LayoutRectRecorder recorder(*this); | 237 LayoutRectRecorder recorder(*this); |
| 238 | 238 |
| 239 if (updateLogicalWidthAndColumnWidth()) | 239 if (updateLogicalWidthAndColumnWidth()) |
| 240 relayoutChildren = true; | 240 relayoutChildren = true; |
| 241 | 241 |
| 242 LayoutUnit previousHeight = logicalHeight(); | 242 LayoutUnit previousHeight = logicalHeight(); |
| 243 setLogicalHeight(borderAndPaddingLogicalHeight() + scrollbarLogicalHeight())
; | 243 setLogicalHeight(borderAndPaddingLogicalHeight() + scrollbarLogicalHeight())
; |
| 244 | 244 |
| 245 LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransfo
rm() || hasReflection() || style()->isFlippedBlocksWritingMode()); | 245 LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransfo
rm() || hasReflection() || style()->isFlippedBlocksWritingMode()); |
| 246 | 246 |
| 247 // Regions changing widths can force us to relayout our children. | |
| 248 RenderFlowThread* flowThread = flowThreadContainingBlock(); | |
| 249 if (logicalWidthChangedInRegions(flowThread)) | |
| 250 relayoutChildren = true; | |
| 251 if (updateRegionsAndShapesLogicalSize(flowThread)) | |
| 252 relayoutChildren = true; | |
| 253 | |
| 254 m_numberOfInFlowChildrenOnFirstLine = -1; | 247 m_numberOfInFlowChildrenOnFirstLine = -1; |
| 255 | 248 |
| 256 RenderBlock::startDelayUpdateScrollInfo(); | 249 RenderBlock::startDelayUpdateScrollInfo(); |
| 257 | 250 |
| 258 prepareOrderIteratorAndMargins(); | 251 prepareOrderIteratorAndMargins(); |
| 259 | 252 |
| 260 ChildFrameRects oldChildRects; | 253 ChildFrameRects oldChildRects; |
| 261 appendChildFrameRects(oldChildRects); | 254 appendChildFrameRects(oldChildRects); |
| 262 | 255 |
| 263 Vector<LineContext> lineContexts; | 256 Vector<LineContext> lineContexts; |
| 264 layoutFlexItems(relayoutChildren, lineContexts); | 257 layoutFlexItems(relayoutChildren, lineContexts); |
| 265 | 258 |
| 266 updateLogicalHeight(); | 259 updateLogicalHeight(); |
| 267 repositionLogicalHeightDependentFlexItems(lineContexts); | 260 repositionLogicalHeightDependentFlexItems(lineContexts); |
| 268 | 261 |
| 269 RenderBlock::finishDelayUpdateScrollInfo(); | 262 RenderBlock::finishDelayUpdateScrollInfo(); |
| 270 | 263 |
| 271 if (logicalHeight() != previousHeight) | 264 if (logicalHeight() != previousHeight) |
| 272 relayoutChildren = true; | 265 relayoutChildren = true; |
| 273 | 266 |
| 274 layoutPositionedObjects(relayoutChildren || isRoot()); | 267 layoutPositionedObjects(relayoutChildren || isRoot()); |
| 275 | 268 |
| 276 computeRegionRangeForBlock(flowThread); | |
| 277 | |
| 278 repaintChildrenDuringLayoutIfMoved(oldChildRects); | 269 repaintChildrenDuringLayoutIfMoved(oldChildRects); |
| 279 // FIXME: css3/flexbox/repaint-rtl-column.html seems to repaint more overflo
w than it needs to. | 270 // FIXME: css3/flexbox/repaint-rtl-column.html seems to repaint more overflo
w than it needs to. |
| 280 computeOverflow(clientLogicalBottomAfterRepositioning()); | 271 computeOverflow(clientLogicalBottomAfterRepositioning()); |
| 281 statePusher.pop(); | 272 statePusher.pop(); |
| 282 | 273 |
| 283 updateLayerTransform(); | 274 updateLayerTransform(); |
| 284 | 275 |
| 285 // Update our scroll information if we're overflow:auto/scroll/hidden now th
at we know if | 276 // Update our scroll information if we're overflow:auto/scroll/hidden now th
at we know if |
| 286 // we overflow or not. | 277 // we overflow or not. |
| 287 updateScrollInfoAfterLayout(); | 278 updateScrollInfoAfterLayout(); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 LayoutUnit RenderFlexibleBox::computeMainAxisExtentForChild(RenderBox* child, Si
zeType sizeType, const Length& size) | 432 LayoutUnit RenderFlexibleBox::computeMainAxisExtentForChild(RenderBox* child, Si
zeType sizeType, const Length& size) |
| 442 { | 433 { |
| 443 // FIXME: This is wrong for orthogonal flows. It should use the flexbox's wr
iting-mode, not the child's in order | 434 // FIXME: This is wrong for orthogonal flows. It should use the flexbox's wr
iting-mode, not the child's in order |
| 444 // to figure out the logical height/width. | 435 // to figure out the logical height/width. |
| 445 if (isColumnFlow()) { | 436 if (isColumnFlow()) { |
| 446 // We don't have to check for "auto" here - computeContentLogicalHeight
will just return -1 for that case anyway. | 437 // We don't have to check for "auto" here - computeContentLogicalHeight
will just return -1 for that case anyway. |
| 447 if (size.isIntrinsic()) | 438 if (size.isIntrinsic()) |
| 448 child->layoutIfNeeded(); | 439 child->layoutIfNeeded(); |
| 449 return child->computeContentLogicalHeight(size, child->logicalHeight() -
child->borderAndPaddingLogicalHeight()); | 440 return child->computeContentLogicalHeight(size, child->logicalHeight() -
child->borderAndPaddingLogicalHeight()); |
| 450 } | 441 } |
| 451 // FIXME: Figure out how this should work for regions and pass in the approp
riate values. | 442 return child->computeLogicalWidthUsing(sizeType, size, contentLogicalWidth()
, this) - child->borderAndPaddingLogicalWidth(); |
| 452 RenderRegion* region = 0; | |
| 453 return child->computeLogicalWidthInRegionUsing(sizeType, size, contentLogica
lWidth(), this, region) - child->borderAndPaddingLogicalWidth(); | |
| 454 } | 443 } |
| 455 | 444 |
| 456 WritingMode RenderFlexibleBox::transformedWritingMode() const | 445 WritingMode RenderFlexibleBox::transformedWritingMode() const |
| 457 { | 446 { |
| 458 WritingMode mode = style()->writingMode(); | 447 WritingMode mode = style()->writingMode(); |
| 459 if (!isColumnFlow()) | 448 if (!isColumnFlow()) |
| 460 return mode; | 449 return mode; |
| 461 | 450 |
| 462 switch (mode) { | 451 switch (mode) { |
| 463 case TopToBottomWritingMode: | 452 case TopToBottomWritingMode: |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 } | 1000 } |
| 1012 | 1001 |
| 1013 void RenderFlexibleBox::prepareChildForPositionedLayout(RenderBox* child, Layout
Unit mainAxisOffset, LayoutUnit crossAxisOffset, PositionedLayoutMode layoutMode
) | 1002 void RenderFlexibleBox::prepareChildForPositionedLayout(RenderBox* child, Layout
Unit mainAxisOffset, LayoutUnit crossAxisOffset, PositionedLayoutMode layoutMode
) |
| 1014 { | 1003 { |
| 1015 ASSERT(child->isOutOfFlowPositioned()); | 1004 ASSERT(child->isOutOfFlowPositioned()); |
| 1016 child->containingBlock()->insertPositionedObject(child); | 1005 child->containingBlock()->insertPositionedObject(child); |
| 1017 RenderLayer* childLayer = child->layer(); | 1006 RenderLayer* childLayer = child->layer(); |
| 1018 LayoutUnit inlinePosition = isColumnFlow() ? crossAxisOffset : mainAxisOffse
t; | 1007 LayoutUnit inlinePosition = isColumnFlow() ? crossAxisOffset : mainAxisOffse
t; |
| 1019 if (layoutMode == FlipForRowReverse && style()->flexDirection() == FlowRowRe
verse) | 1008 if (layoutMode == FlipForRowReverse && style()->flexDirection() == FlowRowRe
verse) |
| 1020 inlinePosition = mainAxisExtent() - mainAxisOffset; | 1009 inlinePosition = mainAxisExtent() - mainAxisOffset; |
| 1021 childLayer->setStaticInlinePosition(inlinePosition); // FIXME: Not right for
regions. | 1010 childLayer->setStaticInlinePosition(inlinePosition); |
| 1022 | 1011 |
| 1023 LayoutUnit staticBlockPosition = isColumnFlow() ? mainAxisOffset : crossAxis
Offset; | 1012 LayoutUnit staticBlockPosition = isColumnFlow() ? mainAxisOffset : crossAxis
Offset; |
| 1024 if (childLayer->staticBlockPosition() != staticBlockPosition) { | 1013 if (childLayer->staticBlockPosition() != staticBlockPosition) { |
| 1025 childLayer->setStaticBlockPosition(staticBlockPosition); | 1014 childLayer->setStaticBlockPosition(staticBlockPosition); |
| 1026 if (child->style()->hasStaticBlockPosition(style()->isHorizontalWritingM
ode())) | 1015 if (child->style()->hasStaticBlockPosition(style()->isHorizontalWritingM
ode())) |
| 1027 child->setChildNeedsLayout(MarkOnlyThis); | 1016 child->setChildNeedsLayout(MarkOnlyThis); |
| 1028 } | 1017 } |
| 1029 } | 1018 } |
| 1030 | 1019 |
| 1031 ItemPosition RenderFlexibleBox::alignmentForChild(RenderBox* child) const | 1020 ItemPosition RenderFlexibleBox::alignmentForChild(RenderBox* child) const |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1351 if (desiredLogicalHeight != child->logicalHeight()) { | 1340 if (desiredLogicalHeight != child->logicalHeight()) { |
| 1352 child->setOverrideLogicalContentHeight(desiredLogicalHeight - ch
ild->borderAndPaddingLogicalHeight()); | 1341 child->setOverrideLogicalContentHeight(desiredLogicalHeight - ch
ild->borderAndPaddingLogicalHeight()); |
| 1353 child->setLogicalHeight(0); | 1342 child->setLogicalHeight(0); |
| 1354 child->forceChildLayout(); | 1343 child->forceChildLayout(); |
| 1355 } | 1344 } |
| 1356 } | 1345 } |
| 1357 } else if (isColumnFlow() && child->style()->logicalWidth().isAuto()) { | 1346 } else if (isColumnFlow() && child->style()->logicalWidth().isAuto()) { |
| 1358 // FIXME: If the child doesn't have orthogonal flow, then it already has
an override width set, so use it. | 1347 // FIXME: If the child doesn't have orthogonal flow, then it already has
an override width set, so use it. |
| 1359 if (hasOrthogonalFlow(child)) { | 1348 if (hasOrthogonalFlow(child)) { |
| 1360 LayoutUnit childWidth = std::max<LayoutUnit>(0, lineCrossAxisExtent
- crossAxisMarginExtentForChild(child)); | 1349 LayoutUnit childWidth = std::max<LayoutUnit>(0, lineCrossAxisExtent
- crossAxisMarginExtentForChild(child)); |
| 1361 childWidth = child->constrainLogicalWidthInRegionByMinMax(childWidth
, childWidth, this); | 1350 childWidth = child->constrainLogicalWidthByMinMax(childWidth, childW
idth, this); |
| 1362 | 1351 |
| 1363 if (childWidth != child->logicalWidth()) { | 1352 if (childWidth != child->logicalWidth()) { |
| 1364 child->setOverrideLogicalContentWidth(childWidth - child->border
AndPaddingLogicalWidth()); | 1353 child->setOverrideLogicalContentWidth(childWidth - child->border
AndPaddingLogicalWidth()); |
| 1365 child->forceChildLayout(); | 1354 child->forceChildLayout(); |
| 1366 } | 1355 } |
| 1367 } | 1356 } |
| 1368 } | 1357 } |
| 1369 } | 1358 } |
| 1370 | 1359 |
| 1371 void RenderFlexibleBox::flipForRightToLeftColumn() | 1360 void RenderFlexibleBox::flipForRightToLeftColumn() |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1394 ASSERT(child); | 1383 ASSERT(child); |
| 1395 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; | 1384 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; |
| 1396 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; | 1385 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; |
| 1397 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; | 1386 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; |
| 1398 adjustAlignmentForChild(child, newOffset - originalOffset); | 1387 adjustAlignmentForChild(child, newOffset - originalOffset); |
| 1399 } | 1388 } |
| 1400 } | 1389 } |
| 1401 } | 1390 } |
| 1402 | 1391 |
| 1403 } | 1392 } |
| OLD | NEW |