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 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 child.setOverrideContainingBlockContentLogicalWidth(LayoutUnit(-1)); | 758 child.setOverrideContainingBlockContentLogicalWidth(LayoutUnit(-1)); |
759 | 759 |
760 // FIXME: It's unclear if we should return the intrinsic width or the pr
eferred width. | 760 // FIXME: It's unclear if we should return the intrinsic width or the pr
eferred width. |
761 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html | 761 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html |
762 return child.maxPreferredLogicalWidth() + marginIntrinsicLogicalWidthFor
Child(child); | 762 return child.maxPreferredLogicalWidth() + marginIntrinsicLogicalWidthFor
Child(child); |
763 } | 763 } |
764 | 764 |
765 return logicalHeightForChild(child, columnTracks); | 765 return logicalHeightForChild(child, columnTracks); |
766 } | 766 } |
767 | 767 |
768 // We're basically using a class instead of a std::pair because of accessing gri
dItem() or gridSpan() is much more | 768 // We're basically using a class instead of a std::pair because of accessing gri
dItem() or getGridSpan() is much more |
769 // self-explanatory that using .first or .second members in the pair. Having a s
td::pair<LayoutBox*, size_t> | 769 // self-explanatory that using .first or .second members in the pair. Having a s
td::pair<LayoutBox*, size_t> |
770 // does not work either because we still need the GridSpan so we'd have to add a
n extra hash lookup for each item | 770 // does not work either because we still need the GridSpan so we'd have to add a
n extra hash lookup for each item |
771 // at the beginning of LayoutGrid::resolveContentBasedTrackSizingFunctionsForIte
ms(). | 771 // at the beginning of LayoutGrid::resolveContentBasedTrackSizingFunctionsForIte
ms(). |
772 class GridItemWithSpan { | 772 class GridItemWithSpan { |
773 public: | 773 public: |
774 GridItemWithSpan(LayoutBox& gridItem, const GridSpan& gridSpan) | 774 GridItemWithSpan(LayoutBox& gridItem, const GridSpan& gridSpan) |
775 : m_gridItem(&gridItem) | 775 : m_gridItem(&gridItem) |
776 , m_gridSpan(gridSpan) | 776 , m_gridSpan(gridSpan) |
777 { | 777 { |
778 } | 778 } |
779 | 779 |
780 LayoutBox& gridItem() const { return *m_gridItem; } | 780 LayoutBox& gridItem() const { return *m_gridItem; } |
781 GridSpan gridSpan() const { return m_gridSpan; } | 781 GridSpan getGridSpan() const { return m_gridSpan; } |
782 | 782 |
783 bool operator<(const GridItemWithSpan other) const { return m_gridSpan.integ
erSpan() < other.m_gridSpan.integerSpan(); } | 783 bool operator<(const GridItemWithSpan other) const { return m_gridSpan.integ
erSpan() < other.m_gridSpan.integerSpan(); } |
784 | 784 |
785 private: | 785 private: |
786 LayoutBox* m_gridItem; | 786 LayoutBox* m_gridItem; |
787 GridSpan m_gridSpan; | 787 GridSpan m_gridSpan; |
788 }; | 788 }; |
789 | 789 |
790 bool LayoutGrid::spanningItemCrossesFlexibleSizedTracks(const GridSpan& span, Gr
idTrackSizingDirection direction) const | 790 bool LayoutGrid::spanningItemCrossesFlexibleSizedTracks(const GridSpan& span, Gr
idTrackSizingDirection direction) const |
791 { | 791 { |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 void LayoutGrid::resolveContentBasedTrackSizingFunctionsForItems(GridTrackSizing
Direction direction, GridSizingData& sizingData, const GridItemsSpanGroupRange&
gridItemsWithSpan) | 984 void LayoutGrid::resolveContentBasedTrackSizingFunctionsForItems(GridTrackSizing
Direction direction, GridSizingData& sizingData, const GridItemsSpanGroupRange&
gridItemsWithSpan) |
985 { | 985 { |
986 Vector<GridTrack>& tracks = (direction == ForColumns) ? sizingData.columnTra
cks : sizingData.rowTracks; | 986 Vector<GridTrack>& tracks = (direction == ForColumns) ? sizingData.columnTra
cks : sizingData.rowTracks; |
987 for (const auto& trackIndex : sizingData.contentSizedTracksIndex) { | 987 for (const auto& trackIndex : sizingData.contentSizedTracksIndex) { |
988 GridTrack& track = tracks[trackIndex]; | 988 GridTrack& track = tracks[trackIndex]; |
989 track.setPlannedSize(trackSizeForTrackSizeComputationPhase(phase, track,
AllowInfinity)); | 989 track.setPlannedSize(trackSizeForTrackSizeComputationPhase(phase, track,
AllowInfinity)); |
990 } | 990 } |
991 | 991 |
992 for (auto it = gridItemsWithSpan.rangeStart; it != gridItemsWithSpan.rangeEn
d; ++it) { | 992 for (auto it = gridItemsWithSpan.rangeStart; it != gridItemsWithSpan.rangeEn
d; ++it) { |
993 GridItemWithSpan& gridItemWithSpan = *it; | 993 GridItemWithSpan& gridItemWithSpan = *it; |
994 ASSERT(gridItemWithSpan.gridSpan().integerSpan() > 1); | 994 ASSERT(gridItemWithSpan.getGridSpan().integerSpan() > 1); |
995 const GridSpan& itemSpan = gridItemWithSpan.gridSpan(); | 995 const GridSpan& itemSpan = gridItemWithSpan.getGridSpan(); |
996 | 996 |
997 sizingData.growBeyondGrowthLimitsTracks.shrink(0); | 997 sizingData.growBeyondGrowthLimitsTracks.shrink(0); |
998 sizingData.filteredTracks.shrink(0); | 998 sizingData.filteredTracks.shrink(0); |
999 LayoutUnit spanningTracksSize; | 999 LayoutUnit spanningTracksSize; |
1000 for (const auto& trackPosition : itemSpan) { | 1000 for (const auto& trackPosition : itemSpan) { |
1001 GridTrackSize trackSize = gridTrackSize(direction, trackPosition); | 1001 GridTrackSize trackSize = gridTrackSize(direction, trackPosition); |
1002 GridTrack& track = (direction == ForColumns) ? sizingData.columnTrac
ks[trackPosition] : sizingData.rowTracks[trackPosition]; | 1002 GridTrack& track = (direction == ForColumns) ? sizingData.columnTrac
ks[trackPosition] : sizingData.rowTracks[trackPosition]; |
1003 spanningTracksSize += trackSizeForTrackSizeComputationPhase(phase, t
rack, ForbidInfinity); | 1003 spanningTracksSize += trackSizeForTrackSizeComputationPhase(phase, t
rack, ForbidInfinity); |
1004 if (!shouldProcessTrackForTrackSizeComputationPhase(phase, trackSize
)) | 1004 if (!shouldProcessTrackForTrackSizeComputationPhase(phase, trackSize
)) |
1005 continue; | 1005 continue; |
(...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2069 | 2069 |
2070 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child)); | 2070 return LayoutPoint(rowAxisOffset, columnAxisOffsetForChild(child)); |
2071 } | 2071 } |
2072 | 2072 |
2073 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) const | 2073 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa
intOffset) const |
2074 { | 2074 { |
2075 GridPainter(*this).paintChildren(paintInfo, paintOffset); | 2075 GridPainter(*this).paintChildren(paintInfo, paintOffset); |
2076 } | 2076 } |
2077 | 2077 |
2078 } // namespace blink | 2078 } // namespace blink |
OLD | NEW |