Changeset 141616 in webkit
- Timestamp:
- Feb 1, 2013 11:29:18 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r141615 r141616 1 2013-02-01 Julien Chaffraix <jchaffraix@webkit.org> 2 3 [CSS Grid Layout] computePreferredLogicalWidths doesn't handle minmax tracks 4 https://bugs.webkit.org/show_bug.cgi?id=108403 5 6 Reviewed by Ojan Vafai. 7 8 * fast/css-grid-layout/grid-preferred-logical-widths-expected.txt: Added. 9 * fast/css-grid-layout/grid-preferred-logical-widths.html: Added. 10 1 11 2013-02-01 Nate Chapin <japhet@chromium.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r141615 r141616 1 2013-02-01 Julien Chaffraix <jchaffraix@webkit.org> 2 3 [CSS Grid Layout] computePreferredLogicalWidths doesn't handle minmax tracks 4 https://bugs.webkit.org/show_bug.cgi?id=108403 5 6 Reviewed by Ojan Vafai. 7 8 Test: fast/css-grid-layout/grid-preferred-logical-widths.html 9 10 The code before this change was only handling minmax() with 2 fixed widths. 11 The new code was updated to remove this artificial limitation and we now 12 support all combination of minmax(). 13 14 * rendering/RenderGrid.cpp: 15 (WebCore::RenderGrid::computePreferredLogicalWidths): 16 Updated to use computePreferredTrackWidth.. 17 18 (WebCore::RenderGrid::computePreferredTrackWidth): 19 Added this helper function that implements the core of the preferred width 20 computation. 21 22 * rendering/RenderGrid.h: Added computePreferredTrackWidth. 23 1 24 2013-02-01 Nate Chapin <japhet@chromium.org> 2 25 -
trunk/Source/WebCore/rendering/RenderGrid.cpp
r141505 r141616 143 143 144 144 for (size_t i = 0; i < trackStyles.size(); ++i) { 145 const Length& minTrackLength = trackStyles[i].minTrackBreadth(); 146 const Length& maxTrackLength = trackStyles[i].maxTrackBreadth(); 147 // FIXME: Handle only one fixed length properly (e.g minmax(100px, max-content)). 148 if (!minTrackLength.isFixed() || !maxTrackLength.isFixed()) { 149 notImplemented(); 150 continue; 151 } 152 153 LayoutUnit minTrackBreadth = minTrackLength.intValue(); 154 LayoutUnit maxTrackBreadth = maxTrackLength.intValue(); 155 145 LayoutUnit minTrackBreadth = computePreferredTrackWidth(trackStyles[i].minTrackBreadth(), i); 146 LayoutUnit maxTrackBreadth = computePreferredTrackWidth(trackStyles[i].maxTrackBreadth(), i); 156 147 maxTrackBreadth = std::max(maxTrackBreadth, minTrackBreadth); 157 148 … … 169 160 170 161 setPreferredLogicalWidthsDirty(false); 162 } 163 164 LayoutUnit RenderGrid::computePreferredTrackWidth(const Length& length, size_t trackIndex) const 165 { 166 if (length.isFixed()) { 167 // Grid areas don't have borders, margins or paddings so we don't need to account for them. 168 return length.intValue(); 169 } 170 171 if (length.isMinContent()) { 172 LayoutUnit minContentSize = 0; 173 // FIXME: It's inefficient to iterate over our grid items. We should be able to 174 // get the subset of grid items in the current row / column faster. 175 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { 176 size_t cellIndex = resolveGridPosition(ForColumns, child); 177 if (cellIndex != trackIndex) 178 continue; 179 180 // FIXME: We should include the child's fixed margins like RenderFlexibleBox. 181 minContentSize = std::max(minContentSize, child->minPreferredLogicalWidth()); 182 } 183 return minContentSize; 184 } 185 186 if (length.isMaxContent()) { 187 LayoutUnit maxContentSize = 0; 188 for (RenderBox* child = firstChildBox(); child; child = child->nextSiblingBox()) { 189 size_t cellIndex = resolveGridPosition(ForColumns, child); 190 if (cellIndex != trackIndex) 191 continue; 192 193 // FIXME: We should include the child's fixed margins like RenderFlexibleBox. 194 maxContentSize = std::max(maxContentSize, child->maxPreferredLogicalWidth()); 195 } 196 return maxContentSize; 197 } 198 199 // FIXME: css3-sizing mentions that we should resolve "definite sizes" 200 // (including <percentage> and calc()) but we don't do it elsewhere. 201 return 0; 171 202 } 172 203 -
trunk/Source/WebCore/rendering/RenderGrid.h
r141505 r141616 49 49 virtual void computePreferredLogicalWidths() OVERRIDE; 50 50 51 LayoutUnit computePreferredTrackWidth(const Length&, size_t) const; 52 51 53 enum TrackSizingDirection { ForColumns, ForRows }; 52 54 void computedUsedBreadthOfGridTracks(TrackSizingDirection, Vector<GridTrack>& columnTracks, Vector<GridTrack>& rowTracks);
Note: See TracChangeset
for help on using the changeset viewer.