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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 // - auto-flow changes only impacts auto-placed children. | 231 // - auto-flow changes only impacts auto-placed children. |
232 | 232 |
233 if (explicitGridDidResize(oldStyle) | 233 if (explicitGridDidResize(oldStyle) |
234 || namedGridLinesDefinitionDidChange(oldStyle) | 234 || namedGridLinesDefinitionDidChange(oldStyle) |
235 || oldStyle->gridAutoFlow() != style()->gridAutoFlow()) | 235 || oldStyle->gridAutoFlow() != style()->gridAutoFlow()) |
236 dirtyGrid(); | 236 dirtyGrid(); |
237 } | 237 } |
238 | 238 |
239 bool RenderGrid::explicitGridDidResize(const RenderStyle* oldStyle) const | 239 bool RenderGrid::explicitGridDidResize(const RenderStyle* oldStyle) const |
240 { | 240 { |
241 return oldStyle->gridDefinitionColumns().size() != style()->gridDefinitionCo
lumns().size() | 241 return oldStyle->gridTemplateColumns().size() != style()->gridTemplateColumn
s().size() |
242 || oldStyle->gridDefinitionRows().size() != style()->gridDefinitionRows(
).size(); | 242 || oldStyle->gridTemplateRows().size() != style()->gridTemplateRows().si
ze(); |
243 } | 243 } |
244 | 244 |
245 bool RenderGrid::namedGridLinesDefinitionDidChange(const RenderStyle* oldStyle)
const | 245 bool RenderGrid::namedGridLinesDefinitionDidChange(const RenderStyle* oldStyle)
const |
246 { | 246 { |
247 return oldStyle->namedGridRowLines() != style()->namedGridRowLines() | 247 return oldStyle->namedGridRowLines() != style()->namedGridRowLines() |
248 || oldStyle->namedGridColumnLines() != style()->namedGridColumnLines(); | 248 || oldStyle->namedGridColumnLines() != style()->namedGridColumnLines(); |
249 } | 249 } |
250 | 250 |
251 void RenderGrid::layoutBlock(bool relayoutChildren) | 251 void RenderGrid::layoutBlock(bool relayoutChildren) |
252 { | 252 { |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 accumulatedFractions += track.m_flex; | 521 accumulatedFractions += track.m_flex; |
522 // This item was processed so we re-add its used breadth to the availabl
e space to accurately count the remaining space. | 522 // This item was processed so we re-add its used breadth to the availabl
e space to accurately count the remaining space. |
523 availableLogicalSpaceIgnoringFractionTracks += track.m_track->m_usedBrea
dth; | 523 availableLogicalSpaceIgnoringFractionTracks += track.m_track->m_usedBrea
dth; |
524 } | 524 } |
525 | 525 |
526 return availableLogicalSpaceIgnoringFractionTracks / accumulatedFractions; | 526 return availableLogicalSpaceIgnoringFractionTracks / accumulatedFractions; |
527 } | 527 } |
528 | 528 |
529 const GridTrackSize& RenderGrid::gridTrackSize(GridTrackSizingDirection directio
n, size_t i) const | 529 const GridTrackSize& RenderGrid::gridTrackSize(GridTrackSizingDirection directio
n, size_t i) const |
530 { | 530 { |
531 const Vector<GridTrackSize>& trackStyles = (direction == ForColumns) ? style
()->gridDefinitionColumns() : style()->gridDefinitionRows(); | 531 const Vector<GridTrackSize>& trackStyles = (direction == ForColumns) ? style
()->gridTemplateColumns() : style()->gridTemplateRows(); |
532 if (i >= trackStyles.size()) | 532 if (i >= trackStyles.size()) |
533 return (direction == ForColumns) ? style()->gridAutoColumns() : style()-
>gridAutoRows(); | 533 return (direction == ForColumns) ? style()->gridAutoColumns() : style()-
>gridAutoRows(); |
534 | 534 |
535 const GridTrackSize& trackSize = trackStyles[i]; | 535 const GridTrackSize& trackSize = trackStyles[i]; |
536 // If the logical width/height of the grid container is indefinite, percenta
ge values are treated as <auto>. | 536 // If the logical width/height of the grid container is indefinite, percenta
ge values are treated as <auto>. |
537 if (trackSize.isPercentage()) { | 537 if (trackSize.isPercentage()) { |
538 Length logicalSize = direction == ForColumns ? style()->logicalWidth() :
style()->logicalHeight(); | 538 Length logicalSize = direction == ForColumns ? style()->logicalWidth() :
style()->logicalHeight(); |
539 if (logicalSize.isIntrinsicOrAuto()) { | 539 if (logicalSize.isIntrinsicOrAuto()) { |
540 DEFINE_STATIC_LOCAL(GridTrackSize, autoTrackSize, (Length(Auto))); | 540 DEFINE_STATIC_LOCAL(GridTrackSize, autoTrackSize, (Length(Auto))); |
541 return autoTrackSize; | 541 return autoTrackSize; |
542 } | 542 } |
543 } | 543 } |
544 | 544 |
545 return trackSize; | 545 return trackSize; |
546 } | 546 } |
547 | 547 |
548 size_t RenderGrid::explicitGridColumnCount() const | 548 size_t RenderGrid::explicitGridColumnCount() const |
549 { | 549 { |
550 return style()->gridDefinitionColumns().size(); | 550 return style()->gridTemplateColumns().size(); |
551 } | 551 } |
552 | 552 |
553 size_t RenderGrid::explicitGridRowCount() const | 553 size_t RenderGrid::explicitGridRowCount() const |
554 { | 554 { |
555 return style()->gridDefinitionRows().size(); | 555 return style()->gridTemplateRows().size(); |
556 } | 556 } |
557 | 557 |
558 size_t RenderGrid::explicitGridSizeForSide(GridPositionSide side) const | 558 size_t RenderGrid::explicitGridSizeForSide(GridPositionSide side) const |
559 { | 559 { |
560 return (side == ColumnStartSide || side == ColumnEndSide) ? explicitGridColu
mnCount() : explicitGridRowCount(); | 560 return (side == ColumnStartSide || side == ColumnEndSide) ? explicitGridColu
mnCount() : explicitGridRowCount(); |
561 } | 561 } |
562 | 562 |
563 LayoutUnit RenderGrid::logicalContentHeightForChild(RenderBox* child, Vector<Gri
dTrack>& columnTracks) | 563 LayoutUnit RenderGrid::logicalContentHeightForChild(RenderBox* child, Vector<Gri
dTrack>& columnTracks) |
564 { | 564 { |
565 SubtreeLayoutScope layoutScope(child); | 565 SubtreeLayoutScope layoutScope(child); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 GridSpan* majorAxisPositions = (autoPlacementMajorAxisDirection() ==
ForColumns) ? columnPositions.get() : rowPositions.get(); | 765 GridSpan* majorAxisPositions = (autoPlacementMajorAxisDirection() ==
ForColumns) ? columnPositions.get() : rowPositions.get(); |
766 if (!majorAxisPositions) | 766 if (!majorAxisPositions) |
767 autoMajorAxisAutoGridItems.append(child); | 767 autoMajorAxisAutoGridItems.append(child); |
768 else | 768 else |
769 specifiedMajorAxisAutoGridItems.append(child); | 769 specifiedMajorAxisAutoGridItems.append(child); |
770 continue; | 770 continue; |
771 } | 771 } |
772 insertItemIntoGrid(child, GridCoordinate(*rowPositions, *columnPositions
)); | 772 insertItemIntoGrid(child, GridCoordinate(*rowPositions, *columnPositions
)); |
773 } | 773 } |
774 | 774 |
775 ASSERT(gridRowCount() >= style()->gridDefinitionRows().size()); | 775 ASSERT(gridRowCount() >= style()->gridTemplateRows().size()); |
776 ASSERT(gridColumnCount() >= style()->gridDefinitionColumns().size()); | 776 ASSERT(gridColumnCount() >= style()->gridTemplateColumns().size()); |
777 | 777 |
778 if (autoFlow == AutoFlowNone) { | 778 if (autoFlow == AutoFlowNone) { |
779 // If we did collect some grid items, they won't be placed thus never la
id out. | 779 // If we did collect some grid items, they won't be placed thus never la
id out. |
780 ASSERT(!autoMajorAxisAutoGridItems.size()); | 780 ASSERT(!autoMajorAxisAutoGridItems.size()); |
781 ASSERT(!specifiedMajorAxisAutoGridItems.size()); | 781 ASSERT(!specifiedMajorAxisAutoGridItems.size()); |
782 return; | 782 return; |
783 } | 783 } |
784 | 784 |
785 placeSpecifiedMajorAxisItemsOnGrid(specifiedMajorAxisAutoGridItems); | 785 placeSpecifiedMajorAxisItemsOnGrid(specifiedMajorAxisAutoGridItems); |
786 placeAutoMajorAxisItemsOnGrid(autoMajorAxisAutoGridItems); | 786 placeAutoMajorAxisItemsOnGrid(autoMajorAxisAutoGridItems); |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 if (isOutOfFlowPositioned()) | 1315 if (isOutOfFlowPositioned()) |
1316 return "RenderGrid (positioned)"; | 1316 return "RenderGrid (positioned)"; |
1317 if (isAnonymous()) | 1317 if (isAnonymous()) |
1318 return "RenderGrid (generated)"; | 1318 return "RenderGrid (generated)"; |
1319 if (isRelPositioned()) | 1319 if (isRelPositioned()) |
1320 return "RenderGrid (relative positioned)"; | 1320 return "RenderGrid (relative positioned)"; |
1321 return "RenderGrid"; | 1321 return "RenderGrid"; |
1322 } | 1322 } |
1323 | 1323 |
1324 } // namespace WebCore | 1324 } // namespace WebCore |
OLD | NEW |