| 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 bool hasAspectRatio(const LayoutBox& child) |
| 46 { |
| 47 return child.isImage() || child.isCanvas() || child.isVideo(); |
| 48 } |
| 49 |
| 45 struct LayoutFlexibleBox::LineContext { | 50 struct LayoutFlexibleBox::LineContext { |
| 46 LineContext(LayoutUnit crossAxisOffset, LayoutUnit crossAxisExtent, size_t n
umberOfChildren, LayoutUnit maxAscent) | 51 LineContext(LayoutUnit crossAxisOffset, LayoutUnit crossAxisExtent, size_t n
umberOfChildren, LayoutUnit maxAscent) |
| 47 : crossAxisOffset(crossAxisOffset) | 52 : crossAxisOffset(crossAxisOffset) |
| 48 , crossAxisExtent(crossAxisExtent) | 53 , crossAxisExtent(crossAxisExtent) |
| 49 , numberOfChildren(numberOfChildren) | 54 , numberOfChildren(numberOfChildren) |
| 50 , maxAscent(maxAscent) | 55 , maxAscent(maxAscent) |
| 51 { | 56 { |
| 52 } | 57 } |
| 53 | 58 |
| 54 LayoutUnit crossAxisOffset; | 59 LayoutUnit crossAxisOffset; |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 // Otherwise we need the logical height. | 450 // Otherwise we need the logical height. |
| 446 if (isHorizontalFlow() != child.styleRef().isHorizontalWritingMode()) { | 451 if (isHorizontalFlow() != child.styleRef().isHorizontalWritingMode()) { |
| 447 // We don't have to check for "auto" here - computeContentLogicalHeight
will just return -1 for that case anyway. | 452 // We don't have to check for "auto" here - computeContentLogicalHeight
will just return -1 for that case anyway. |
| 448 // It's safe to access scrollbarLogicalHeight here because computeNextFl
exLine will have already | 453 // It's safe to access scrollbarLogicalHeight here because computeNextFl
exLine will have already |
| 449 // forced layout on the child. | 454 // forced layout on the child. |
| 450 return child.computeContentLogicalHeight(sizeType, size, child.contentLo
gicalHeight()) + child.scrollbarLogicalHeight(); | 455 return child.computeContentLogicalHeight(sizeType, size, child.contentLo
gicalHeight()) + child.scrollbarLogicalHeight(); |
| 451 } | 456 } |
| 452 // computeLogicalWidth always re-computes the intrinsic widths. However, whe
n our logical width is auto, | 457 // computeLogicalWidth always re-computes the intrinsic widths. However, whe
n our logical width is auto, |
| 453 // we can just use our cached value. So let's do that here. (Compare code in
LayoutBlock::computePreferredLogicalWidths) | 458 // we can just use our cached value. So let's do that here. (Compare code in
LayoutBlock::computePreferredLogicalWidths) |
| 454 LayoutUnit borderAndPadding = child.borderAndPaddingLogicalWidth(); | 459 LayoutUnit borderAndPadding = child.borderAndPaddingLogicalWidth(); |
| 455 if (child.styleRef().logicalWidth().isAuto()) { | 460 if (child.styleRef().logicalWidth().isAuto() && !hasAspectRatio(child)) { |
| 456 if (size.type() == MinContent) | 461 if (size.type() == MinContent) |
| 457 return child.minPreferredLogicalWidth() - borderAndPadding; | 462 return child.minPreferredLogicalWidth() - borderAndPadding; |
| 458 if (size.type() == MaxContent) | 463 if (size.type() == MaxContent) |
| 459 return child.maxPreferredLogicalWidth() - borderAndPadding; | 464 return child.maxPreferredLogicalWidth() - borderAndPadding; |
| 460 } | 465 } |
| 461 return child.computeLogicalWidthUsing(sizeType, size, contentLogicalWidth(),
this) - borderAndPadding; | 466 return child.computeLogicalWidthUsing(sizeType, size, contentLogicalWidth(),
this) - borderAndPadding; |
| 462 } | 467 } |
| 463 | 468 |
| 464 LayoutFlexibleBox::TransformedWritingMode LayoutFlexibleBox::transformedWritingM
ode() const | 469 LayoutFlexibleBox::TransformedWritingMode LayoutFlexibleBox::transformedWritingM
ode() const |
| 465 { | 470 { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 LayoutUnit LayoutFlexibleBox::crossAxisScrollbarExtentForChild(const LayoutBox&
child) const | 623 LayoutUnit LayoutFlexibleBox::crossAxisScrollbarExtentForChild(const LayoutBox&
child) const |
| 619 { | 624 { |
| 620 return isHorizontalFlow() ? child.horizontalScrollbarHeight() : child.vertic
alScrollbarWidth(); | 625 return isHorizontalFlow() ? child.horizontalScrollbarHeight() : child.vertic
alScrollbarWidth(); |
| 621 } | 626 } |
| 622 | 627 |
| 623 LayoutPoint LayoutFlexibleBox::flowAwareLocationForChild(const LayoutBox& child)
const | 628 LayoutPoint LayoutFlexibleBox::flowAwareLocationForChild(const LayoutBox& child)
const |
| 624 { | 629 { |
| 625 return isHorizontalFlow() ? child.location() : child.location().transposedPo
int(); | 630 return isHorizontalFlow() ? child.location() : child.location().transposedPo
int(); |
| 626 } | 631 } |
| 627 | 632 |
| 633 bool LayoutFlexibleBox::useChildAspectRatio(const LayoutBox& child) const |
| 634 { |
| 635 if (!hasAspectRatio(child)) |
| 636 return false; |
| 637 if (child.intrinsicSize().height() == 0) { |
| 638 // We can't compute a ratio in this case. |
| 639 return false; |
| 640 } |
| 641 Length crossSize; |
| 642 if (isHorizontalFlow()) |
| 643 crossSize = child.styleRef().height(); |
| 644 else |
| 645 crossSize = child.styleRef().width(); |
| 646 return crossAxisLengthIsDefinite(child, crossSize); |
| 647 } |
| 648 |
| 649 LayoutUnit LayoutFlexibleBox::computeMainSizeFromAspectRatioUsing(const LayoutBo
x& child, Length crossSizeLength) const |
| 650 { |
| 651 ASSERT(hasAspectRatio(child)); |
| 652 ASSERT(child.intrinsicSize().height() != 0); |
| 653 |
| 654 LayoutUnit crossSize; |
| 655 if (crossSizeLength.isFixed()) { |
| 656 crossSize = crossSizeLength.value(); |
| 657 } else { |
| 658 ASSERT(crossSizeLength.hasPercent()); |
| 659 crossSize = hasOrthogonalFlow(child) ? |
| 660 adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(crossSizeLeng
th, contentWidth())) : |
| 661 child.computePercentageLogicalHeight(crossSizeLength); |
| 662 } |
| 663 |
| 664 const LayoutSize& childIntrinsicSize = child.intrinsicSize(); |
| 665 double ratio = childIntrinsicSize.width().toFloat() / childIntrinsicSize.hei
ght().toFloat(); |
| 666 if (isHorizontalFlow()) |
| 667 return crossSize * ratio; |
| 668 return crossSize / ratio; |
| 669 } |
| 670 |
| 628 void LayoutFlexibleBox::setFlowAwareLocationForChild(LayoutBox& child, const Lay
outPoint& location) | 671 void LayoutFlexibleBox::setFlowAwareLocationForChild(LayoutBox& child, const Lay
outPoint& location) |
| 629 { | 672 { |
| 630 if (isHorizontalFlow()) | 673 if (isHorizontalFlow()) |
| 631 child.setLocationAndUpdateOverflowControlsIfNeeded(location); | 674 child.setLocationAndUpdateOverflowControlsIfNeeded(location); |
| 632 else | 675 else |
| 633 child.setLocationAndUpdateOverflowControlsIfNeeded(location.transposedPo
int()); | 676 child.setLocationAndUpdateOverflowControlsIfNeeded(location.transposedPo
int()); |
| 634 } | 677 } |
| 635 | 678 |
| 636 LayoutUnit LayoutFlexibleBox::mainAxisBorderAndPaddingExtentForChild(const Layou
tBox& child) const | 679 LayoutUnit LayoutFlexibleBox::mainAxisBorderAndPaddingExtentForChild(const Layou
tBox& child) const |
| 637 { | 680 { |
| 638 return isHorizontalFlow() ? child.borderAndPaddingWidth() : child.borderAndP
addingHeight(); | 681 return isHorizontalFlow() ? child.borderAndPaddingWidth() : child.borderAndP
addingHeight(); |
| 639 } | 682 } |
| 640 | 683 |
| 641 bool LayoutFlexibleBox::mainAxisLengthIsDefinite(const LayoutBox& child, const L
ength& flexBasis) const | 684 bool LayoutFlexibleBox::mainAxisLengthIsDefinite(const LayoutBox& child, const L
ength& flexBasis) const |
| 642 { | 685 { |
| 643 if (flexBasis.isAuto()) | 686 if (flexBasis.isAuto()) |
| 644 return false; | 687 return false; |
| 645 if (flexBasis.hasPercent()) { | 688 if (flexBasis.hasPercent()) { |
| 646 return isColumnFlow() ? | 689 return isColumnFlow() ? |
| 647 child.computePercentageLogicalHeight(flexBasis) != -1 : | 690 child.computePercentageLogicalHeight(flexBasis) != -1 : |
| 648 hasDefiniteLogicalWidth(); | 691 hasDefiniteLogicalWidth(); |
| 649 } | 692 } |
| 650 return true; | 693 return true; |
| 651 } | 694 } |
| 652 | 695 |
| 696 bool LayoutFlexibleBox::crossAxisLengthIsDefinite(const LayoutBox& child, const
Length& length) const |
| 697 { |
| 698 if (length.isAuto()) |
| 699 return false; |
| 700 if (length.hasPercent()) { |
| 701 return hasOrthogonalFlow(child) ? |
| 702 hasDefiniteLogicalWidth() : |
| 703 child.computePercentageLogicalHeight(length) != -1; |
| 704 } |
| 705 // TODO(cbiesinger): Eventually we should support other types of sizes here.
Requires updating |
| 706 // computeMainSizeFromAspectRatioUsing. |
| 707 return length.isFixed(); |
| 708 } |
| 709 |
| 653 bool LayoutFlexibleBox::childFlexBaseSizeRequiresLayout(const LayoutBox& child)
const | 710 bool LayoutFlexibleBox::childFlexBaseSizeRequiresLayout(const LayoutBox& child)
const |
| 654 { | 711 { |
| 655 return !mainAxisLengthIsDefinite(child, flexBasisForChild(child)) && ( | 712 return !mainAxisLengthIsDefinite(child, flexBasisForChild(child)) && ( |
| 656 hasOrthogonalFlow(child) || crossAxisOverflowForChild(child) == OAUTO); | 713 hasOrthogonalFlow(child) || crossAxisOverflowForChild(child) == OAUTO); |
| 657 } | 714 } |
| 658 | 715 |
| 659 LayoutUnit LayoutFlexibleBox::computeInnerFlexBaseSizeForChild(LayoutBox& child,
ChildLayoutType childLayoutType) | 716 LayoutUnit LayoutFlexibleBox::computeInnerFlexBaseSizeForChild(LayoutBox& child,
ChildLayoutType childLayoutType) |
| 660 { | 717 { |
| 661 child.clearOverrideSize(); | 718 child.clearOverrideSize(); |
| 662 | 719 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 // computeMainAxisExtentForChild can return -1 when the child has a perc
entage | 969 // computeMainAxisExtentForChild can return -1 when the child has a perc
entage |
| 913 // min size, but we have an indefinite size in that axis. | 970 // min size, but we have an indefinite size in that axis. |
| 914 minExtent = std::max(LayoutUnit(), minExtent); | 971 minExtent = std::max(LayoutUnit(), minExtent); |
| 915 } else if (min.isAuto() && mainAxisOverflowForChild(child) == OVISIBLE && !(
isColumnFlow() && child.isFlexibleBox())) { | 972 } else if (min.isAuto() && mainAxisOverflowForChild(child) == OVISIBLE && !(
isColumnFlow() && child.isFlexibleBox())) { |
| 916 // TODO(cbiesinger): For now, we do not handle min-height: auto for nest
ed column flexboxes. We need | 973 // TODO(cbiesinger): For now, we do not handle min-height: auto for nest
ed column flexboxes. We need |
| 917 // to implement https://drafts.csswg.org/css-flexbox/#intrinsic-sizes be
fore that produces | 974 // to implement https://drafts.csswg.org/css-flexbox/#intrinsic-sizes be
fore that produces |
| 918 // reasonable results. Tracking bug: https://crbug.com/581553 | 975 // reasonable results. Tracking bug: https://crbug.com/581553 |
| 919 // css-flexbox section 4.5 | 976 // css-flexbox section 4.5 |
| 920 LayoutUnit contentSize = computeMainAxisExtentForChild(child, MinSize, L
ength(MinContent)); | 977 LayoutUnit contentSize = computeMainAxisExtentForChild(child, MinSize, L
ength(MinContent)); |
| 921 ASSERT(contentSize >= 0); | 978 ASSERT(contentSize >= 0); |
| 979 if (hasAspectRatio(child) && child.intrinsicSize().height() > 0) |
| 980 contentSize = adjustChildSizeForAspectRatioCrossAxisMinAndMax(child,
contentSize); |
| 922 if (maxExtent != -1 && contentSize > maxExtent) | 981 if (maxExtent != -1 && contentSize > maxExtent) |
| 923 contentSize = maxExtent; | 982 contentSize = maxExtent; |
| 924 | 983 |
| 925 Length mainSize = isHorizontalFlow() ? child.styleRef().width() : child.
styleRef().height(); | 984 Length mainSize = isHorizontalFlow() ? child.styleRef().width() : child.
styleRef().height(); |
| 926 if (mainAxisLengthIsDefinite(child, mainSize)) { | 985 if (mainAxisLengthIsDefinite(child, mainSize)) { |
| 927 LayoutUnit resolvedMainSize = computeMainAxisExtentForChild(child, M
ainOrPreferredSize, mainSize); | 986 LayoutUnit resolvedMainSize = computeMainAxisExtentForChild(child, M
ainOrPreferredSize, mainSize); |
| 928 ASSERT(resolvedMainSize >= 0); | 987 ASSERT(resolvedMainSize >= 0); |
| 929 LayoutUnit specifiedSize = maxExtent != -1 ? std::min(resolvedMainSi
ze, maxExtent) : resolvedMainSize; | 988 LayoutUnit specifiedSize = maxExtent != -1 ? std::min(resolvedMainSi
ze, maxExtent) : resolvedMainSize; |
| 930 | 989 |
| 931 minExtent = std::min(specifiedSize, contentSize); | 990 minExtent = std::min(specifiedSize, contentSize); |
| 991 } else if (useChildAspectRatio(child)) { |
| 992 Length crossSizeLength = isHorizontalFlow() ? child.styleRef().heigh
t() : child.styleRef().width(); |
| 993 LayoutUnit transferredSize = computeMainSizeFromAspectRatioUsing(chi
ld, crossSizeLength); |
| 994 transferredSize = adjustChildSizeForAspectRatioCrossAxisMinAndMax(ch
ild, transferredSize); |
| 995 minExtent = std::min(transferredSize, contentSize); |
| 932 } else { | 996 } else { |
| 933 minExtent = contentSize; | 997 minExtent = contentSize; |
| 934 } | 998 } |
| 935 // TODO(cbiesinger): Implement aspect ratio handling (here, transferred
size) - crbug.com/249112 | |
| 936 } | 999 } |
| 937 ASSERT(minExtent >= 0); | 1000 ASSERT(minExtent >= 0); |
| 938 return std::max(childSize, minExtent); | 1001 return std::max(childSize, minExtent); |
| 939 } | 1002 } |
| 940 | 1003 |
| 1004 LayoutUnit LayoutFlexibleBox::adjustChildSizeForAspectRatioCrossAxisMinAndMax(co
nst LayoutBox& child, LayoutUnit childSize) |
| 1005 { |
| 1006 Length crossMin = isHorizontalFlow() ? child.style()->minHeight() : child.st
yle()->minWidth(); |
| 1007 Length crossMax = isHorizontalFlow() ? child.style()->maxHeight() : child.st
yle()->maxWidth(); |
| 1008 |
| 1009 |
| 1010 if (crossAxisLengthIsDefinite(child, crossMax)) { |
| 1011 LayoutUnit maxValue = computeMainSizeFromAspectRatioUsing(child, crossMa
x); |
| 1012 childSize = std::min(maxValue, childSize); |
| 1013 } |
| 1014 |
| 1015 if (crossAxisLengthIsDefinite(child, crossMin)) { |
| 1016 LayoutUnit minValue = computeMainSizeFromAspectRatioUsing(child, crossMi
n); |
| 1017 childSize = std::max(minValue, childSize); |
| 1018 } |
| 1019 |
| 1020 return childSize; |
| 1021 } |
| 1022 |
| 941 bool LayoutFlexibleBox::computeNextFlexLine(OrderedFlexItemList& orderedChildren
, LayoutUnit& sumFlexBaseSize, double& totalFlexGrow, double& totalFlexShrink, d
ouble& totalWeightedFlexShrink, LayoutUnit& sumHypotheticalMainSize, bool relayo
utChildren) | 1023 bool LayoutFlexibleBox::computeNextFlexLine(OrderedFlexItemList& orderedChildren
, LayoutUnit& sumFlexBaseSize, double& totalFlexGrow, double& totalFlexShrink, d
ouble& totalWeightedFlexShrink, LayoutUnit& sumHypotheticalMainSize, bool relayo
utChildren) |
| 942 { | 1024 { |
| 943 orderedChildren.clear(); | 1025 orderedChildren.clear(); |
| 944 sumFlexBaseSize = 0; | 1026 sumFlexBaseSize = 0; |
| 945 totalFlexGrow = totalFlexShrink = totalWeightedFlexShrink = 0; | 1027 totalFlexGrow = totalFlexShrink = totalWeightedFlexShrink = 0; |
| 946 sumHypotheticalMainSize = 0; | 1028 sumHypotheticalMainSize = 0; |
| 947 | 1029 |
| 948 if (!m_orderIterator.currentChild()) | 1030 if (!m_orderIterator.currentChild()) |
| 949 return false; | 1031 return false; |
| 950 | 1032 |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1170 // So the child will automatically stretch if our cross axis is the child's
inline axis. That's the case if: | 1252 // So the child will automatically stretch if our cross axis is the child's
inline axis. That's the case if: |
| 1171 // - We are horizontal and the child is in vertical writing mode | 1253 // - We are horizontal and the child is in vertical writing mode |
| 1172 // - We are vertical and the child is in horizontal writing mode | 1254 // - We are vertical and the child is in horizontal writing mode |
| 1173 // Otherwise, we need to stretch if the cross axis size is auto. | 1255 // Otherwise, we need to stretch if the cross axis size is auto. |
| 1174 if (alignmentForChild(child) != ItemPositionStretch) | 1256 if (alignmentForChild(child) != ItemPositionStretch) |
| 1175 return false; | 1257 return false; |
| 1176 | 1258 |
| 1177 if (isHorizontalFlow() != child.styleRef().isHorizontalWritingMode()) | 1259 if (isHorizontalFlow() != child.styleRef().isHorizontalWritingMode()) |
| 1178 return false; | 1260 return false; |
| 1179 | 1261 |
| 1262 // TODO(cbiesinger): what about indefinite percentage heights? |
| 1180 return isHorizontalFlow() ? child.styleRef().height().isAuto() : child.style
Ref().width().isAuto(); | 1263 return isHorizontalFlow() ? child.styleRef().height().isAuto() : child.style
Ref().width().isAuto(); |
| 1181 } | 1264 } |
| 1182 | 1265 |
| 1183 bool LayoutFlexibleBox::childHasIntrinsicMainAxisSize(const LayoutBox& child) co
nst | 1266 bool LayoutFlexibleBox::childHasIntrinsicMainAxisSize(const LayoutBox& child) co
nst |
| 1184 { | 1267 { |
| 1185 bool result = false; | 1268 bool result = false; |
| 1186 if (isHorizontalFlow() != child.styleRef().isHorizontalWritingMode()) { | 1269 if (isHorizontalFlow() != child.styleRef().isHorizontalWritingMode()) { |
| 1187 Length childFlexBasis = flexBasisForChild(child); | 1270 Length childFlexBasis = flexBasisForChild(child); |
| 1188 Length childMinSize = isHorizontalFlow() ? child.style()->minWidth() : c
hild.style()->minHeight(); | 1271 Length childMinSize = isHorizontalFlow() ? child.style()->minWidth() : c
hild.style()->minHeight(); |
| 1189 Length childMaxSize = isHorizontalFlow() ? child.style()->maxWidth() : c
hild.style()->maxHeight(); | 1272 Length childMaxSize = isHorizontalFlow() ? child.style()->maxWidth() : c
hild.style()->maxHeight(); |
| 1190 if (childFlexBasis.isIntrinsic() || childMinSize.isIntrinsicOrAuto() ||
childMaxSize.isIntrinsic()) | 1273 if (childFlexBasis.isIntrinsic() || childMinSize.isIntrinsicOrAuto() ||
childMaxSize.isIntrinsic()) |
| 1191 result = true; | 1274 result = true; |
| 1192 } | 1275 } |
| 1193 return result; | 1276 return result; |
| 1194 } | 1277 } |
| 1195 | 1278 |
| 1196 EOverflow LayoutFlexibleBox::mainAxisOverflowForChild(const LayoutBox& child) co
nst | 1279 EOverflow LayoutFlexibleBox::mainAxisOverflowForChild(const LayoutBox& child) co
nst |
| 1197 { | 1280 { |
| 1198 if (isHorizontalFlow()) | 1281 if (isHorizontalFlow()) |
| 1199 return child.styleRef().overflowX(); | 1282 return child.styleRef().overflowX(); |
| 1200 return child.styleRef().overflowY(); | 1283 return child.styleRef().overflowY(); |
| 1201 } | 1284 } |
| 1202 | 1285 |
| 1203 EOverflow LayoutFlexibleBox::crossAxisOverflowForChild(const LayoutBox& child) c
onst | 1286 EOverflow LayoutFlexibleBox::crossAxisOverflowForChild(const LayoutBox& child) c
onst |
| 1204 { | 1287 { |
| 1205 if (isHorizontalFlow()) | 1288 if (isHorizontalFlow()) |
| 1206 return child.styleRef().overflowY(); | 1289 return child.styleRef().overflowY(); |
| 1207 return child.styleRef().overflowX(); | 1290 return child.styleRef().overflowX(); |
| 1208 } | 1291 } |
| 1292 |
| 1209 void LayoutFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons
t OrderedFlexItemList& children, const Vector<LayoutUnit, 16>& childSizes, Layou
tUnit availableFreeSpace, bool relayoutChildren, SubtreeLayoutScope& layoutScope
, Vector<LineContext>& lineContexts) | 1293 void LayoutFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons
t OrderedFlexItemList& children, const Vector<LayoutUnit, 16>& childSizes, Layou
tUnit availableFreeSpace, bool relayoutChildren, SubtreeLayoutScope& layoutScope
, Vector<LineContext>& lineContexts) |
| 1210 { | 1294 { |
| 1211 ASSERT(childSizes.size() == children.size()); | 1295 ASSERT(childSizes.size() == children.size()); |
| 1212 | 1296 |
| 1213 size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren(
children); | 1297 size_t numberOfChildrenForJustifyContent = numberOfInFlowPositionedChildren(
children); |
| 1214 LayoutUnit autoMarginOffset = autoMarginOffsetInMainAxis(children, available
FreeSpace); | 1298 LayoutUnit autoMarginOffset = autoMarginOffsetInMainAxis(children, available
FreeSpace); |
| 1215 LayoutUnit mainAxisOffset = flowAwareBorderStart() + flowAwarePaddingStart()
; | 1299 LayoutUnit mainAxisOffset = flowAwareBorderStart() + flowAwarePaddingStart()
; |
| 1216 mainAxisOffset += initialJustifyContentOffset(availableFreeSpace, style()->j
ustifyContentPosition(), style()->justifyContentDistribution(), numberOfChildren
ForJustifyContent); | 1300 mainAxisOffset += initialJustifyContentOffset(availableFreeSpace, style()->j
ustifyContentPosition(), style()->justifyContentDistribution(), numberOfChildren
ForJustifyContent); |
| 1217 if (style()->flexDirection() == FlowRowReverse) | 1301 if (style()->flexDirection() == FlowRowReverse) |
| 1218 mainAxisOffset += isHorizontalFlow() ? verticalScrollbarWidth() : horizo
ntalScrollbarHeight(); | 1302 mainAxisOffset += isHorizontalFlow() ? verticalScrollbarWidth() : horizo
ntalScrollbarHeight(); |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 ASSERT(child); | 1629 ASSERT(child); |
| 1546 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; | 1630 LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisE
xtent; |
| 1547 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; | 1631 LayoutUnit originalOffset = lineContexts[lineNumber].crossAxisOffset
- crossAxisStartEdge; |
| 1548 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; | 1632 LayoutUnit newOffset = contentExtent - originalOffset - lineCrossAxi
sExtent; |
| 1549 adjustAlignmentForChild(*child, newOffset - originalOffset); | 1633 adjustAlignmentForChild(*child, newOffset - originalOffset); |
| 1550 } | 1634 } |
| 1551 } | 1635 } |
| 1552 } | 1636 } |
| 1553 | 1637 |
| 1554 } // namespace blink | 1638 } // namespace blink |
| OLD | NEW |