| 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 { | 458 { |
| 459 // If we have a horizontal flow, that means the main size is the width. | 459 // If we have a horizontal flow, that means the main size is the width. |
| 460 // That's the logical width for horizontal writing modes, and the logical he
ight in vertical writing modes. | 460 // That's the logical width for horizontal writing modes, and the logical he
ight in vertical writing modes. |
| 461 // For a vertical flow, main size is the height, so it's the inverse. | 461 // For a vertical flow, main size is the height, so it's the inverse. |
| 462 // So we need the logical width if we have a horizontal flow and horizontal
writing mode, or vertical flow and vertical writing mode. | 462 // So we need the logical width if we have a horizontal flow and horizontal
writing mode, or vertical flow and vertical writing mode. |
| 463 // Otherwise we need the logical height. | 463 // Otherwise we need the logical height. |
| 464 if (isHorizontalFlow() != child.styleRef().isHorizontalWritingMode()) { | 464 if (isHorizontalFlow() != child.styleRef().isHorizontalWritingMode()) { |
| 465 // We don't have to check for "auto" here - computeContentLogicalHeight
will just return -1 for that case anyway. | 465 // We don't have to check for "auto" here - computeContentLogicalHeight
will just return -1 for that case anyway. |
| 466 // It's safe to access scrollbarLogicalHeight here because computeNextFl
exLine will have already | 466 // It's safe to access scrollbarLogicalHeight here because computeNextFl
exLine will have already |
| 467 // forced layout on the child. | 467 // forced layout on the child. |
| 468 return child.computeContentLogicalHeight(sizeType, size, child.contentLo
gicalHeight()) + child.scrollbarLogicalHeight(); | 468 // We previously layed out the child if necessary (see computeNextFlexLi
ne and the call to childHasIntrinsicMainAxisSize) |
| 469 // so we can be sure that the two height calls here will return up-to-da
te data. |
| 470 return child.computeContentLogicalHeight(sizeType, size, child.intrinsic
ContentLogicalHeight()) + child.scrollbarLogicalHeight(); |
| 469 } | 471 } |
| 470 // computeLogicalWidth always re-computes the intrinsic widths. However, whe
n our logical width is auto, | 472 // computeLogicalWidth always re-computes the intrinsic widths. However, whe
n our logical width is auto, |
| 471 // we can just use our cached value. So let's do that here. (Compare code in
LayoutBlock::computePreferredLogicalWidths) | 473 // we can just use our cached value. So let's do that here. (Compare code in
LayoutBlock::computePreferredLogicalWidths) |
| 472 LayoutUnit borderAndPadding = child.borderAndPaddingLogicalWidth(); | 474 LayoutUnit borderAndPadding = child.borderAndPaddingLogicalWidth(); |
| 473 if (child.styleRef().logicalWidth().isAuto() && !hasAspectRatio(child)) { | 475 if (child.styleRef().logicalWidth().isAuto() && !hasAspectRatio(child)) { |
| 474 if (size.type() == MinContent) | 476 if (size.type() == MinContent) |
| 475 return child.minPreferredLogicalWidth() - borderAndPadding; | 477 return child.minPreferredLogicalWidth() - borderAndPadding; |
| 476 if (size.type() == MaxContent) | 478 if (size.type() == MaxContent) |
| 477 return child.maxPreferredLogicalWidth() - borderAndPadding; | 479 return child.maxPreferredLogicalWidth() - borderAndPadding; |
| 478 } | 480 } |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 LayoutUnit lineBreakLength = mainAxisContentExtent(LayoutUnit::max()); | 1170 LayoutUnit lineBreakLength = mainAxisContentExtent(LayoutUnit::max()); |
| 1169 | 1171 |
| 1170 bool lineHasInFlowItem = false; | 1172 bool lineHasInFlowItem = false; |
| 1171 | 1173 |
| 1172 for (LayoutBox* child = m_orderIterator.currentChild(); child; child = m_ord
erIterator.next()) { | 1174 for (LayoutBox* child = m_orderIterator.currentChild(); child; child = m_ord
erIterator.next()) { |
| 1173 if (child->isOutOfFlowPositioned()) { | 1175 if (child->isOutOfFlowPositioned()) { |
| 1174 orderedChildren.append(child); | 1176 orderedChildren.append(child); |
| 1175 continue; | 1177 continue; |
| 1176 } | 1178 } |
| 1177 | 1179 |
| 1178 // If this condition is true, then computeMainAxisExtentForChild will ca
ll child.contentLogicalHeight() | 1180 // If this condition is true, then computeMainAxisExtentForChild will ca
ll child.intrinsicContentLogicalHeight() |
| 1179 // and child.scrollbarLogicalHeight(), so if the child has intrinsic min
/max/preferred size, | 1181 // and child.scrollbarLogicalHeight(), so if the child has intrinsic min
/max/preferred size, |
| 1180 // run layout on it now to make sure its logical height and scroll bars
are up-to-date. | 1182 // run layout on it now to make sure its logical height and scroll bars
are up-to-date. |
| 1181 if (childHasIntrinsicMainAxisSize(*child) && child->needsLayout()) { | 1183 if (childHasIntrinsicMainAxisSize(*child) && child->needsLayout()) { |
| 1182 child->clearOverrideSize(); | 1184 child->clearOverrideSize(); |
| 1183 child->layoutIfNeeded(); | 1185 child->layoutIfNeeded(); |
| 1184 cacheChildMainSize(*child); | 1186 cacheChildMainSize(*child); |
| 1185 } | 1187 } |
| 1186 | 1188 |
| 1187 LayoutUnit childInnerFlexBaseSize = computeInnerFlexBaseSizeForChild(*ch
ild, relayoutChildren ? ForceLayout : LayoutIfNeeded); | 1189 LayoutUnit childInnerFlexBaseSize = computeInnerFlexBaseSizeForChild(*ch
ild, relayoutChildren ? ForceLayout : LayoutIfNeeded); |
| 1188 LayoutUnit childMainAxisMarginBorderPadding = mainAxisBorderAndPaddingEx
tentForChild(*child) | 1190 LayoutUnit childMainAxisMarginBorderPadding = mainAxisBorderAndPaddingEx
tentForChild(*child) |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1786 ASSERT(child); | 1788 ASSERT(child); |
| 1787 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; | 1789 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; |
| 1788 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; | 1790 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; |
| 1789 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; | 1791 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; |
| 1790 adjustAlignmentForChild(*child, newOffset - originalOffset); | 1792 adjustAlignmentForChild(*child, newOffset - originalOffset); |
| 1791 } | 1793 } |
| 1792 } | 1794 } |
| 1793 } | 1795 } |
| 1794 | 1796 |
| 1795 } // namespace blink | 1797 } // namespace blink |
| OLD | NEW |