| 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 24 matching lines...) Expand all  Loading... | 
| 35 #include "core/layout/TextAutosizer.h" | 35 #include "core/layout/TextAutosizer.h" | 
| 36 #include "core/paint/BlockPainter.h" | 36 #include "core/paint/BlockPainter.h" | 
| 37 #include "core/paint/PaintLayer.h" | 37 #include "core/paint/PaintLayer.h" | 
| 38 #include "core/style/ComputedStyle.h" | 38 #include "core/style/ComputedStyle.h" | 
| 39 #include "platform/LengthFunctions.h" | 39 #include "platform/LengthFunctions.h" | 
| 40 #include "wtf/MathExtras.h" | 40 #include "wtf/MathExtras.h" | 
| 41 #include <limits> | 41 #include <limits> | 
| 42 | 42 | 
| 43 namespace blink { | 43 namespace blink { | 
| 44 | 44 | 
|  | 45 static const ItemPosition selfAlignmentNormalBehavior = ItemPositionStretch; | 
|  | 46 | 
| 45 static bool hasAspectRatio(const LayoutBox& child) | 47 static bool hasAspectRatio(const LayoutBox& child) | 
| 46 { | 48 { | 
| 47     return child.isImage() || child.isCanvas() || child.isVideo(); | 49     return child.isImage() || child.isCanvas() || child.isVideo(); | 
| 48 } | 50 } | 
| 49 | 51 | 
| 50 struct LayoutFlexibleBox::LineContext { | 52 struct LayoutFlexibleBox::LineContext { | 
| 51     LineContext(LayoutUnit crossAxisOffset, LayoutUnit crossAxisExtent, size_t n
      umberOfChildren, LayoutUnit maxAscent) | 53     LineContext(LayoutUnit crossAxisOffset, LayoutUnit crossAxisExtent, size_t n
      umberOfChildren, LayoutUnit maxAscent) | 
| 52         : crossAxisOffset(crossAxisOffset) | 54         : crossAxisOffset(crossAxisOffset) | 
| 53         , crossAxisExtent(crossAxisExtent) | 55         , crossAxisExtent(crossAxisExtent) | 
| 54         , numberOfChildren(numberOfChildren) | 56         , numberOfChildren(numberOfChildren) | 
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 174 int LayoutFlexibleBox::baselinePosition(FontBaseline, bool, LineDirectionMode di
      rection, LinePositionMode mode) const | 176 int LayoutFlexibleBox::baselinePosition(FontBaseline, bool, LineDirectionMode di
      rection, LinePositionMode mode) const | 
| 175 { | 177 { | 
| 176     ASSERT(mode == PositionOnContainingLine); | 178     ASSERT(mode == PositionOnContainingLine); | 
| 177     int baseline = firstLineBoxBaseline(); | 179     int baseline = firstLineBoxBaseline(); | 
| 178     if (baseline == -1) | 180     if (baseline == -1) | 
| 179         baseline = synthesizedBaselineFromContentBox(*this, direction); | 181         baseline = synthesizedBaselineFromContentBox(*this, direction); | 
| 180 | 182 | 
| 181     return beforeMarginInLineDirection(direction) + baseline; | 183     return beforeMarginInLineDirection(direction) + baseline; | 
| 182 } | 184 } | 
| 183 | 185 | 
| 184 static const StyleContentAlignmentData& normalValueBehavior() | 186 static const StyleContentAlignmentData& contentAlignmentNormalBehavior() | 
| 185 { | 187 { | 
| 186     // The justify-content property applies along the main axis, but since flexi
      ng | 188     // The justify-content property applies along the main axis, but since flexi
      ng | 
| 187     // in the main axis is controlled by flex, stretch behaves as flex-start (ig
      noring | 189     // in the main axis is controlled by flex, stretch behaves as flex-start (ig
      noring | 
| 188     // the specified fallback alignment, if any). | 190     // the specified fallback alignment, if any). | 
| 189     // https://drafts.csswg.org/css-align/#distribution-flex | 191     // https://drafts.csswg.org/css-align/#distribution-flex | 
| 190     static const StyleContentAlignmentData normalBehavior = {ContentPositionNorm
      al, ContentDistributionStretch}; | 192     static const StyleContentAlignmentData normalBehavior = {ContentPositionNorm
      al, ContentDistributionStretch}; | 
| 191     return normalBehavior; | 193     return normalBehavior; | 
| 192 } | 194 } | 
| 193 | 195 | 
| 194 int LayoutFlexibleBox::firstLineBoxBaseline() const | 196 int LayoutFlexibleBox::firstLineBoxBaseline() const | 
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 298         return flexDirection == (style()->isLeftToRightDirection() ? FlowRowReve
      rse : FlowRow); | 300         return flexDirection == (style()->isLeftToRightDirection() ? FlowRowReve
      rse : FlowRow); | 
| 299     return flexDirection == FlowColumnReverse; | 301     return flexDirection == FlowColumnReverse; | 
| 300 } | 302 } | 
| 301 | 303 | 
| 302 void LayoutFlexibleBox::removeChild(LayoutObject* child) | 304 void LayoutFlexibleBox::removeChild(LayoutObject* child) | 
| 303 { | 305 { | 
| 304     LayoutBlock::removeChild(child); | 306     LayoutBlock::removeChild(child); | 
| 305     m_intrinsicSizeAlongMainAxis.remove(child); | 307     m_intrinsicSizeAlongMainAxis.remove(child); | 
| 306 } | 308 } | 
| 307 | 309 | 
| 308 void LayoutFlexibleBox::styleDidChange(StyleDifference diff, const ComputedStyle
      * oldStyle) |  | 
| 309 { |  | 
| 310     LayoutBlock::styleDidChange(diff, oldStyle); |  | 
| 311 |  | 
| 312     if (oldStyle && oldStyle->alignItemsPosition() == ItemPositionStretch && dif
      f.needsFullLayout()) { |  | 
| 313         // Flex items that were previously stretching need to be relayed out so 
      we can compute new available cross axis space. |  | 
| 314         // This is only necessary for stretching since other alignment values do
      n't change the size of the box. |  | 
| 315         for (LayoutBox* child = firstChildBox(); child; child = child->nextSibli
      ngBox()) { |  | 
| 316             ItemPosition previousAlignment = ComputedStyle::resolveAlignment(*ol
      dStyle, child->styleRef(), ItemPositionStretch); |  | 
| 317             if (previousAlignment == ItemPositionStretch && previousAlignment !=
       ComputedStyle::resolveAlignment(styleRef(), child->styleRef(), ItemPositionStre
      tch)) |  | 
| 318                 child->setChildNeedsLayout(MarkOnlyThis); |  | 
| 319         } |  | 
| 320     } |  | 
| 321 } |  | 
| 322 |  | 
| 323 void LayoutFlexibleBox::layoutBlock(bool relayoutChildren) | 310 void LayoutFlexibleBox::layoutBlock(bool relayoutChildren) | 
| 324 { | 311 { | 
| 325     ASSERT(needsLayout()); | 312     ASSERT(needsLayout()); | 
| 326 | 313 | 
| 327     if (!relayoutChildren && simplifiedLayout()) | 314     if (!relayoutChildren && simplifiedLayout()) | 
| 328         return; | 315         return; | 
| 329 | 316 | 
| 330     m_relaidOutChildren.clear(); | 317     m_relaidOutChildren.clear(); | 
| 331 | 318 | 
| 332     if (updateLogicalWidthAndColumnWidth()) | 319     if (updateLogicalWidthAndColumnWidth()) | 
| (...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1364         if (justifyContentDistribution == ContentDistributionSpaceAround) | 1351         if (justifyContentDistribution == ContentDistributionSpaceAround) | 
| 1365             return availableFreeSpace / numberOfChildren; | 1352             return availableFreeSpace / numberOfChildren; | 
| 1366     } | 1353     } | 
| 1367     return LayoutUnit(); | 1354     return LayoutUnit(); | 
| 1368 } | 1355 } | 
| 1369 | 1356 | 
| 1370 static LayoutUnit alignmentOffset(LayoutUnit availableFreeSpace, ItemPosition po
      sition, LayoutUnit ascent, LayoutUnit maxAscent, bool isWrapReverse) | 1357 static LayoutUnit alignmentOffset(LayoutUnit availableFreeSpace, ItemPosition po
      sition, LayoutUnit ascent, LayoutUnit maxAscent, bool isWrapReverse) | 
| 1371 { | 1358 { | 
| 1372     switch (position) { | 1359     switch (position) { | 
| 1373     case ItemPositionAuto: | 1360     case ItemPositionAuto: | 
|  | 1361     case ItemPositionNormal: | 
| 1374         ASSERT_NOT_REACHED(); | 1362         ASSERT_NOT_REACHED(); | 
| 1375         break; | 1363         break; | 
| 1376     case ItemPositionStretch: | 1364     case ItemPositionStretch: | 
| 1377         // Actual stretching must be handled by the caller. | 1365         // Actual stretching must be handled by the caller. | 
| 1378         // Since wrap-reverse flips cross start and cross end, stretch children 
      should be aligned with the cross end. | 1366         // Since wrap-reverse flips cross start and cross end, stretch children 
      should be aligned with the cross end. | 
| 1379         // This matters because applyStretchAlignment doesn't always stretch or 
      stretch fully (explicit cross size given, | 1367         // This matters because applyStretchAlignment doesn't always stretch or 
      stretch fully (explicit cross size given, | 
| 1380         // or stretching constrained by max-height/max-width). | 1368         // or stretching constrained by max-height/max-width). | 
| 1381         // For flex-start and flex-end this is handled by alignmentForChild(). | 1369         // For flex-start and flex-end this is handled by alignmentForChild(). | 
| 1382         if (isWrapReverse) | 1370         if (isWrapReverse) | 
| 1383             return availableFreeSpace; | 1371             return availableFreeSpace; | 
| (...skipping 28 matching lines...) Expand all  Loading... | 
| 1412     if (hasOrthogonalFlow(child)) | 1400     if (hasOrthogonalFlow(child)) | 
| 1413         child.setOverrideLogicalContentHeight(childPreferredSize - child.borderA
      ndPaddingLogicalHeight()); | 1401         child.setOverrideLogicalContentHeight(childPreferredSize - child.borderA
      ndPaddingLogicalHeight()); | 
| 1414     else | 1402     else | 
| 1415         child.setOverrideLogicalContentWidth(childPreferredSize - child.borderAn
      dPaddingLogicalWidth()); | 1403         child.setOverrideLogicalContentWidth(childPreferredSize - child.borderAn
      dPaddingLogicalWidth()); | 
| 1416 } | 1404 } | 
| 1417 | 1405 | 
| 1418 LayoutUnit LayoutFlexibleBox::staticMainAxisPositionForPositionedChild(const Lay
      outBox& child) | 1406 LayoutUnit LayoutFlexibleBox::staticMainAxisPositionForPositionedChild(const Lay
      outBox& child) | 
| 1419 { | 1407 { | 
| 1420     const LayoutUnit availableSpace = mainAxisContentExtent(contentLogicalHeight
      ()) - mainAxisExtentForChild(child); | 1408     const LayoutUnit availableSpace = mainAxisContentExtent(contentLogicalHeight
      ()) - mainAxisExtentForChild(child); | 
| 1421 | 1409 | 
| 1422     ContentPosition position = styleRef().resolvedJustifyContentPosition(normalV
      alueBehavior()); | 1410     ContentPosition position = styleRef().resolvedJustifyContentPosition(content
      AlignmentNormalBehavior()); | 
| 1423     ContentDistributionType distribution = styleRef().resolvedJustifyContentDist
      ribution(normalValueBehavior()); | 1411     ContentDistributionType distribution = styleRef().resolvedJustifyContentDist
      ribution(contentAlignmentNormalBehavior()); | 
| 1424     LayoutUnit offset = initialJustifyContentOffset(availableSpace, position, di
      stribution, 1); | 1412     LayoutUnit offset = initialJustifyContentOffset(availableSpace, position, di
      stribution, 1); | 
| 1425     if (styleRef().flexDirection() == FlowRowReverse || styleRef().flexDirection
      () == FlowColumnReverse) | 1413     if (styleRef().flexDirection() == FlowRowReverse || styleRef().flexDirection
      () == FlowColumnReverse) | 
| 1426         offset = availableSpace - offset; | 1414         offset = availableSpace - offset; | 
| 1427     return offset; | 1415     return offset; | 
| 1428 } | 1416 } | 
| 1429 | 1417 | 
| 1430 LayoutUnit LayoutFlexibleBox::staticCrossAxisPositionForPositionedChild(const La
      youtBox& child) | 1418 LayoutUnit LayoutFlexibleBox::staticCrossAxisPositionForPositionedChild(const La
      youtBox& child) | 
| 1431 { | 1419 { | 
| 1432     LayoutUnit availableSpace = crossAxisContentExtent() - crossAxisExtentForChi
      ld(child); | 1420     LayoutUnit availableSpace = crossAxisContentExtent() - crossAxisExtentForChi
      ld(child); | 
| 1433     return alignmentOffset(availableSpace, alignmentForChild(child), LayoutUnit(
      ), LayoutUnit(), styleRef().flexWrap() == FlexWrapReverse); | 1421     return alignmentOffset(availableSpace, alignmentForChild(child), LayoutUnit(
      ), LayoutUnit(), styleRef().flexWrap() == FlexWrapReverse); | 
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1485     LayoutUnit staticBlockPosition = flowAwareBorderBefore() + flowAwarePaddingB
      efore(); | 1473     LayoutUnit staticBlockPosition = flowAwareBorderBefore() + flowAwarePaddingB
      efore(); | 
| 1486     if (childLayer->staticBlockPosition() != staticBlockPosition) { | 1474     if (childLayer->staticBlockPosition() != staticBlockPosition) { | 
| 1487         childLayer->setStaticBlockPosition(staticBlockPosition); | 1475         childLayer->setStaticBlockPosition(staticBlockPosition); | 
| 1488         if (child.style()->hasStaticBlockPosition(style()->isHorizontalWritingMo
      de())) | 1476         if (child.style()->hasStaticBlockPosition(style()->isHorizontalWritingMo
      de())) | 
| 1489             child.setChildNeedsLayout(MarkOnlyThis); | 1477             child.setChildNeedsLayout(MarkOnlyThis); | 
| 1490     } | 1478     } | 
| 1491 } | 1479 } | 
| 1492 | 1480 | 
| 1493 ItemPosition LayoutFlexibleBox::alignmentForChild(const LayoutBox& child) const | 1481 ItemPosition LayoutFlexibleBox::alignmentForChild(const LayoutBox& child) const | 
| 1494 { | 1482 { | 
| 1495     ItemPosition align = ComputedStyle::resolveAlignment(styleRef(), child.style
      Ref(), ItemPositionStretch); | 1483     ItemPosition align = child.styleRef().resolvedAlignSelf(selfAlignmentNormalB
      ehavior).position(); | 
|  | 1484     DCHECK(align != ItemPositionAuto && align != ItemPositionNormal); | 
| 1496 | 1485 | 
| 1497     if (align == ItemPositionBaseline && hasOrthogonalFlow(child)) | 1486     if (align == ItemPositionBaseline && hasOrthogonalFlow(child)) | 
| 1498         align = ItemPositionFlexStart; | 1487         align = ItemPositionFlexStart; | 
| 1499 | 1488 | 
| 1500     if (style()->flexWrap() == FlexWrapReverse) { | 1489     if (style()->flexWrap() == FlexWrapReverse) { | 
| 1501         if (align == ItemPositionFlexStart) | 1490         if (align == ItemPositionFlexStart) | 
| 1502             align = ItemPositionFlexEnd; | 1491             align = ItemPositionFlexEnd; | 
| 1503         else if (align == ItemPositionFlexEnd) | 1492         else if (align == ItemPositionFlexEnd) | 
| 1504             align = ItemPositionFlexStart; | 1493             align = ItemPositionFlexStart; | 
| 1505     } | 1494     } | 
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1578 { | 1567 { | 
| 1579     if (isHorizontalFlow()) | 1568     if (isHorizontalFlow()) | 
| 1580         return child.styleRef().overflowY(); | 1569         return child.styleRef().overflowY(); | 
| 1581     return child.styleRef().overflowX(); | 1570     return child.styleRef().overflowX(); | 
| 1582 } | 1571 } | 
| 1583 | 1572 | 
| 1584 void LayoutFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons
      t OrderedFlexItemList& children, const Vector<LayoutUnit, 16>& childSizes, Layou
      tUnit availableFreeSpace, bool relayoutChildren, SubtreeLayoutScope& layoutScope
      , Vector<LineContext>& lineContexts) | 1573 void LayoutFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons
      t OrderedFlexItemList& children, const Vector<LayoutUnit, 16>& childSizes, Layou
      tUnit availableFreeSpace, bool relayoutChildren, SubtreeLayoutScope& layoutScope
      , Vector<LineContext>& lineContexts) | 
| 1585 { | 1574 { | 
| 1586     ASSERT(childSizes.size() == children.size()); | 1575     ASSERT(childSizes.size() == children.size()); | 
| 1587 | 1576 | 
| 1588     ContentPosition position = styleRef().resolvedJustifyContentPosition(normalV
      alueBehavior()); | 1577     ContentPosition position = styleRef().resolvedJustifyContentPosition(content
      AlignmentNormalBehavior()); | 
| 1589     ContentDistributionType distribution = styleRef().resolvedJustifyContentDist
      ribution(normalValueBehavior()); | 1578     ContentDistributionType distribution = styleRef().resolvedJustifyContentDist
      ribution(contentAlignmentNormalBehavior()); | 
| 1590 | 1579 | 
| 1591     size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren(
      children); | 1580     size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren(
      children); | 
| 1592     LayoutUnit autoMarginOffset = autoMarginOffsetInMainAxis(children, available
      FreeSpace); | 1581     LayoutUnit autoMarginOffset = autoMarginOffsetInMainAxis(children, available
      FreeSpace); | 
| 1593     LayoutUnit mainAxisOffset = flowAwareBorderStart() + flowAwarePaddingStart()
      ; | 1582     LayoutUnit mainAxisOffset = flowAwareBorderStart() + flowAwarePaddingStart()
      ; | 
| 1594     mainAxisOffset += initialJustifyContentOffset(availableFreeSpace, position, 
      distribution, numberOfChildrenForJustifyContent); | 1583     mainAxisOffset += initialJustifyContentOffset(availableFreeSpace, position, 
      distribution, numberOfChildrenForJustifyContent); | 
| 1595     if (style()->flexDirection() == FlowRowReverse && shouldPlaceBlockDirectionS
      crollbarOnLogicalLeft()) | 1584     if (style()->flexDirection() == FlowRowReverse && shouldPlaceBlockDirectionS
      crollbarOnLogicalLeft()) | 
| 1596         mainAxisOffset += isHorizontalFlow() ? verticalScrollbarWidth() : horizo
      ntalScrollbarHeight(); | 1585         mainAxisOffset += isHorizontalFlow() ? verticalScrollbarWidth() : horizo
      ntalScrollbarHeight(); | 
| 1597 | 1586 | 
| 1598     LayoutUnit totalMainExtent = mainAxisExtent(); | 1587     LayoutUnit totalMainExtent = mainAxisExtent(); | 
| 1599     if (!shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | 1588     if (!shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | 
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1680     } | 1669     } | 
| 1681 | 1670 | 
| 1682     if (m_numberOfInFlowChildrenOnFirstLine == -1) | 1671     if (m_numberOfInFlowChildrenOnFirstLine == -1) | 
| 1683         m_numberOfInFlowChildrenOnFirstLine = seenInFlowPositionedChildren; | 1672         m_numberOfInFlowChildrenOnFirstLine = seenInFlowPositionedChildren; | 
| 1684     lineContexts.append(LineContext(crossAxisOffset, maxChildCrossAxisExtent, ch
      ildren.size(), maxAscent)); | 1673     lineContexts.append(LineContext(crossAxisOffset, maxChildCrossAxisExtent, ch
      ildren.size(), maxAscent)); | 
| 1685     crossAxisOffset += maxChildCrossAxisExtent; | 1674     crossAxisOffset += maxChildCrossAxisExtent; | 
| 1686 } | 1675 } | 
| 1687 | 1676 | 
| 1688 void LayoutFlexibleBox::layoutColumnReverse(const OrderedFlexItemList& children,
       LayoutUnit crossAxisOffset, LayoutUnit availableFreeSpace) | 1677 void LayoutFlexibleBox::layoutColumnReverse(const OrderedFlexItemList& children,
       LayoutUnit crossAxisOffset, LayoutUnit availableFreeSpace) | 
| 1689 { | 1678 { | 
| 1690     ContentPosition position = styleRef().resolvedJustifyContentPosition(normalV
      alueBehavior()); | 1679     ContentPosition position = styleRef().resolvedJustifyContentPosition(content
      AlignmentNormalBehavior()); | 
| 1691     ContentDistributionType distribution = styleRef().resolvedJustifyContentDist
      ribution(normalValueBehavior()); | 1680     ContentDistributionType distribution = styleRef().resolvedJustifyContentDist
      ribution(contentAlignmentNormalBehavior()); | 
| 1692 | 1681 | 
| 1693     // This is similar to the logic in layoutAndPlaceChildren, except we place t
      he children | 1682     // This is similar to the logic in layoutAndPlaceChildren, except we place t
      he children | 
| 1694     // starting from the end of the flexbox. We also don't need to layout anythi
      ng since we're | 1683     // starting from the end of the flexbox. We also don't need to layout anythi
      ng since we're | 
| 1695     // just moving the children to a new position. | 1684     // just moving the children to a new position. | 
| 1696     size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren(
      children); | 1685     size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren(
      children); | 
| 1697     LayoutUnit mainAxisOffset = logicalHeight() - flowAwareBorderEnd() - flowAwa
      rePaddingEnd(); | 1686     LayoutUnit mainAxisOffset = logicalHeight() - flowAwareBorderEnd() - flowAwa
      rePaddingEnd(); | 
| 1698     mainAxisOffset -= initialJustifyContentOffset(availableFreeSpace, position, 
      distribution, numberOfChildrenForJustifyContent); | 1687     mainAxisOffset -= initialJustifyContentOffset(availableFreeSpace, position, 
      distribution, numberOfChildrenForJustifyContent); | 
| 1699     mainAxisOffset -= isHorizontalFlow() ? verticalScrollbarWidth() : horizontal
      ScrollbarHeight(); | 1688     mainAxisOffset -= isHorizontalFlow() ? verticalScrollbarWidth() : horizontal
      ScrollbarHeight(); | 
| 1700 | 1689 | 
| 1701     size_t seenInFlowPositionedChildren = 0; | 1690     size_t seenInFlowPositionedChildren = 0; | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1740         if (alignContentDistribution == ContentDistributionSpaceBetween) | 1729         if (alignContentDistribution == ContentDistributionSpaceBetween) | 
| 1741             return availableFreeSpace / (numberOfLines - 1); | 1730             return availableFreeSpace / (numberOfLines - 1); | 
| 1742         if (alignContentDistribution == ContentDistributionSpaceAround || alignC
      ontentDistribution == ContentDistributionStretch) | 1731         if (alignContentDistribution == ContentDistributionSpaceAround || alignC
      ontentDistribution == ContentDistributionStretch) | 
| 1743             return availableFreeSpace / numberOfLines; | 1732             return availableFreeSpace / numberOfLines; | 
| 1744     } | 1733     } | 
| 1745     return LayoutUnit(); | 1734     return LayoutUnit(); | 
| 1746 } | 1735 } | 
| 1747 | 1736 | 
| 1748 void LayoutFlexibleBox::alignFlexLines(Vector<LineContext>& lineContexts) | 1737 void LayoutFlexibleBox::alignFlexLines(Vector<LineContext>& lineContexts) | 
| 1749 { | 1738 { | 
| 1750     ContentPosition position = styleRef().resolvedAlignContentPosition(normalVal
      ueBehavior()); | 1739     ContentPosition position = styleRef().resolvedAlignContentPosition(contentAl
      ignmentNormalBehavior()); | 
| 1751     ContentDistributionType distribution = styleRef().resolvedAlignContentDistri
      bution(normalValueBehavior()); | 1740     ContentDistributionType distribution = styleRef().resolvedAlignContentDistri
      bution(contentAlignmentNormalBehavior()); | 
| 1752 | 1741 | 
| 1753     // If we have a single line flexbox or a multiline line flexbox with only on
      e flex line, | 1742     // If we have a single line flexbox or a multiline line flexbox with only on
      e flex line, | 
| 1754     // the line height is all the available space. | 1743     // the line height is all the available space. | 
| 1755     // For flex-direction: row, this means we need to use the height, so we do t
      his after calling updateLogicalHeight. | 1744     // For flex-direction: row, this means we need to use the height, so we do t
      his after calling updateLogicalHeight. | 
| 1756     if (lineContexts.size() == 1) { | 1745     if (lineContexts.size() == 1) { | 
| 1757         lineContexts[0].crossAxisExtent = crossAxisContentExtent(); | 1746         lineContexts[0].crossAxisExtent = crossAxisContentExtent(); | 
| 1758         return; | 1747         return; | 
| 1759     } | 1748     } | 
| 1760 | 1749 | 
| 1761     if (position == ContentPositionFlexStart) | 1750     if (position == ContentPositionFlexStart) | 
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1903             ASSERT(child); | 1892             ASSERT(child); | 
| 1904             LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
      xtent; | 1893             LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
      xtent; | 
| 1905             LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
       - crossAxisStartEdge; | 1894             LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
       - crossAxisStartEdge; | 
| 1906             LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
      sExtent; | 1895             LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
      sExtent; | 
| 1907             adjustAlignmentForChild(*child, newOffset - originalOffset); | 1896             adjustAlignmentForChild(*child, newOffset - originalOffset); | 
| 1908         } | 1897         } | 
| 1909     } | 1898     } | 
| 1910 } | 1899 } | 
| 1911 | 1900 | 
| 1912 } // namespace blink | 1901 } // namespace blink | 
| OLD | NEW | 
|---|