Chromium Code Reviews| 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 // TODO(cbiesinger): Eventually we should support other types of sizes here | |
| 647 return (crossSize.isFixed() || crossSize.hasPercent()) && crossAxisLengthIsD efinite(child, crossSize); | |
| 648 } | |
| 649 | |
| 650 LayoutUnit LayoutFlexibleBox::computeMainSizeFromAspectRatioUsing(const LayoutBo x& child, Length crossSizeLength) const | |
| 651 { | |
| 652 ASSERT(hasAspectRatio(child)); | |
| 653 ASSERT(child.intrinsicSize().height() != 0); | |
| 654 | |
| 655 LayoutUnit crossSize; | |
| 656 if (crossSizeLength.isFixed()) { | |
| 657 crossSize = crossSizeLength.value(); | |
| 658 } else { | |
| 659 ASSERT(crossSizeLength.hasPercent()); | |
| 660 crossSize = hasOrthogonalFlow(child) ? | |
| 661 adjustBorderBoxLogicalWidthForBoxSizing(valueForLength(crossSizeLeng th, contentWidth())) : | |
| 662 child.computePercentageLogicalHeight(crossSizeLength); | |
| 663 } | |
| 664 | |
| 665 const LayoutSize& childIntrinsicSize = child.intrinsicSize(); | |
| 666 double ratio = childIntrinsicSize.width().toFloat() / childIntrinsicSize.hei ght().toFloat(); | |
| 667 if (isHorizontalFlow()) | |
| 668 return crossSize * ratio; | |
| 669 return crossSize / ratio; | |
| 670 } | |
| 671 | |
| 628 void LayoutFlexibleBox::setFlowAwareLocationForChild(LayoutBox& child, const Lay outPoint& location) | 672 void LayoutFlexibleBox::setFlowAwareLocationForChild(LayoutBox& child, const Lay outPoint& location) |
| 629 { | 673 { |
| 630 if (isHorizontalFlow()) | 674 if (isHorizontalFlow()) |
| 631 child.setLocationAndUpdateOverflowControlsIfNeeded(location); | 675 child.setLocationAndUpdateOverflowControlsIfNeeded(location); |
| 632 else | 676 else |
| 633 child.setLocationAndUpdateOverflowControlsIfNeeded(location.transposedPo int()); | 677 child.setLocationAndUpdateOverflowControlsIfNeeded(location.transposedPo int()); |
| 634 } | 678 } |
| 635 | 679 |
| 636 LayoutUnit LayoutFlexibleBox::mainAxisBorderAndPaddingExtentForChild(const Layou tBox& child) const | 680 LayoutUnit LayoutFlexibleBox::mainAxisBorderAndPaddingExtentForChild(const Layou tBox& child) const |
| 637 { | 681 { |
| 638 return isHorizontalFlow() ? child.borderAndPaddingWidth() : child.borderAndP addingHeight(); | 682 return isHorizontalFlow() ? child.borderAndPaddingWidth() : child.borderAndP addingHeight(); |
| 639 } | 683 } |
| 640 | 684 |
| 641 bool LayoutFlexibleBox::mainAxisLengthIsDefinite(const LayoutBox& child, const L ength& flexBasis) const | 685 bool LayoutFlexibleBox::mainAxisLengthIsDefinite(const LayoutBox& child, const L ength& flexBasis) const |
| 642 { | 686 { |
| 643 if (flexBasis.isAuto()) | 687 if (flexBasis.isAuto()) |
| 644 return false; | 688 return false; |
| 645 if (flexBasis.hasPercent()) { | 689 if (flexBasis.hasPercent()) { |
| 646 return isColumnFlow() ? | 690 return isColumnFlow() ? |
| 647 child.computePercentageLogicalHeight(flexBasis) != -1 : | 691 child.computePercentageLogicalHeight(flexBasis) != -1 : |
| 648 hasDefiniteLogicalWidth(); | 692 hasDefiniteLogicalWidth(); |
| 649 } | 693 } |
| 650 return true; | 694 return true; |
| 651 } | 695 } |
| 652 | 696 |
| 697 bool LayoutFlexibleBox::crossAxisLengthIsDefinite(const LayoutBox& child, const Length& length) const | |
| 698 { | |
| 699 if (length.isAuto()) | |
| 700 return false; | |
| 701 if (length.hasPercent()) { | |
| 702 return hasOrthogonalFlow(child) ? | |
| 703 hasDefiniteLogicalWidth() : | |
| 704 child.computePercentageLogicalHeight(length) != -1; | |
| 705 } | |
| 706 return true; | |
| 707 } | |
| 708 | |
| 653 bool LayoutFlexibleBox::childFlexBaseSizeRequiresLayout(const LayoutBox& child) const | 709 bool LayoutFlexibleBox::childFlexBaseSizeRequiresLayout(const LayoutBox& child) const |
| 654 { | 710 { |
| 655 return !mainAxisLengthIsDefinite(child, flexBasisForChild(child)) && ( | 711 return !mainAxisLengthIsDefinite(child, flexBasisForChild(child)) && ( |
| 656 hasOrthogonalFlow(child) || crossAxisOverflowForChild(child) == OAUTO); | 712 hasOrthogonalFlow(child) || crossAxisOverflowForChild(child) == OAUTO); |
| 657 } | 713 } |
| 658 | 714 |
| 659 LayoutUnit LayoutFlexibleBox::computeInnerFlexBaseSizeForChild(LayoutBox& child, ChildLayoutType childLayoutType) | 715 LayoutUnit LayoutFlexibleBox::computeInnerFlexBaseSizeForChild(LayoutBox& child, ChildLayoutType childLayoutType) |
| 660 { | 716 { |
| 661 child.clearOverrideSize(); | 717 child.clearOverrideSize(); |
| 662 | 718 |
| (...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 | 968 // computeMainAxisExtentForChild can return -1 when the child has a perc entage |
| 913 // min size, but we have an indefinite size in that axis. | 969 // min size, but we have an indefinite size in that axis. |
| 914 minExtent = std::max(LayoutUnit(), minExtent); | 970 minExtent = std::max(LayoutUnit(), minExtent); |
| 915 } else if (min.isAuto() && mainAxisOverflowForChild(child) == OVISIBLE && !( isColumnFlow() && child.isFlexibleBox())) { | 971 } 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 | 972 // 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 | 973 // to implement https://drafts.csswg.org/css-flexbox/#intrinsic-sizes be fore that produces |
| 918 // reasonable results. Tracking bug: https://crbug.com/581553 | 974 // reasonable results. Tracking bug: https://crbug.com/581553 |
| 919 // css-flexbox section 4.5 | 975 // css-flexbox section 4.5 |
| 920 LayoutUnit contentSize = computeMainAxisExtentForChild(child, MinSize, L ength(MinContent)); | 976 LayoutUnit contentSize = computeMainAxisExtentForChild(child, MinSize, L ength(MinContent)); |
| 921 ASSERT(contentSize >= 0); | 977 ASSERT(contentSize >= 0); |
| 978 if (hasAspectRatio(child) && child.intrinsicSize().height() > 0) | |
| 979 contentSize = adjustChildSizeForAspectRatioCrossAxisMinAndMax(child, contentSize); | |
| 922 if (maxExtent != -1 && contentSize > maxExtent) | 980 if (maxExtent != -1 && contentSize > maxExtent) |
| 923 contentSize = maxExtent; | 981 contentSize = maxExtent; |
| 924 | 982 |
| 925 Length mainSize = isHorizontalFlow() ? child.styleRef().width() : child. styleRef().height(); | 983 Length mainSize = isHorizontalFlow() ? child.styleRef().width() : child. styleRef().height(); |
| 926 if (mainAxisLengthIsDefinite(child, mainSize)) { | 984 if (mainAxisLengthIsDefinite(child, mainSize)) { |
| 927 LayoutUnit resolvedMainSize = computeMainAxisExtentForChild(child, M ainOrPreferredSize, mainSize); | 985 LayoutUnit resolvedMainSize = computeMainAxisExtentForChild(child, M ainOrPreferredSize, mainSize); |
| 928 ASSERT(resolvedMainSize >= 0); | 986 ASSERT(resolvedMainSize >= 0); |
| 929 LayoutUnit specifiedSize = maxExtent != -1 ? std::min(resolvedMainSi ze, maxExtent) : resolvedMainSize; | 987 LayoutUnit specifiedSize = maxExtent != -1 ? std::min(resolvedMainSi ze, maxExtent) : resolvedMainSize; |
| 930 | 988 |
| 931 minExtent = std::min(specifiedSize, contentSize); | 989 minExtent = std::min(specifiedSize, contentSize); |
| 990 } else if (useChildAspectRatio(child)) { | |
| 991 Length crossSizeLength = isHorizontalFlow() ? child.styleRef().heigh t() : child.styleRef().width(); | |
| 992 LayoutUnit transferredSize = computeMainSizeFromAspectRatioUsing(chi ld, crossSizeLength); | |
| 993 transferredSize = adjustChildSizeForAspectRatioCrossAxisMinAndMax(ch ild, transferredSize); | |
| 994 minExtent = std::min(transferredSize, contentSize); | |
| 932 } else { | 995 } else { |
| 933 minExtent = contentSize; | 996 minExtent = contentSize; |
| 934 } | 997 } |
| 935 // TODO(cbiesinger): Implement aspect ratio handling (here, transferred size) - crbug.com/249112 | |
| 936 } | 998 } |
| 937 ASSERT(minExtent >= 0); | 999 ASSERT(minExtent >= 0); |
| 938 return std::max(childSize, minExtent); | 1000 return std::max(childSize, minExtent); |
| 939 } | 1001 } |
| 940 | 1002 |
| 1003 LayoutUnit LayoutFlexibleBox::adjustChildSizeForAspectRatioCrossAxisMinAndMax(co nst LayoutBox& child, LayoutUnit childSize) | |
| 1004 { | |
| 1005 Length crossMin = isHorizontalFlow() ? child.style()->minHeight() : child.st yle()->minWidth(); | |
| 1006 Length crossMax = isHorizontalFlow() ? child.style()->maxHeight() : child.st yle()->maxWidth(); | |
| 1007 | |
| 1008 // TODO(cbiesinger): Eventually we should support other types of sizes here | |
| 1009 if ((crossMax.isFixed() || crossMax.hasPercent()) && crossAxisLengthIsDefini te(child, crossMax)) { | |
|
leviw_travelin_and_unemployed
2016/01/28 00:37:59
You check these same values in three places now. H
cbiesinger
2016/01/28 00:42:48
Fair point. I decided to just only allow fixed and
| |
| 1010 LayoutUnit maxValue = computeMainSizeFromAspectRatioUsing(child, crossMa x); | |
| 1011 childSize = std::min(maxValue, childSize); | |
| 1012 } | |
| 1013 | |
| 1014 // TODO(cbiesinger): Eventually we should support other types of sizes here | |
| 1015 if ((crossMin.isFixed() || crossMin.hasPercent()) && crossAxisLengthIsDefini te(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 |