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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(view(), this, locationOffset(), hasTransfo
rm() || hasReflection() || style()->isFlippedBlocksWritingMode()); | 244 LayoutStateMaintainer statePusher(view(), this, locationOffset(), hasTransfo
rm() || hasReflection() || style()->isFlippedBlocksWritingMode()); |
245 | 245 |
246 // Regions changing widths can force us to relayout our children. | |
247 RenderFlowThread* flowThread = flowThreadContainingBlock(); | 246 RenderFlowThread* flowThread = flowThreadContainingBlock(); |
248 if (logicalWidthChangedInRegions(flowThread)) | |
249 relayoutChildren = true; | |
250 if (updateRegionsAndShapesLogicalSize(flowThread)) | 247 if (updateRegionsAndShapesLogicalSize(flowThread)) |
251 relayoutChildren = true; | 248 relayoutChildren = true; |
252 | 249 |
253 m_numberOfInFlowChildrenOnFirstLine = -1; | 250 m_numberOfInFlowChildrenOnFirstLine = -1; |
254 | 251 |
255 RenderBlock::startDelayUpdateScrollInfo(); | 252 RenderBlock::startDelayUpdateScrollInfo(); |
256 | 253 |
257 prepareOrderIteratorAndMargins(); | 254 prepareOrderIteratorAndMargins(); |
258 | 255 |
259 ChildFrameRects oldChildRects; | 256 ChildFrameRects oldChildRects; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 LayoutUnit RenderFlexibleBox::computeMainAxisExtentForChild(RenderBox* child, Si
zeType sizeType, const Length& size) | 437 LayoutUnit RenderFlexibleBox::computeMainAxisExtentForChild(RenderBox* child, Si
zeType sizeType, const Length& size) |
441 { | 438 { |
442 // FIXME: This is wrong for orthogonal flows. It should use the flexbox's wr
iting-mode, not the child's in order | 439 // FIXME: This is wrong for orthogonal flows. It should use the flexbox's wr
iting-mode, not the child's in order |
443 // to figure out the logical height/width. | 440 // to figure out the logical height/width. |
444 if (isColumnFlow()) { | 441 if (isColumnFlow()) { |
445 // We don't have to check for "auto" here - computeContentLogicalHeight
will just return -1 for that case anyway. | 442 // We don't have to check for "auto" here - computeContentLogicalHeight
will just return -1 for that case anyway. |
446 if (size.isIntrinsic()) | 443 if (size.isIntrinsic()) |
447 child->layoutIfNeeded(); | 444 child->layoutIfNeeded(); |
448 return child->computeContentLogicalHeight(size, child->logicalHeight() -
child->borderAndPaddingLogicalHeight()); | 445 return child->computeContentLogicalHeight(size, child->logicalHeight() -
child->borderAndPaddingLogicalHeight()); |
449 } | 446 } |
450 // FIXME: Figure out how this should work for regions and pass in the approp
riate values. | 447 return child->computeLogicalWidthUsing(sizeType, size, contentLogicalWidth()
, this) - child->borderAndPaddingLogicalWidth(); |
451 RenderRegion* region = 0; | |
452 return child->computeLogicalWidthInRegionUsing(sizeType, size, contentLogica
lWidth(), this, region) - child->borderAndPaddingLogicalWidth(); | |
453 } | 448 } |
454 | 449 |
455 WritingMode RenderFlexibleBox::transformedWritingMode() const | 450 WritingMode RenderFlexibleBox::transformedWritingMode() const |
456 { | 451 { |
457 WritingMode mode = style()->writingMode(); | 452 WritingMode mode = style()->writingMode(); |
458 if (!isColumnFlow()) | 453 if (!isColumnFlow()) |
459 return mode; | 454 return mode; |
460 | 455 |
461 switch (mode) { | 456 switch (mode) { |
462 case TopToBottomWritingMode: | 457 case TopToBottomWritingMode: |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 } | 1017 } |
1023 | 1018 |
1024 void RenderFlexibleBox::prepareChildForPositionedLayout(RenderBox* child, Layout
Unit mainAxisOffset, LayoutUnit crossAxisOffset, PositionedLayoutMode layoutMode
) | 1019 void RenderFlexibleBox::prepareChildForPositionedLayout(RenderBox* child, Layout
Unit mainAxisOffset, LayoutUnit crossAxisOffset, PositionedLayoutMode layoutMode
) |
1025 { | 1020 { |
1026 ASSERT(child->isOutOfFlowPositioned()); | 1021 ASSERT(child->isOutOfFlowPositioned()); |
1027 child->containingBlock()->insertPositionedObject(child); | 1022 child->containingBlock()->insertPositionedObject(child); |
1028 RenderLayer* childLayer = child->layer(); | 1023 RenderLayer* childLayer = child->layer(); |
1029 LayoutUnit inlinePosition = isColumnFlow() ? crossAxisOffset : mainAxisOffse
t; | 1024 LayoutUnit inlinePosition = isColumnFlow() ? crossAxisOffset : mainAxisOffse
t; |
1030 if (layoutMode == FlipForRowReverse && style()->flexDirection() == FlowRowRe
verse) | 1025 if (layoutMode == FlipForRowReverse && style()->flexDirection() == FlowRowRe
verse) |
1031 inlinePosition = mainAxisExtent() - mainAxisOffset; | 1026 inlinePosition = mainAxisExtent() - mainAxisOffset; |
1032 childLayer->setStaticInlinePosition(inlinePosition); // FIXME: Not right for
regions. | 1027 childLayer->setStaticInlinePosition(inlinePosition); |
1033 | 1028 |
1034 LayoutUnit staticBlockPosition = isColumnFlow() ? mainAxisOffset : crossAxis
Offset; | 1029 LayoutUnit staticBlockPosition = isColumnFlow() ? mainAxisOffset : crossAxis
Offset; |
1035 if (childLayer->staticBlockPosition() != staticBlockPosition) { | 1030 if (childLayer->staticBlockPosition() != staticBlockPosition) { |
1036 childLayer->setStaticBlockPosition(staticBlockPosition); | 1031 childLayer->setStaticBlockPosition(staticBlockPosition); |
1037 if (child->style()->hasStaticBlockPosition(style()->isHorizontalWritingM
ode())) | 1032 if (child->style()->hasStaticBlockPosition(style()->isHorizontalWritingM
ode())) |
1038 child->setChildNeedsLayout(MarkOnlyThis); | 1033 child->setChildNeedsLayout(MarkOnlyThis); |
1039 } | 1034 } |
1040 } | 1035 } |
1041 | 1036 |
1042 ItemPosition RenderFlexibleBox::alignmentForChild(RenderBox* child) const | 1037 ItemPosition RenderFlexibleBox::alignmentForChild(RenderBox* child) const |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 if (desiredLogicalHeight != child->logicalHeight()) { | 1359 if (desiredLogicalHeight != child->logicalHeight()) { |
1365 child->setOverrideLogicalContentHeight(desiredLogicalHeight - ch
ild->borderAndPaddingLogicalHeight()); | 1360 child->setOverrideLogicalContentHeight(desiredLogicalHeight - ch
ild->borderAndPaddingLogicalHeight()); |
1366 child->setLogicalHeight(0); | 1361 child->setLogicalHeight(0); |
1367 child->forceChildLayout(); | 1362 child->forceChildLayout(); |
1368 } | 1363 } |
1369 } | 1364 } |
1370 } else if (isColumnFlow() && child->style()->logicalWidth().isAuto()) { | 1365 } else if (isColumnFlow() && child->style()->logicalWidth().isAuto()) { |
1371 // FIXME: If the child doesn't have orthogonal flow, then it already has
an override width set, so use it. | 1366 // FIXME: If the child doesn't have orthogonal flow, then it already has
an override width set, so use it. |
1372 if (hasOrthogonalFlow(child)) { | 1367 if (hasOrthogonalFlow(child)) { |
1373 LayoutUnit childWidth = std::max<LayoutUnit>(0, lineCrossAxisExtent
- crossAxisMarginExtentForChild(child)); | 1368 LayoutUnit childWidth = std::max<LayoutUnit>(0, lineCrossAxisExtent
- crossAxisMarginExtentForChild(child)); |
1374 childWidth = child->constrainLogicalWidthInRegionByMinMax(childWidth
, childWidth, this); | 1369 childWidth = child->constrainLogicalWidthByMinMax(childWidth, childW
idth, this); |
1375 | 1370 |
1376 if (childWidth != child->logicalWidth()) { | 1371 if (childWidth != child->logicalWidth()) { |
1377 child->setOverrideLogicalContentWidth(childWidth - child->border
AndPaddingLogicalWidth()); | 1372 child->setOverrideLogicalContentWidth(childWidth - child->border
AndPaddingLogicalWidth()); |
1378 child->forceChildLayout(); | 1373 child->forceChildLayout(); |
1379 } | 1374 } |
1380 } | 1375 } |
1381 } | 1376 } |
1382 } | 1377 } |
1383 | 1378 |
1384 void RenderFlexibleBox::flipForRightToLeftColumn() | 1379 void RenderFlexibleBox::flipForRightToLeftColumn() |
(...skipping 22 matching lines...) Expand all Loading... |
1407 ASSERT(child); | 1402 ASSERT(child); |
1408 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; | 1403 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; |
1409 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; | 1404 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; |
1410 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; | 1405 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; |
1411 adjustAlignmentForChild(child, newOffset - originalOffset); | 1406 adjustAlignmentForChild(child, newOffset - originalOffset); |
1412 } | 1407 } |
1413 } | 1408 } |
1414 } | 1409 } |
1415 | 1410 |
1416 } | 1411 } |
OLD | NEW |