OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 | 552 |
553 flexFraction = std::max(flexFraction, findFlexFactorUnitSize(tra
cks, span, direction, maxContentForChild(*gridItem, direction, sizingData.column
Tracks))); | 553 flexFraction = std::max(flexFraction, findFlexFactorUnitSize(tra
cks, span, direction, maxContentForChild(*gridItem, direction, sizingData.column
Tracks))); |
554 } | 554 } |
555 } | 555 } |
556 } | 556 } |
557 | 557 |
558 for (const auto& trackIndex : flexibleSizedTracksIndex) { | 558 for (const auto& trackIndex : flexibleSizedTracksIndex) { |
559 GridTrackSize trackSize = gridTrackSize(direction, trackIndex); | 559 GridTrackSize trackSize = gridTrackSize(direction, trackIndex); |
560 | 560 |
561 LayoutUnit oldBaseSize = tracks[trackIndex].baseSize(); | 561 LayoutUnit oldBaseSize = tracks[trackIndex].baseSize(); |
562 LayoutUnit baseSize = std::max<LayoutUnit>(oldBaseSize, flexFraction * t
rackSize.maxTrackBreadth().flex()); | 562 LayoutUnit baseSize = std::max(oldBaseSize, LayoutUnit(flexFraction * tr
ackSize.maxTrackBreadth().flex())); |
563 if (LayoutUnit increment = baseSize - oldBaseSize) { | 563 if (LayoutUnit increment = baseSize - oldBaseSize) { |
564 tracks[trackIndex].setBaseSize(baseSize); | 564 tracks[trackIndex].setBaseSize(baseSize); |
565 freeSpace -= increment; | 565 freeSpace -= increment; |
566 | 566 |
567 baseSizesWithoutMaximization += increment; | 567 baseSizesWithoutMaximization += increment; |
568 growthLimitsWithoutMaximization += increment; | 568 growthLimitsWithoutMaximization += increment; |
569 } | 569 } |
570 } | 570 } |
571 } | 571 } |
572 | 572 |
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1712 bool allowedToStretchChildAlongColumnAxis = hasAutoSizeInColumnAxis && !chil
dStyle.marginBeforeUsing(style()).isAuto() && !childStyle.marginAfterUsing(style
()).isAuto(); | 1712 bool allowedToStretchChildAlongColumnAxis = hasAutoSizeInColumnAxis && !chil
dStyle.marginBeforeUsing(style()).isAuto() && !childStyle.marginAfterUsing(style
()).isAuto(); |
1713 if (allowedToStretchChildAlongColumnAxis && ComputedStyle::resolveAlignment(
styleRef(), childStyle, ItemPositionStretch) == ItemPositionStretch) { | 1713 if (allowedToStretchChildAlongColumnAxis && ComputedStyle::resolveAlignment(
styleRef(), childStyle, ItemPositionStretch) == ItemPositionStretch) { |
1714 // TODO (lajava): If the child has orthogonal flow, then it already has
an override height set, so use it. | 1714 // TODO (lajava): If the child has orthogonal flow, then it already has
an override height set, so use it. |
1715 // TODO (lajava): grid track sizing and positioning do not support ortho
gonal modes yet. | 1715 // TODO (lajava): grid track sizing and positioning do not support ortho
gonal modes yet. |
1716 if (child.isHorizontalWritingMode() == isHorizontalMode) { | 1716 if (child.isHorizontalWritingMode() == isHorizontalMode) { |
1717 LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildB
eforeStretching(child.overrideContainingBlockContentLogicalHeight(), child); | 1717 LayoutUnit stretchedLogicalHeight = availableAlignmentSpaceForChildB
eforeStretching(child.overrideContainingBlockContentLogicalHeight(), child); |
1718 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinM
ax(stretchedLogicalHeight, LayoutUnit(-1)); | 1718 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinM
ax(stretchedLogicalHeight, LayoutUnit(-1)); |
1719 child.setOverrideLogicalContentHeight(desiredLogicalHeight - child.b
orderAndPaddingLogicalHeight()); | 1719 child.setOverrideLogicalContentHeight(desiredLogicalHeight - child.b
orderAndPaddingLogicalHeight()); |
1720 if (desiredLogicalHeight != child.logicalHeight()) { | 1720 if (desiredLogicalHeight != child.logicalHeight()) { |
1721 // TODO (lajava): Can avoid laying out here in some cases. See h
ttps://webkit.org/b/87905. | 1721 // TODO (lajava): Can avoid laying out here in some cases. See h
ttps://webkit.org/b/87905. |
1722 child.setLogicalHeight(0); | 1722 child.setLogicalHeight(LayoutUnit()); |
1723 child.setNeedsLayout(LayoutInvalidationReason::GridChanged); | 1723 child.setNeedsLayout(LayoutInvalidationReason::GridChanged); |
1724 } | 1724 } |
1725 } | 1725 } |
1726 } | 1726 } |
1727 } | 1727 } |
1728 | 1728 |
1729 // TODO(lajava): This logic is shared by LayoutFlexibleBox, so it should be move
d to LayoutBox. | 1729 // TODO(lajava): This logic is shared by LayoutFlexibleBox, so it should be move
d to LayoutBox. |
1730 bool LayoutGrid::hasAutoMarginsInColumnAxis(const LayoutBox& child) const | 1730 bool LayoutGrid::hasAutoMarginsInColumnAxis(const LayoutBox& child) const |
1731 { | 1731 { |
1732 if (isHorizontalWritingMode()) | 1732 if (isHorizontalWritingMode()) |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2072 | 2072 |
2073 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child)); | 2073 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child)); |
2074 } | 2074 } |
2075 | 2075 |
2076 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) const | 2076 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) const |
2077 { | 2077 { |
2078 GridPainter(*this).paintChildren(paintInfo, paintOffset); | 2078 GridPainter(*this).paintChildren(paintInfo, paintOffset); |
2079 } | 2079 } |
2080 | 2080 |
2081 } // namespace blink | 2081 } // namespace blink |
OLD | NEW |