| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 167 |
| 168 if (!isColumnFlow() && hasOrthogonalFlow(baselineChild)) | 168 if (!isColumnFlow() && hasOrthogonalFlow(baselineChild)) |
| 169 return crossAxisExtentForChild(baselineChild) + baselineChild->logicalTo
p(); | 169 return crossAxisExtentForChild(baselineChild) + baselineChild->logicalTo
p(); |
| 170 if (isColumnFlow() && !hasOrthogonalFlow(baselineChild)) | 170 if (isColumnFlow() && !hasOrthogonalFlow(baselineChild)) |
| 171 return mainAxisExtentForChild(baselineChild) + baselineChild->logicalTop
(); | 171 return mainAxisExtentForChild(baselineChild) + baselineChild->logicalTop
(); |
| 172 | 172 |
| 173 int baseline = baselineChild->firstLineBoxBaseline(); | 173 int baseline = baselineChild->firstLineBoxBaseline(); |
| 174 if (baseline == -1) { | 174 if (baseline == -1) { |
| 175 // FIXME: We should pass |direction| into firstLineBoxBaseline and stop
bailing out if we're a writing mode root. | 175 // FIXME: We should pass |direction| into firstLineBoxBaseline and stop
bailing out if we're a writing mode root. |
| 176 // This would also fix some cases where the flexbox is orthogonal to its
container. | 176 // This would also fix some cases where the flexbox is orthogonal to its
container. |
| 177 LineDirectionMode direction = isHorizontalWritingMode() ? HorizontalLine
: VerticalLine; | 177 LineDirectionMode direction = HorizontalLine; |
| 178 return synthesizedBaselineFromContentBox(baselineChild, direction) + bas
elineChild->logicalTop(); | 178 return synthesizedBaselineFromContentBox(baselineChild, direction) + bas
elineChild->logicalTop(); |
| 179 } | 179 } |
| 180 | 180 |
| 181 return baseline + baselineChild->logicalTop(); | 181 return baseline + baselineChild->logicalTop(); |
| 182 } | 182 } |
| 183 | 183 |
| 184 int RenderFlexibleBox::inlineBlockBaseline(LineDirectionMode direction) const | 184 int RenderFlexibleBox::inlineBlockBaseline(LineDirectionMode direction) const |
| 185 { | 185 { |
| 186 int baseline = firstLineBoxBaseline(); | 186 int baseline = firstLineBoxBaseline(); |
| 187 if (baseline != -1) | 187 if (baseline != -1) |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 // to figure out the logical height/width. | 415 // to figure out the logical height/width. |
| 416 if (isColumnFlow()) { | 416 if (isColumnFlow()) { |
| 417 // We don't have to check for "auto" here - computeContentLogicalHeight
will just return -1 for that case anyway. | 417 // We don't have to check for "auto" here - computeContentLogicalHeight
will just return -1 for that case anyway. |
| 418 if (size.isIntrinsic()) | 418 if (size.isIntrinsic()) |
| 419 child->layoutIfNeeded(); | 419 child->layoutIfNeeded(); |
| 420 return child->computeContentLogicalHeight(size, child->logicalHeight() -
child->borderAndPaddingLogicalHeight()) + child->scrollbarLogicalHeight(); | 420 return child->computeContentLogicalHeight(size, child->logicalHeight() -
child->borderAndPaddingLogicalHeight()) + child->scrollbarLogicalHeight(); |
| 421 } | 421 } |
| 422 return child->computeLogicalWidthUsing(sizeType, size, contentLogicalWidth()
, this) - child->borderAndPaddingLogicalWidth(); | 422 return child->computeLogicalWidthUsing(sizeType, size, contentLogicalWidth()
, this) - child->borderAndPaddingLogicalWidth(); |
| 423 } | 423 } |
| 424 | 424 |
| 425 WritingMode RenderFlexibleBox::transformedWritingMode() const | |
| 426 { | |
| 427 // FIXME(sky): Remove | |
| 428 return TopToBottomWritingMode; | |
| 429 } | |
| 430 | |
| 431 LayoutUnit RenderFlexibleBox::flowAwareBorderStart() const | 425 LayoutUnit RenderFlexibleBox::flowAwareBorderStart() const |
| 432 { | 426 { |
| 433 if (isHorizontalFlow()) | 427 if (isHorizontalFlow()) |
| 434 return isLeftToRightFlow() ? borderLeft() : borderRight(); | 428 return isLeftToRightFlow() ? borderLeft() : borderRight(); |
| 435 return isLeftToRightFlow() ? borderTop() : borderBottom(); | 429 return isLeftToRightFlow() ? borderTop() : borderBottom(); |
| 436 } | 430 } |
| 437 | 431 |
| 438 LayoutUnit RenderFlexibleBox::flowAwareBorderEnd() const | 432 LayoutUnit RenderFlexibleBox::flowAwareBorderEnd() const |
| 439 { | 433 { |
| 440 if (isHorizontalFlow()) | 434 if (isHorizontalFlow()) |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 } | 590 } |
| 597 | 591 |
| 598 layoutAndPlaceChildren(crossAxisOffset, orderedChildren, childSizes, ava
ilableFreeSpace, relayoutChildren, lineContexts, hasInfiniteLineLength); | 592 layoutAndPlaceChildren(crossAxisOffset, orderedChildren, childSizes, ava
ilableFreeSpace, relayoutChildren, lineContexts, hasInfiniteLineLength); |
| 599 } | 593 } |
| 600 if (hasLineIfEmpty()) { | 594 if (hasLineIfEmpty()) { |
| 601 // Even if computeNextFlexLine returns true, the flexbox might not have | 595 // Even if computeNextFlexLine returns true, the flexbox might not have |
| 602 // a line because all our children might be out of flow positioned. | 596 // a line because all our children might be out of flow positioned. |
| 603 // Instead of just checking if we have a line, make sure the flexbox | 597 // Instead of just checking if we have a line, make sure the flexbox |
| 604 // has at least a line's worth of height to cover this case. | 598 // has at least a line's worth of height to cover this case. |
| 605 LayoutUnit minHeight = borderAndPaddingLogicalHeight() | 599 LayoutUnit minHeight = borderAndPaddingLogicalHeight() |
| 606 + lineHeight(true, isHorizontalWritingMode() ? HorizontalLine : Vert
icalLine, PositionOfInteriorLineBoxes) | 600 + lineHeight(true, HorizontalLine, PositionOfInteriorLineBoxes) |
| 607 + scrollbarLogicalHeight(); | 601 + scrollbarLogicalHeight(); |
| 608 if (height() < minHeight) | 602 if (height() < minHeight) |
| 609 setLogicalHeight(minHeight); | 603 setLogicalHeight(minHeight); |
| 610 } | 604 } |
| 611 | 605 |
| 612 updateLogicalHeight(); | 606 updateLogicalHeight(); |
| 613 repositionLogicalHeightDependentFlexItems(lineContexts); | 607 repositionLogicalHeightDependentFlexItems(lineContexts); |
| 614 } | 608 } |
| 615 | 609 |
| 616 LayoutUnit RenderFlexibleBox::autoMarginOffsetInMainAxis(const OrderedFlexItemLi
st& children, LayoutUnit& availableFreeSpace) | 610 LayoutUnit RenderFlexibleBox::autoMarginOffsetInMainAxis(const OrderedFlexItemLi
st& children, LayoutUnit& availableFreeSpace) |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 child->containingBlock()->insertPositionedObject(child); | 927 child->containingBlock()->insertPositionedObject(child); |
| 934 RenderLayer* childLayer = child->layer(); | 928 RenderLayer* childLayer = child->layer(); |
| 935 LayoutUnit inlinePosition = isColumnFlow() ? crossAxisOffset : mainAxisOffse
t; | 929 LayoutUnit inlinePosition = isColumnFlow() ? crossAxisOffset : mainAxisOffse
t; |
| 936 if (layoutMode == FlipForRowReverse && style()->flexDirection() == FlowRowRe
verse) | 930 if (layoutMode == FlipForRowReverse && style()->flexDirection() == FlowRowRe
verse) |
| 937 inlinePosition = mainAxisExtent() - mainAxisOffset; | 931 inlinePosition = mainAxisExtent() - mainAxisOffset; |
| 938 childLayer->setStaticInlinePosition(inlinePosition); | 932 childLayer->setStaticInlinePosition(inlinePosition); |
| 939 | 933 |
| 940 LayoutUnit staticBlockPosition = isColumnFlow() ? mainAxisOffset : crossAxis
Offset; | 934 LayoutUnit staticBlockPosition = isColumnFlow() ? mainAxisOffset : crossAxis
Offset; |
| 941 if (childLayer->staticBlockPosition() != staticBlockPosition) { | 935 if (childLayer->staticBlockPosition() != staticBlockPosition) { |
| 942 childLayer->setStaticBlockPosition(staticBlockPosition); | 936 childLayer->setStaticBlockPosition(staticBlockPosition); |
| 943 if (child->style()->hasStaticBlockPosition(style()->isHorizontalWritingM
ode())) | 937 if (child->style()->hasStaticBlockPosition()) |
| 944 child->setChildNeedsLayout(MarkOnlyThis); | 938 child->setChildNeedsLayout(MarkOnlyThis); |
| 945 } | 939 } |
| 946 } | 940 } |
| 947 | 941 |
| 948 ItemPosition RenderFlexibleBox::alignmentForChild(RenderBox* child) const | 942 ItemPosition RenderFlexibleBox::alignmentForChild(RenderBox* child) const |
| 949 { | 943 { |
| 950 ItemPosition align = resolveAlignment(style(), child->style()); | 944 ItemPosition align = resolveAlignment(style(), child->style()); |
| 951 | 945 |
| 952 if (align == ItemPositionBaseline && hasOrthogonalFlow(child)) | 946 if (align == ItemPositionBaseline && hasOrthogonalFlow(child)) |
| 953 align = ItemPositionFlexStart; | 947 align = ItemPositionFlexStart; |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 ASSERT(child); | 1329 ASSERT(child); |
| 1336 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; | 1330 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; |
| 1337 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; | 1331 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; |
| 1338 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; | 1332 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; |
| 1339 adjustAlignmentForChild(child, newOffset - originalOffset); | 1333 adjustAlignmentForChild(child, newOffset - originalOffset); |
| 1340 } | 1334 } |
| 1341 } | 1335 } |
| 1342 } | 1336 } |
| 1343 | 1337 |
| 1344 } | 1338 } |
| OLD | NEW |