| 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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 { | 516 { |
| 517 // If we have a horizontal flow, that means the main size is the width. | 517 // If we have a horizontal flow, that means the main size is the width. |
| 518 // That's the logical width for horizontal writing modes, and the logical he
ight in vertical writing modes. | 518 // That's the logical width for horizontal writing modes, and the logical he
ight in vertical writing modes. |
| 519 // For a vertical flow, main size is the height, so it's the inverse. | 519 // For a vertical flow, main size is the height, so it's the inverse. |
| 520 // So we need the logical width if we have a horizontal flow and horizontal
writing mode, or vertical flow and vertical writing mode. | 520 // So we need the logical width if we have a horizontal flow and horizontal
writing mode, or vertical flow and vertical writing mode. |
| 521 // Otherwise we need the logical height. | 521 // Otherwise we need the logical height. |
| 522 if (isHorizontalFlow() != child.styleRef().isHorizontalWritingMode()) { | 522 if (isHorizontalFlow() != child.styleRef().isHorizontalWritingMode()) { |
| 523 // We don't have to check for "auto" here - computeContentLogicalHeight
will just return -1 for that case anyway. | 523 // We don't have to check for "auto" here - computeContentLogicalHeight
will just return -1 for that case anyway. |
| 524 // It's safe to access scrollbarLogicalHeight here because computeNextFl
exLine will have already | 524 // It's safe to access scrollbarLogicalHeight here because computeNextFl
exLine will have already |
| 525 // forced layout on the child. | 525 // forced layout on the child. |
| 526 return child.computeContentLogicalHeight(sizeType, size, child.contentLo
gicalHeight()) + child.scrollbarLogicalHeight(); | 526 // We previously layed out the child if necessary (see computeNextFlexLi
ne and the call to childHasIntrinsicMainAxisSize) |
| 527 // so we can be sure that the two height calls here will return up-to-da
te data. |
| 528 return child.computeContentLogicalHeight(sizeType, size, child.intrinsic
ContentLogicalHeight()) + child.scrollbarLogicalHeight(); |
| 527 } | 529 } |
| 528 // computeLogicalWidth always re-computes the intrinsic widths. However, whe
n our logical width is auto, | 530 // computeLogicalWidth always re-computes the intrinsic widths. However, whe
n our logical width is auto, |
| 529 // we can just use our cached value. So let's do that here. (Compare code in
LayoutBlock::computePreferredLogicalWidths) | 531 // we can just use our cached value. So let's do that here. (Compare code in
LayoutBlock::computePreferredLogicalWidths) |
| 530 LayoutUnit borderAndPadding = child.borderAndPaddingLogicalWidth(); | 532 LayoutUnit borderAndPadding = child.borderAndPaddingLogicalWidth(); |
| 531 if (child.styleRef().logicalWidth().isAuto() && !hasAspectRatio(child)) { | 533 if (child.styleRef().logicalWidth().isAuto() && !hasAspectRatio(child)) { |
| 532 if (size.type() == MinContent) | 534 if (size.type() == MinContent) |
| 533 return child.minPreferredLogicalWidth() - borderAndPadding; | 535 return child.minPreferredLogicalWidth() - borderAndPadding; |
| 534 if (size.type() == MaxContent) | 536 if (size.type() == MaxContent) |
| 535 return child.maxPreferredLogicalWidth() - borderAndPadding; | 537 return child.maxPreferredLogicalWidth() - borderAndPadding; |
| 536 } | 538 } |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 LayoutUnit lineBreakLength = mainAxisContentExtent(LayoutUnit::max()); | 1228 LayoutUnit lineBreakLength = mainAxisContentExtent(LayoutUnit::max()); |
| 1227 | 1229 |
| 1228 bool lineHasInFlowItem = false; | 1230 bool lineHasInFlowItem = false; |
| 1229 | 1231 |
| 1230 for (LayoutBox* child = m_orderIterator.currentChild(); child; child = m_ord
erIterator.next()) { | 1232 for (LayoutBox* child = m_orderIterator.currentChild(); child; child = m_ord
erIterator.next()) { |
| 1231 if (child->isOutOfFlowPositioned()) { | 1233 if (child->isOutOfFlowPositioned()) { |
| 1232 orderedChildren.append(child); | 1234 orderedChildren.append(child); |
| 1233 continue; | 1235 continue; |
| 1234 } | 1236 } |
| 1235 | 1237 |
| 1236 // If this condition is true, then computeMainAxisExtentForChild will ca
ll child.contentLogicalHeight() | 1238 // If this condition is true, then computeMainAxisExtentForChild will ca
ll child.intrinsicContentLogicalHeight() |
| 1237 // and child.scrollbarLogicalHeight(), so if the child has intrinsic min
/max/preferred size, | 1239 // and child.scrollbarLogicalHeight(), so if the child has intrinsic min
/max/preferred size, |
| 1238 // run layout on it now to make sure its logical height and scroll bars
are up-to-date. | 1240 // run layout on it now to make sure its logical height and scroll bars
are up-to-date. |
| 1239 if (childHasIntrinsicMainAxisSize(*child) && child->needsLayout()) { | 1241 if (childHasIntrinsicMainAxisSize(*child) && child->needsLayout()) { |
| 1240 child->clearOverrideSize(); | 1242 child->clearOverrideSize(); |
| 1241 child->layoutIfNeeded(); | 1243 child->layoutIfNeeded(); |
| 1242 cacheChildMainSize(*child); | 1244 cacheChildMainSize(*child); |
| 1243 } | 1245 } |
| 1244 | 1246 |
| 1245 LayoutUnit childInnerFlexBaseSize = computeInnerFlexBaseSizeForChild(*ch
ild, relayoutChildren ? ForceLayout : LayoutIfNeeded); | 1247 LayoutUnit childInnerFlexBaseSize = computeInnerFlexBaseSizeForChild(*ch
ild, relayoutChildren ? ForceLayout : LayoutIfNeeded); |
| 1246 LayoutUnit childMainAxisMarginBorderPadding = mainAxisBorderAndPaddingEx
tentForChild(*child) | 1248 LayoutUnit childMainAxisMarginBorderPadding = mainAxisBorderAndPaddingEx
tentForChild(*child) |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1901 ASSERT(child); | 1903 ASSERT(child); |
| 1902 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; | 1904 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; |
| 1903 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; | 1905 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; |
| 1904 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; | 1906 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; |
| 1905 adjustAlignmentForChild(*child, newOffset - originalOffset); | 1907 adjustAlignmentForChild(*child, newOffset - originalOffset); |
| 1906 } | 1908 } |
| 1907 } | 1909 } |
| 1908 } | 1910 } |
| 1909 | 1911 |
| 1910 } // namespace blink | 1912 } // namespace blink |
| OLD | NEW |