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 11 matching lines...) Expand all Loading... |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/rendering/RenderGrid.h" | 27 #include "core/rendering/RenderGrid.h" |
28 | 28 |
29 #include "core/rendering/LayoutRepainter.h" | 29 #include "core/rendering/LayoutRepainter.h" |
30 #include "core/rendering/RenderLayer.h" | 30 #include "core/rendering/RenderLayer.h" |
31 #include "core/rendering/RenderView.h" | 31 #include "core/rendering/RenderView.h" |
| 32 #include "core/rendering/style/GridCoordinate.h" |
32 | 33 |
33 namespace WebCore { | 34 namespace WebCore { |
34 | 35 |
35 static const int infinity = intMaxForLayoutUnit; | 36 static const int infinity = intMaxForLayoutUnit; |
36 | 37 |
37 class GridTrack { | 38 class GridTrack { |
38 public: | 39 public: |
39 GridTrack() | 40 GridTrack() |
40 : m_usedBreadth(0) | 41 : m_usedBreadth(0) |
41 , m_maxBreadth(0) | 42 , m_maxBreadth(0) |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 | 802 |
802 for (size_t i = 0; i < rowTracks.size(); ++i) | 803 for (size_t i = 0; i < rowTracks.size(); ++i) |
803 setLogicalHeight(logicalHeight() + rowTracks[i].m_usedBreadth); | 804 setLogicalHeight(logicalHeight() + rowTracks[i].m_usedBreadth); |
804 | 805 |
805 // FIXME: We should handle min / max logical height. | 806 // FIXME: We should handle min / max logical height. |
806 | 807 |
807 setLogicalHeight(logicalHeight() + borderAndPaddingLogicalHeight()); | 808 setLogicalHeight(logicalHeight() + borderAndPaddingLogicalHeight()); |
808 clearGrid(); | 809 clearGrid(); |
809 } | 810 } |
810 | 811 |
811 RenderGrid::GridCoordinate RenderGrid::cachedGridCoordinate(const RenderBox* gri
dItem) const | 812 GridCoordinate RenderGrid::cachedGridCoordinate(const RenderBox* gridItem) const |
812 { | 813 { |
813 ASSERT(m_gridItemCoordinate.contains(gridItem)); | 814 ASSERT(m_gridItemCoordinate.contains(gridItem)); |
814 return m_gridItemCoordinate.get(gridItem); | 815 return m_gridItemCoordinate.get(gridItem); |
815 } | 816 } |
816 | 817 |
817 RenderGrid::GridSpan RenderGrid::resolveGridPositionsFromAutoPlacementPosition(c
onst RenderBox*, TrackSizingDirection, size_t initialPosition) const | 818 GridSpan RenderGrid::resolveGridPositionsFromAutoPlacementPosition(const RenderB
ox*, TrackSizingDirection, size_t initialPosition) const |
818 { | 819 { |
819 // FIXME: We don't support spanning with auto positions yet. Once we do, thi
s is wrong. Also we should make | 820 // FIXME: We don't support spanning with auto positions yet. Once we do, thi
s is wrong. Also we should make |
820 // sure the grid can accomodate the new item as we only grow 1 position in a
given direction. | 821 // sure the grid can accomodate the new item as we only grow 1 position in a
given direction. |
821 return GridSpan(initialPosition, initialPosition); | 822 return GridSpan(initialPosition, initialPosition); |
822 } | 823 } |
823 | 824 |
824 PassOwnPtr<RenderGrid::GridSpan> RenderGrid::resolveGridPositionsFromStyle(const
RenderBox* gridItem, TrackSizingDirection direction) const | 825 PassOwnPtr<GridSpan> RenderGrid::resolveGridPositionsFromStyle(const RenderBox*
gridItem, TrackSizingDirection direction) const |
825 { | 826 { |
826 const GridPosition& initialPosition = (direction == ForColumns) ? gridItem->
style()->gridColumnStart() : gridItem->style()->gridRowStart(); | 827 const GridPosition& initialPosition = (direction == ForColumns) ? gridItem->
style()->gridColumnStart() : gridItem->style()->gridRowStart(); |
827 const GridPositionSide initialPositionSide = (direction == ForColumns) ? Col
umnStartSide : RowStartSide; | 828 const GridPositionSide initialPositionSide = (direction == ForColumns) ? Col
umnStartSide : RowStartSide; |
828 const GridPosition& finalPosition = (direction == ForColumns) ? gridItem->st
yle()->gridColumnEnd() : gridItem->style()->gridRowEnd(); | 829 const GridPosition& finalPosition = (direction == ForColumns) ? gridItem->st
yle()->gridColumnEnd() : gridItem->style()->gridRowEnd(); |
829 const GridPositionSide finalPositionSide = (direction == ForColumns) ? Colum
nEndSide : RowEndSide; | 830 const GridPositionSide finalPositionSide = (direction == ForColumns) ? Colum
nEndSide : RowEndSide; |
830 | 831 |
831 // We should NEVER see both spans as they should have been handled during st
yle resolve. | 832 // We should NEVER see both spans as they should have been handled during st
yle resolve. |
832 ASSERT(!initialPosition.isSpan() || !finalPosition.isSpan()); | 833 ASSERT(!initialPosition.isSpan() || !finalPosition.isSpan()); |
833 | 834 |
834 if (initialPosition.isAuto() && finalPosition.isAuto()) { | 835 if (initialPosition.isAuto() && finalPosition.isAuto()) { |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 return 0; | 921 return 0; |
921 case SpanPosition: | 922 case SpanPosition: |
922 // FIXME: Handle span positions (crbug.com/229713). | 923 // FIXME: Handle span positions (crbug.com/229713). |
923 ASSERT_NOT_REACHED(); | 924 ASSERT_NOT_REACHED(); |
924 return 0; | 925 return 0; |
925 } | 926 } |
926 ASSERT_NOT_REACHED(); | 927 ASSERT_NOT_REACHED(); |
927 return 0; | 928 return 0; |
928 } | 929 } |
929 | 930 |
930 PassOwnPtr<RenderGrid::GridSpan> RenderGrid::resolveGridPositionAgainstOppositeP
osition(size_t resolvedOppositePosition, const GridPosition& position, GridPosit
ionSide side) const | 931 PassOwnPtr<GridSpan> RenderGrid::resolveGridPositionAgainstOppositePosition(size
_t resolvedOppositePosition, const GridPosition& position, GridPositionSide side
) const |
931 { | 932 { |
932 if (position.isAuto()) | 933 if (position.isAuto()) |
933 return GridSpan::create(resolvedOppositePosition, resolvedOppositePositi
on); | 934 return GridSpan::create(resolvedOppositePosition, resolvedOppositePositi
on); |
934 | 935 |
935 ASSERT(position.isSpan()); | 936 ASSERT(position.isSpan()); |
936 ASSERT(position.spanPosition() > 0); | 937 ASSERT(position.spanPosition() > 0); |
937 | 938 |
938 // 'span 1' is contained inside a single grid track regardless of the direct
ion. | 939 // 'span 1' is contained inside a single grid track regardless of the direct
ion. |
939 // That's why the CSS span value is one more than the offset we apply. | 940 // That's why the CSS span value is one more than the offset we apply. |
940 size_t positionOffset = position.spanPosition() - 1; | 941 size_t positionOffset = position.spanPosition() - 1; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 if (isOutOfFlowPositioned()) | 980 if (isOutOfFlowPositioned()) |
980 return "RenderGrid (positioned)"; | 981 return "RenderGrid (positioned)"; |
981 if (isAnonymous()) | 982 if (isAnonymous()) |
982 return "RenderGrid (generated)"; | 983 return "RenderGrid (generated)"; |
983 if (isRelPositioned()) | 984 if (isRelPositioned()) |
984 return "RenderGrid (relative positioned)"; | 985 return "RenderGrid (relative positioned)"; |
985 return "RenderGrid"; | 986 return "RenderGrid"; |
986 } | 987 } |
987 | 988 |
988 } // namespace WebCore | 989 } // namespace WebCore |
OLD | NEW |