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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) | 310 void LayoutFlexibleBox::styleDidChange(StyleDifference diff, const ComputedStyle
* oldStyle) |
309 { | 311 { |
310 LayoutBlock::styleDidChange(diff, oldStyle); | 312 LayoutBlock::styleDidChange(diff, oldStyle); |
311 | 313 |
312 if (oldStyle && oldStyle->alignItemsPosition() == ItemPositionStretch && dif
f.needsFullLayout()) { | 314 if (oldStyle && oldStyle->resolvedAlignItems(selfAlignmentNormalBehavior).po
sition() == ItemPositionStretch && diff.needsFullLayout()) { |
313 // Flex items that were previously stretching need to be relayed out so
we can compute new available cross axis space. | 315 // 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. | 316 // This is only necessary for stretching since other alignment values do
n't change the size of the box. |
| 317 const ComputedStyle& newStyle = styleRef(); |
315 for (LayoutBox* child = firstChildBox(); child; child = child->nextSibli
ngBox()) { | 318 for (LayoutBox* child = firstChildBox(); child; child = child->nextSibli
ngBox()) { |
316 ItemPosition previousAlignment = ComputedStyle::resolveAlignment(*ol
dStyle, child->styleRef(), ItemPositionStretch); | 319 const ComputedStyle& childStyle = child->styleRef(); |
317 if (previousAlignment == ItemPositionStretch && previousAlignment !=
ComputedStyle::resolveAlignment(styleRef(), child->styleRef(), ItemPositionStre
tch)) | 320 ItemPosition previousAlignment = childStyle.resolvedAlignSelf(*oldSt
yle, selfAlignmentNormalBehavior).position(); |
| 321 if (previousAlignment == ItemPositionStretch && previousAlignment !=
childStyle.resolvedAlignSelf(newStyle, selfAlignmentNormalBehavior).position()) |
318 child->setChildNeedsLayout(MarkOnlyThis); | 322 child->setChildNeedsLayout(MarkOnlyThis); |
319 } | 323 } |
320 } | 324 } |
321 } | 325 } |
322 | 326 |
323 void LayoutFlexibleBox::layoutBlock(bool relayoutChildren) | 327 void LayoutFlexibleBox::layoutBlock(bool relayoutChildren) |
324 { | 328 { |
325 ASSERT(needsLayout()); | 329 ASSERT(needsLayout()); |
326 | 330 |
327 if (!relayoutChildren && simplifiedLayout()) | 331 if (!relayoutChildren && simplifiedLayout()) |
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1364 if (justifyContentDistribution == ContentDistributionSpaceAround) | 1368 if (justifyContentDistribution == ContentDistributionSpaceAround) |
1365 return availableFreeSpace / numberOfChildren; | 1369 return availableFreeSpace / numberOfChildren; |
1366 } | 1370 } |
1367 return LayoutUnit(); | 1371 return LayoutUnit(); |
1368 } | 1372 } |
1369 | 1373 |
1370 static LayoutUnit alignmentOffset(LayoutUnit availableFreeSpace, ItemPosition po
sition, LayoutUnit ascent, LayoutUnit maxAscent, bool isWrapReverse) | 1374 static LayoutUnit alignmentOffset(LayoutUnit availableFreeSpace, ItemPosition po
sition, LayoutUnit ascent, LayoutUnit maxAscent, bool isWrapReverse) |
1371 { | 1375 { |
1372 switch (position) { | 1376 switch (position) { |
1373 case ItemPositionAuto: | 1377 case ItemPositionAuto: |
| 1378 case ItemPositionNormal: |
1374 ASSERT_NOT_REACHED(); | 1379 ASSERT_NOT_REACHED(); |
1375 break; | 1380 break; |
1376 case ItemPositionStretch: | 1381 case ItemPositionStretch: |
1377 // Actual stretching must be handled by the caller. | 1382 // 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. | 1383 // 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, | 1384 // This matters because applyStretchAlignment doesn't always stretch or
stretch fully (explicit cross size given, |
1380 // or stretching constrained by max-height/max-width). | 1385 // or stretching constrained by max-height/max-width). |
1381 // For flex-start and flex-end this is handled by alignmentForChild(). | 1386 // For flex-start and flex-end this is handled by alignmentForChild(). |
1382 if (isWrapReverse) | 1387 if (isWrapReverse) |
1383 return availableFreeSpace; | 1388 return availableFreeSpace; |
(...skipping 28 matching lines...) Expand all Loading... |
1412 if (hasOrthogonalFlow(child)) | 1417 if (hasOrthogonalFlow(child)) |
1413 child.setOverrideLogicalContentHeight(childPreferredSize - child.borderA
ndPaddingLogicalHeight()); | 1418 child.setOverrideLogicalContentHeight(childPreferredSize - child.borderA
ndPaddingLogicalHeight()); |
1414 else | 1419 else |
1415 child.setOverrideLogicalContentWidth(childPreferredSize - child.borderAn
dPaddingLogicalWidth()); | 1420 child.setOverrideLogicalContentWidth(childPreferredSize - child.borderAn
dPaddingLogicalWidth()); |
1416 } | 1421 } |
1417 | 1422 |
1418 LayoutUnit LayoutFlexibleBox::staticMainAxisPositionForPositionedChild(const Lay
outBox& child) | 1423 LayoutUnit LayoutFlexibleBox::staticMainAxisPositionForPositionedChild(const Lay
outBox& child) |
1419 { | 1424 { |
1420 const LayoutUnit availableSpace = mainAxisContentExtent(contentLogicalHeight
()) - mainAxisExtentForChild(child); | 1425 const LayoutUnit availableSpace = mainAxisContentExtent(contentLogicalHeight
()) - mainAxisExtentForChild(child); |
1421 | 1426 |
1422 ContentPosition position = styleRef().resolvedJustifyContentPosition(normalV
alueBehavior()); | 1427 ContentPosition position = styleRef().resolvedJustifyContentPosition(content
AlignmentNormalBehavior()); |
1423 ContentDistributionType distribution = styleRef().resolvedJustifyContentDist
ribution(normalValueBehavior()); | 1428 ContentDistributionType distribution = styleRef().resolvedJustifyContentDist
ribution(contentAlignmentNormalBehavior()); |
1424 LayoutUnit offset = initialJustifyContentOffset(availableSpace, position, di
stribution, 1); | 1429 LayoutUnit offset = initialJustifyContentOffset(availableSpace, position, di
stribution, 1); |
1425 if (styleRef().flexDirection() == FlowRowReverse || styleRef().flexDirection
() == FlowColumnReverse) | 1430 if (styleRef().flexDirection() == FlowRowReverse || styleRef().flexDirection
() == FlowColumnReverse) |
1426 offset = availableSpace - offset; | 1431 offset = availableSpace - offset; |
1427 return offset; | 1432 return offset; |
1428 } | 1433 } |
1429 | 1434 |
1430 LayoutUnit LayoutFlexibleBox::staticCrossAxisPositionForPositionedChild(const La
youtBox& child) | 1435 LayoutUnit LayoutFlexibleBox::staticCrossAxisPositionForPositionedChild(const La
youtBox& child) |
1431 { | 1436 { |
1432 LayoutUnit availableSpace = crossAxisContentExtent() - crossAxisExtentForChi
ld(child); | 1437 LayoutUnit availableSpace = crossAxisContentExtent() - crossAxisExtentForChi
ld(child); |
1433 return alignmentOffset(availableSpace, alignmentForChild(child), LayoutUnit(
), LayoutUnit(), styleRef().flexWrap() == FlexWrapReverse); | 1438 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(); | 1490 LayoutUnit staticBlockPosition = flowAwareBorderBefore() + flowAwarePaddingB
efore(); |
1486 if (childLayer->staticBlockPosition() != staticBlockPosition) { | 1491 if (childLayer->staticBlockPosition() != staticBlockPosition) { |
1487 childLayer->setStaticBlockPosition(staticBlockPosition); | 1492 childLayer->setStaticBlockPosition(staticBlockPosition); |
1488 if (child.style()->hasStaticBlockPosition(style()->isHorizontalWritingMo
de())) | 1493 if (child.style()->hasStaticBlockPosition(style()->isHorizontalWritingMo
de())) |
1489 child.setChildNeedsLayout(MarkOnlyThis); | 1494 child.setChildNeedsLayout(MarkOnlyThis); |
1490 } | 1495 } |
1491 } | 1496 } |
1492 | 1497 |
1493 ItemPosition LayoutFlexibleBox::alignmentForChild(const LayoutBox& child) const | 1498 ItemPosition LayoutFlexibleBox::alignmentForChild(const LayoutBox& child) const |
1494 { | 1499 { |
1495 ItemPosition align = ComputedStyle::resolveAlignment(styleRef(), child.style
Ref(), ItemPositionStretch); | 1500 ItemPosition align = child.styleRef().resolvedAlignSelf(styleRef(), selfAlig
nmentNormalBehavior).position(); |
| 1501 DCHECK(align != ItemPositionAuto && align != ItemPositionNormal); |
1496 | 1502 |
1497 if (align == ItemPositionBaseline && hasOrthogonalFlow(child)) | 1503 if (align == ItemPositionBaseline && hasOrthogonalFlow(child)) |
1498 align = ItemPositionFlexStart; | 1504 align = ItemPositionFlexStart; |
1499 | 1505 |
1500 if (style()->flexWrap() == FlexWrapReverse) { | 1506 if (style()->flexWrap() == FlexWrapReverse) { |
1501 if (align == ItemPositionFlexStart) | 1507 if (align == ItemPositionFlexStart) |
1502 align = ItemPositionFlexEnd; | 1508 align = ItemPositionFlexEnd; |
1503 else if (align == ItemPositionFlexEnd) | 1509 else if (align == ItemPositionFlexEnd) |
1504 align = ItemPositionFlexStart; | 1510 align = ItemPositionFlexStart; |
1505 } | 1511 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 { | 1584 { |
1579 if (isHorizontalFlow()) | 1585 if (isHorizontalFlow()) |
1580 return child.styleRef().overflowY(); | 1586 return child.styleRef().overflowY(); |
1581 return child.styleRef().overflowX(); | 1587 return child.styleRef().overflowX(); |
1582 } | 1588 } |
1583 | 1589 |
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) | 1590 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 { | 1591 { |
1586 ASSERT(childSizes.size() == children.size()); | 1592 ASSERT(childSizes.size() == children.size()); |
1587 | 1593 |
1588 ContentPosition position = styleRef().resolvedJustifyContentPosition(normalV
alueBehavior()); | 1594 ContentPosition position = styleRef().resolvedJustifyContentPosition(content
AlignmentNormalBehavior()); |
1589 ContentDistributionType distribution = styleRef().resolvedJustifyContentDist
ribution(normalValueBehavior()); | 1595 ContentDistributionType distribution = styleRef().resolvedJustifyContentDist
ribution(contentAlignmentNormalBehavior()); |
1590 | 1596 |
1591 size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren(
children); | 1597 size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren(
children); |
1592 LayoutUnit autoMarginOffset = autoMarginOffsetInMainAxis(children, available
FreeSpace); | 1598 LayoutUnit autoMarginOffset = autoMarginOffsetInMainAxis(children, available
FreeSpace); |
1593 LayoutUnit mainAxisOffset = flowAwareBorderStart() + flowAwarePaddingStart()
; | 1599 LayoutUnit mainAxisOffset = flowAwareBorderStart() + flowAwarePaddingStart()
; |
1594 mainAxisOffset += initialJustifyContentOffset(availableFreeSpace, position,
distribution, numberOfChildrenForJustifyContent); | 1600 mainAxisOffset += initialJustifyContentOffset(availableFreeSpace, position,
distribution, numberOfChildrenForJustifyContent); |
1595 if (style()->flexDirection() == FlowRowReverse && shouldPlaceBlockDirectionS
crollbarOnLogicalLeft()) | 1601 if (style()->flexDirection() == FlowRowReverse && shouldPlaceBlockDirectionS
crollbarOnLogicalLeft()) |
1596 mainAxisOffset += isHorizontalFlow() ? verticalScrollbarWidth() : horizo
ntalScrollbarHeight(); | 1602 mainAxisOffset += isHorizontalFlow() ? verticalScrollbarWidth() : horizo
ntalScrollbarHeight(); |
1597 | 1603 |
1598 LayoutUnit totalMainExtent = mainAxisExtent(); | 1604 LayoutUnit totalMainExtent = mainAxisExtent(); |
1599 if (!shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | 1605 if (!shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1680 } | 1686 } |
1681 | 1687 |
1682 if (m_numberOfInFlowChildrenOnFirstLine == -1) | 1688 if (m_numberOfInFlowChildrenOnFirstLine == -1) |
1683 m_numberOfInFlowChildrenOnFirstLine = seenInFlowPositionedChildren; | 1689 m_numberOfInFlowChildrenOnFirstLine = seenInFlowPositionedChildren; |
1684 lineContexts.append(LineContext(crossAxisOffset, maxChildCrossAxisExtent, ch
ildren.size(), maxAscent)); | 1690 lineContexts.append(LineContext(crossAxisOffset, maxChildCrossAxisExtent, ch
ildren.size(), maxAscent)); |
1685 crossAxisOffset += maxChildCrossAxisExtent; | 1691 crossAxisOffset += maxChildCrossAxisExtent; |
1686 } | 1692 } |
1687 | 1693 |
1688 void LayoutFlexibleBox::layoutColumnReverse(const OrderedFlexItemList& children,
LayoutUnit crossAxisOffset, LayoutUnit availableFreeSpace) | 1694 void LayoutFlexibleBox::layoutColumnReverse(const OrderedFlexItemList& children,
LayoutUnit crossAxisOffset, LayoutUnit availableFreeSpace) |
1689 { | 1695 { |
1690 ContentPosition position = styleRef().resolvedJustifyContentPosition(normalV
alueBehavior()); | 1696 ContentPosition position = styleRef().resolvedJustifyContentPosition(content
AlignmentNormalBehavior()); |
1691 ContentDistributionType distribution = styleRef().resolvedJustifyContentDist
ribution(normalValueBehavior()); | 1697 ContentDistributionType distribution = styleRef().resolvedJustifyContentDist
ribution(contentAlignmentNormalBehavior()); |
1692 | 1698 |
1693 // This is similar to the logic in layoutAndPlaceChildren, except we place t
he children | 1699 // 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 | 1700 // 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. | 1701 // just moving the children to a new position. |
1696 size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren(
children); | 1702 size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren(
children); |
1697 LayoutUnit mainAxisOffset = logicalHeight() - flowAwareBorderEnd() - flowAwa
rePaddingEnd(); | 1703 LayoutUnit mainAxisOffset = logicalHeight() - flowAwareBorderEnd() - flowAwa
rePaddingEnd(); |
1698 mainAxisOffset -= initialJustifyContentOffset(availableFreeSpace, position,
distribution, numberOfChildrenForJustifyContent); | 1704 mainAxisOffset -= initialJustifyContentOffset(availableFreeSpace, position,
distribution, numberOfChildrenForJustifyContent); |
1699 mainAxisOffset -= isHorizontalFlow() ? verticalScrollbarWidth() : horizontal
ScrollbarHeight(); | 1705 mainAxisOffset -= isHorizontalFlow() ? verticalScrollbarWidth() : horizontal
ScrollbarHeight(); |
1700 | 1706 |
1701 size_t seenInFlowPositionedChildren = 0; | 1707 size_t seenInFlowPositionedChildren = 0; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1740 if (alignContentDistribution == ContentDistributionSpaceBetween) | 1746 if (alignContentDistribution == ContentDistributionSpaceBetween) |
1741 return availableFreeSpace / (numberOfLines - 1); | 1747 return availableFreeSpace / (numberOfLines - 1); |
1742 if (alignContentDistribution == ContentDistributionSpaceAround || alignC
ontentDistribution == ContentDistributionStretch) | 1748 if (alignContentDistribution == ContentDistributionSpaceAround || alignC
ontentDistribution == ContentDistributionStretch) |
1743 return availableFreeSpace / numberOfLines; | 1749 return availableFreeSpace / numberOfLines; |
1744 } | 1750 } |
1745 return LayoutUnit(); | 1751 return LayoutUnit(); |
1746 } | 1752 } |
1747 | 1753 |
1748 void LayoutFlexibleBox::alignFlexLines(Vector<LineContext>& lineContexts) | 1754 void LayoutFlexibleBox::alignFlexLines(Vector<LineContext>& lineContexts) |
1749 { | 1755 { |
1750 ContentPosition position = styleRef().resolvedAlignContentPosition(normalVal
ueBehavior()); | 1756 ContentPosition position = styleRef().resolvedAlignContentPosition(contentAl
ignmentNormalBehavior()); |
1751 ContentDistributionType distribution = styleRef().resolvedAlignContentDistri
bution(normalValueBehavior()); | 1757 ContentDistributionType distribution = styleRef().resolvedAlignContentDistri
bution(contentAlignmentNormalBehavior()); |
1752 | 1758 |
1753 // If we have a single line flexbox or a multiline line flexbox with only on
e flex line, | 1759 // 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. | 1760 // 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. | 1761 // 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) { | 1762 if (lineContexts.size() == 1) { |
1757 lineContexts[0].crossAxisExtent = crossAxisContentExtent(); | 1763 lineContexts[0].crossAxisExtent = crossAxisContentExtent(); |
1758 return; | 1764 return; |
1759 } | 1765 } |
1760 | 1766 |
1761 if (position == ContentPositionFlexStart) | 1767 if (position == ContentPositionFlexStart) |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1903 ASSERT(child); | 1909 ASSERT(child); |
1904 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; | 1910 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; |
1905 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; | 1911 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; |
1906 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; | 1912 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; |
1907 adjustAlignmentForChild(*child, newOffset - originalOffset); | 1913 adjustAlignmentForChild(*child, newOffset - originalOffset); |
1908 } | 1914 } |
1909 } | 1915 } |
1910 } | 1916 } |
1911 | 1917 |
1912 } // namespace blink | 1918 } // namespace blink |
OLD | NEW |