Chromium Code Reviews| 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 | 334 |
| 335 clearPreferredLogicalWidthsDirty(); | 335 clearPreferredLogicalWidthsDirty(); |
| 336 } | 336 } |
| 337 | 337 |
| 338 void RenderGrid::computeUsedBreadthOfGridTracks(GridTrackSizingDirection directi on, GridSizingData& sizingData) | 338 void RenderGrid::computeUsedBreadthOfGridTracks(GridTrackSizingDirection directi on, GridSizingData& sizingData) |
| 339 { | 339 { |
| 340 LayoutUnit availableLogicalSpace = (direction == ForColumns) ? availableLogi calWidth() : availableLogicalHeight(IncludeMarginBorderPadding); | 340 LayoutUnit availableLogicalSpace = (direction == ForColumns) ? availableLogi calWidth() : availableLogicalHeight(IncludeMarginBorderPadding); |
| 341 computeUsedBreadthOfGridTracks(direction, sizingData, availableLogicalSpace) ; | 341 computeUsedBreadthOfGridTracks(direction, sizingData, availableLogicalSpace) ; |
| 342 } | 342 } |
| 343 | 343 |
| 344 static bool gridElementIsShrinkToFit(const RenderStyle& style) | 344 bool RenderGrid::gridElementIsShrinkToFit() |
| 345 { | 345 { |
| 346 return style.isFloating() || style.position() == AbsolutePosition; | 346 return isFloatingOrOutOfFlowPositioned(); |
|
Julien - ping for review
2014/02/26 22:43:43
Are fixed elements also shrink-to-fit? (this will
| |
| 347 } | 347 } |
| 348 | 348 |
| 349 void RenderGrid::computeUsedBreadthOfGridTracks(GridTrackSizingDirection directi on, GridSizingData& sizingData, LayoutUnit& availableLogicalSpace) | 349 void RenderGrid::computeUsedBreadthOfGridTracks(GridTrackSizingDirection directi on, GridSizingData& sizingData, LayoutUnit& availableLogicalSpace) |
| 350 { | 350 { |
| 351 Vector<GridTrack>& tracks = (direction == ForColumns) ? sizingData.columnTra cks : sizingData.rowTracks; | 351 Vector<GridTrack>& tracks = (direction == ForColumns) ? sizingData.columnTra cks : sizingData.rowTracks; |
| 352 Vector<size_t> flexibleSizedTracksIndex; | 352 Vector<size_t> flexibleSizedTracksIndex; |
| 353 sizingData.contentSizedTracksIndex.shrink(0); | 353 sizingData.contentSizedTracksIndex.shrink(0); |
| 354 | 354 |
| 355 // 1. Initialize per Grid track variables. | 355 // 1. Initialize per Grid track variables. |
| 356 for (size_t i = 0; i < tracks.size(); ++i) { | 356 for (size_t i = 0; i < tracks.size(); ++i) { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 372 | 372 |
| 373 // 2. Resolve content-based TrackSizingFunctions. | 373 // 2. Resolve content-based TrackSizingFunctions. |
| 374 if (!sizingData.contentSizedTracksIndex.isEmpty()) | 374 if (!sizingData.contentSizedTracksIndex.isEmpty()) |
| 375 resolveContentBasedTrackSizingFunctions(direction, sizingData, available LogicalSpace); | 375 resolveContentBasedTrackSizingFunctions(direction, sizingData, available LogicalSpace); |
| 376 | 376 |
| 377 for (size_t i = 0; i < tracks.size(); ++i) { | 377 for (size_t i = 0; i < tracks.size(); ++i) { |
| 378 ASSERT(tracks[i].m_maxBreadth != infinity); | 378 ASSERT(tracks[i].m_maxBreadth != infinity); |
| 379 availableLogicalSpace -= tracks[i].m_usedBreadth; | 379 availableLogicalSpace -= tracks[i].m_usedBreadth; |
| 380 } | 380 } |
| 381 | 381 |
| 382 const bool hasUndefinedRemainingSpace = (direction == ForRows) ? style()->lo gicalHeight().isAuto() : gridElementIsShrinkToFit(*style()); | 382 const bool hasUndefinedRemainingSpace = (direction == ForRows) ? style()->lo gicalHeight().isAuto() : gridElementIsShrinkToFit(); |
| 383 | 383 |
| 384 if (!hasUndefinedRemainingSpace && availableLogicalSpace <= 0) | 384 if (!hasUndefinedRemainingSpace && availableLogicalSpace <= 0) |
| 385 return; | 385 return; |
| 386 | 386 |
| 387 // 3. Grow all Grid tracks in GridTracks from their UsedBreadth up to their MaxBreadth value until | 387 // 3. Grow all Grid tracks in GridTracks from their UsedBreadth up to their MaxBreadth value until |
| 388 // availableLogicalSpace (RemainingSpace in the specs) is exhausted. | 388 // availableLogicalSpace (RemainingSpace in the specs) is exhausted. |
| 389 const size_t tracksSize = tracks.size(); | 389 const size_t tracksSize = tracks.size(); |
| 390 if (!hasUndefinedRemainingSpace) { | 390 if (!hasUndefinedRemainingSpace) { |
| 391 Vector<GridTrack*> tracksForDistribution(tracksSize); | 391 Vector<GridTrack*> tracksForDistribution(tracksSize); |
| 392 for (size_t i = 0; i < tracksSize; ++i) | 392 for (size_t i = 0; i < tracksSize; ++i) |
| (...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1374 if (isOutOfFlowPositioned()) | 1374 if (isOutOfFlowPositioned()) |
| 1375 return "RenderGrid (positioned)"; | 1375 return "RenderGrid (positioned)"; |
| 1376 if (isAnonymous()) | 1376 if (isAnonymous()) |
| 1377 return "RenderGrid (generated)"; | 1377 return "RenderGrid (generated)"; |
| 1378 if (isRelPositioned()) | 1378 if (isRelPositioned()) |
| 1379 return "RenderGrid (relative positioned)"; | 1379 return "RenderGrid (relative positioned)"; |
| 1380 return "RenderGrid"; | 1380 return "RenderGrid"; |
| 1381 } | 1381 } |
| 1382 | 1382 |
| 1383 } // namespace WebCore | 1383 } // namespace WebCore |
| OLD | NEW |