| 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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 { | 594 { |
| 595 return (direction == ForRows) ? hasDefiniteLogicalHeight() : hasDefiniteLogi
calWidth(); | 595 return (direction == ForRows) ? hasDefiniteLogicalHeight() : hasDefiniteLogi
calWidth(); |
| 596 } | 596 } |
| 597 | 597 |
| 598 GridTrackSize LayoutGrid::gridTrackSize(GridTrackSizingDirection direction, size
_t i) const | 598 GridTrackSize LayoutGrid::gridTrackSize(GridTrackSizingDirection direction, size
_t i) const |
| 599 { | 599 { |
| 600 bool isForColumns = direction == ForColumns; | 600 bool isForColumns = direction == ForColumns; |
| 601 const Vector<GridTrackSize>& trackStyles = isForColumns ? style()->gridTempl
ateColumns() : style()->gridTemplateRows(); | 601 const Vector<GridTrackSize>& trackStyles = isForColumns ? style()->gridTempl
ateColumns() : style()->gridTemplateRows(); |
| 602 const GridTrackSize& trackSize = (i >= trackStyles.size()) ? (isForColumns ?
style()->gridAutoColumns() : style()->gridAutoRows()) : trackStyles[i]; | 602 const GridTrackSize& trackSize = (i >= trackStyles.size()) ? (isForColumns ?
style()->gridAutoColumns() : style()->gridAutoRows()) : trackStyles[i]; |
| 603 | 603 |
| 604 GridLength minTrackBreadth = trackSize.minTrackBreadth(); |
| 605 GridLength maxTrackBreadth = trackSize.maxTrackBreadth(); |
| 606 |
| 604 // If the logical width/height of the grid container is indefinite, percenta
ge values are treated as <auto> (or in | 607 // If the logical width/height of the grid container is indefinite, percenta
ge values are treated as <auto> (or in |
| 605 // the case of minmax() as min-content for the first position and max-conten
t for the second). | 608 // the case of minmax() as min-content for the first position and max-conten
t for the second). |
| 606 if (!hasDefiniteLogicalSize(direction)) { | 609 if (minTrackBreadth.isPercentage() || maxTrackBreadth.isPercentage()) { |
| 607 const GridLength& oldMinTrackBreadth = trackSize.minTrackBreadth(); | 610 if (!hasDefiniteLogicalSize(direction)) { |
| 608 const GridLength& oldMaxTrackBreadth = trackSize.maxTrackBreadth(); | 611 if (minTrackBreadth.isPercentage()) |
| 609 return GridTrackSize(oldMinTrackBreadth.isPercentage() ? Length(MinConte
nt) : oldMinTrackBreadth, oldMaxTrackBreadth.isPercentage() ? Length(MaxContent)
: oldMaxTrackBreadth); | 612 minTrackBreadth = Length(MinContent); |
| 613 if (maxTrackBreadth.isPercentage()) |
| 614 maxTrackBreadth = Length(MaxContent); |
| 615 } |
| 610 } | 616 } |
| 611 | 617 |
| 612 return trackSize; | 618 return GridTrackSize(minTrackBreadth, maxTrackBreadth); |
| 613 } | 619 } |
| 614 | 620 |
| 615 LayoutUnit LayoutGrid::logicalHeightForChild(LayoutBox& child, Vector<GridTrack>
& columnTracks) | 621 LayoutUnit LayoutGrid::logicalHeightForChild(LayoutBox& child, Vector<GridTrack>
& columnTracks) |
| 616 { | 622 { |
| 617 SubtreeLayoutScope layoutScope(child); | 623 SubtreeLayoutScope layoutScope(child); |
| 618 LayoutUnit oldOverrideContainingBlockContentLogicalWidth = child.hasOverride
ContainingBlockLogicalWidth() ? child.overrideContainingBlockContentLogicalWidth
() : LayoutUnit(); | 624 LayoutUnit oldOverrideContainingBlockContentLogicalWidth = child.hasOverride
ContainingBlockLogicalWidth() ? child.overrideContainingBlockContentLogicalWidth
() : LayoutUnit(); |
| 619 LayoutUnit overrideContainingBlockContentLogicalWidth = gridAreaBreadthForCh
ild(child, ForColumns, columnTracks); | 625 LayoutUnit overrideContainingBlockContentLogicalWidth = gridAreaBreadthForCh
ild(child, ForColumns, columnTracks); |
| 620 if (child.style()->logicalHeight().isPercent() || oldOverrideContainingBlock
ContentLogicalWidth != overrideContainingBlockContentLogicalWidth) | 626 if (child.style()->logicalHeight().isPercent() || oldOverrideContainingBlock
ContentLogicalWidth != overrideContainingBlockContentLogicalWidth) |
| 621 layoutScope.setNeedsLayout(&child); | 627 layoutScope.setNeedsLayout(&child); |
| 622 | 628 |
| (...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1745 if (isOutOfFlowPositioned()) | 1751 if (isOutOfFlowPositioned()) |
| 1746 return "LayoutGrid (positioned)"; | 1752 return "LayoutGrid (positioned)"; |
| 1747 if (isAnonymous()) | 1753 if (isAnonymous()) |
| 1748 return "LayoutGrid (generated)"; | 1754 return "LayoutGrid (generated)"; |
| 1749 if (isRelPositioned()) | 1755 if (isRelPositioned()) |
| 1750 return "LayoutGrid (relative positioned)"; | 1756 return "LayoutGrid (relative positioned)"; |
| 1751 return "LayoutGrid"; | 1757 return "LayoutGrid"; |
| 1752 } | 1758 } |
| 1753 | 1759 |
| 1754 } // namespace blink | 1760 } // namespace blink |
| OLD | NEW |