| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 #include "core/rendering/OrderIterator.h" | 29 #include "core/rendering/OrderIterator.h" |
| 30 #include "core/rendering/RenderBlock.h" | 30 #include "core/rendering/RenderBlock.h" |
| 31 | 31 |
| 32 namespace WebCore { | 32 namespace WebCore { |
| 33 | 33 |
| 34 struct GridCoordinate; | 34 struct GridCoordinate; |
| 35 struct GridSpan; | 35 struct GridSpan; |
| 36 class GridTrack; | 36 class GridTrack; |
| 37 | 37 |
| 38 enum GridTrackSizingDirection { | 38 typedef HashMap<String, Vector<size_t> > NamedGridLinesMap; |
| 39 ForColumns, | |
| 40 ForRows | |
| 41 }; | |
| 42 | 39 |
| 43 class RenderGrid FINAL : public RenderBlock { | 40 class RenderGrid FINAL : public RenderBlock { |
| 44 public: | 41 public: |
| 45 RenderGrid(Element*); | 42 RenderGrid(Element*); |
| 46 virtual ~RenderGrid(); | 43 virtual ~RenderGrid(); |
| 47 | 44 |
| 48 virtual const char* renderName() const OVERRIDE; | 45 virtual const char* renderName() const OVERRIDE; |
| 49 | 46 |
| 50 virtual void layoutBlock(bool relayoutChildren) OVERRIDE; | 47 virtual void layoutBlock(bool relayoutChildren) OVERRIDE; |
| 51 | 48 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 LayoutUnit columnPositionAlignedWithGridContainerEnd(const RenderBox*) const
; | 114 LayoutUnit columnPositionAlignedWithGridContainerEnd(const RenderBox*) const
; |
| 118 LayoutUnit centeredColumnPositionForChild(const RenderBox*) const; | 115 LayoutUnit centeredColumnPositionForChild(const RenderBox*) const; |
| 119 LayoutUnit columnPositionForChild(const RenderBox*) const; | 116 LayoutUnit columnPositionForChild(const RenderBox*) const; |
| 120 LayoutUnit rowPositionForChild(const RenderBox*) const; | 117 LayoutUnit rowPositionForChild(const RenderBox*) const; |
| 121 LayoutPoint findChildLogicalPosition(const RenderBox*) const; | 118 LayoutPoint findChildLogicalPosition(const RenderBox*) const; |
| 122 GridCoordinate cachedGridCoordinate(const RenderBox*) const; | 119 GridCoordinate cachedGridCoordinate(const RenderBox*) const; |
| 123 | 120 |
| 124 GridSpan resolveGridPositionsFromAutoPlacementPosition(const RenderBox*, Gri
dTrackSizingDirection, size_t) const; | 121 GridSpan resolveGridPositionsFromAutoPlacementPosition(const RenderBox*, Gri
dTrackSizingDirection, size_t) const; |
| 125 PassOwnPtr<GridSpan> resolveGridPositionsFromStyle(const RenderBox*, GridTra
ckSizingDirection) const; | 122 PassOwnPtr<GridSpan> resolveGridPositionsFromStyle(const RenderBox*, GridTra
ckSizingDirection) const; |
| 126 size_t resolveNamedGridLinePositionFromStyle(const GridPosition&, GridPositi
onSide) const; | 123 size_t resolveNamedGridLinePositionFromStyle(const GridPosition&, GridPositi
onSide) const; |
| 124 size_t resolveExplicitPositionFromStyle(const GridPosition&, GridPositionSid
e) const; |
| 127 size_t resolveGridPositionFromStyle(const GridPosition&, GridPositionSide) c
onst; | 125 size_t resolveGridPositionFromStyle(const GridPosition&, GridPositionSide) c
onst; |
| 128 PassOwnPtr<GridSpan> resolveGridPositionAgainstOppositePosition(size_t resol
vedOppositePosition, const GridPosition&, GridPositionSide) const; | 126 PassOwnPtr<GridSpan> resolveGridPositionAgainstOppositePosition(size_t resol
vedOppositePosition, const GridPosition&, GridPositionSide) const; |
| 129 PassOwnPtr<GridSpan> resolveNamedGridLinePositionAgainstOppositePosition(siz
e_t resolvedOppositePosition, const GridPosition&, GridPositionSide) const; | 127 PassOwnPtr<GridSpan> resolveNamedGridLinePositionAgainstOppositePosition(siz
e_t resolvedOppositePosition, const GridPosition&, GridPositionSide) const; |
| 130 PassOwnPtr<GridSpan> resolveBeforeStartNamedGridLinePositionAgainstOppositeP
osition(size_t resolvedOppositePosition, const GridPosition&, const Vector<size_
t>&) const; | 128 PassOwnPtr<GridSpan> resolveBeforeStartNamedGridLinePositionAgainstOppositeP
osition(size_t resolvedOppositePosition, const GridPosition&, const Vector<size_
t>&) const; |
| 131 PassOwnPtr<GridSpan> resolveAfterEndNamedGridLinePositionAgainstOppositePosi
tion(size_t resolvedOppositePosition, const GridPosition&, const Vector<size_t>&
) const; | 129 PassOwnPtr<GridSpan> resolveAfterEndNamedGridLinePositionAgainstOppositePosi
tion(size_t resolvedOppositePosition, const GridPosition&, const Vector<size_t>&
) const; |
| 132 | 130 |
| 133 LayoutUnit gridAreaBreadthForChild(const RenderBox* child, GridTrackSizingDi
rection, const Vector<GridTrack>&) const; | 131 LayoutUnit gridAreaBreadthForChild(const RenderBox* child, GridTrackSizingDi
rection, const Vector<GridTrack>&) const; |
| 134 | 132 |
| 135 virtual void paintChildren(PaintInfo&, const LayoutPoint&) OVERRIDE; | 133 virtual void paintChildren(PaintInfo&, const LayoutPoint&) OVERRIDE; |
| 136 | 134 |
| 137 bool gridIsDirty() const { return m_gridIsDirty; } | 135 bool gridIsDirty() const { return m_gridIsDirty; } |
| 138 | 136 |
| 139 #ifndef NDEBUG | 137 #ifndef NDEBUG |
| 140 bool tracksAreWiderThanMinTrackBreadth(GridTrackSizingDirection, const Vecto
r<GridTrack>&); | 138 bool tracksAreWiderThanMinTrackBreadth(GridTrackSizingDirection, const Vecto
r<GridTrack>&); |
| 141 #endif | 139 #endif |
| 142 | 140 |
| 143 size_t gridColumnCount() const | 141 size_t gridColumnCount() const |
| 144 { | 142 { |
| 145 ASSERT(!gridIsDirty()); | 143 ASSERT(!gridIsDirty()); |
| 146 return m_grid[0].size(); | 144 return m_grid[0].size(); |
| 147 } | 145 } |
| 148 size_t gridRowCount() const | 146 size_t gridRowCount() const |
| 149 { | 147 { |
| 150 ASSERT(!gridIsDirty()); | 148 ASSERT(!gridIsDirty()); |
| 151 return m_grid.size(); | 149 return m_grid.size(); |
| 152 } | 150 } |
| 153 | 151 |
| 152 const NamedGridLinesMap& gridLinesForSide(GridPositionSide side) const { ret
urn (side == ColumnStartSide || side == ColumnEndSide) ? m_namedGridColumnLines
: m_namedGridRowLines; } |
| 153 void createGridLineNamesMapsForDirection(GridTrackSizingDirection); |
| 154 |
| 154 typedef Vector<RenderBox*, 1> GridCell; | 155 typedef Vector<RenderBox*, 1> GridCell; |
| 155 typedef Vector<Vector<GridCell> > GridRepresentation; | 156 typedef Vector<Vector<GridCell> > GridRepresentation; |
| 156 GridRepresentation m_grid; | 157 GridRepresentation m_grid; |
| 157 bool m_gridIsDirty; | 158 bool m_gridIsDirty; |
| 158 Vector<LayoutUnit> m_rowPositions; | 159 Vector<LayoutUnit> m_rowPositions; |
| 159 Vector<LayoutUnit> m_columnPositions; | 160 Vector<LayoutUnit> m_columnPositions; |
| 160 HashMap<const RenderBox*, GridCoordinate> m_gridItemCoordinate; | 161 HashMap<const RenderBox*, GridCoordinate> m_gridItemCoordinate; |
| 161 OrderIterator m_orderIterator; | 162 OrderIterator m_orderIterator; |
| 162 Vector<RenderBox*> m_gridItemsOverflowingGridArea; | 163 Vector<RenderBox*> m_gridItemsOverflowingGridArea; |
| 163 | 164 |
| 165 NamedGridLinesMap m_namedGridColumnLines; |
| 166 NamedGridLinesMap m_namedGridRowLines; |
| 167 |
| 164 friend class GridCoordinateSorter; | 168 friend class GridCoordinateSorter; |
| 165 }; | 169 }; |
| 166 | 170 |
| 167 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderGrid, isRenderGrid()); | 171 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderGrid, isRenderGrid()); |
| 168 | 172 |
| 169 } // namespace WebCore | 173 } // namespace WebCore |
| 170 | 174 |
| 171 #endif // RenderGrid_h | 175 #endif // RenderGrid_h |
| OLD | NEW |