| 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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 } | 610 } |
| 611 | 611 |
| 612 return GridTrackSize(minTrackBreadth, maxTrackBreadth); | 612 return GridTrackSize(minTrackBreadth, maxTrackBreadth); |
| 613 } | 613 } |
| 614 | 614 |
| 615 LayoutUnit LayoutGrid::logicalHeightForChild(LayoutBox& child, Vector<GridTrack>
& columnTracks) | 615 LayoutUnit LayoutGrid::logicalHeightForChild(LayoutBox& child, Vector<GridTrack>
& columnTracks) |
| 616 { | 616 { |
| 617 SubtreeLayoutScope layoutScope(child); | 617 SubtreeLayoutScope layoutScope(child); |
| 618 LayoutUnit oldOverrideContainingBlockContentLogicalWidth = child.hasOverride
ContainingBlockLogicalWidth() ? child.overrideContainingBlockContentLogicalWidth
() : LayoutUnit(); | 618 LayoutUnit oldOverrideContainingBlockContentLogicalWidth = child.hasOverride
ContainingBlockLogicalWidth() ? child.overrideContainingBlockContentLogicalWidth
() : LayoutUnit(); |
| 619 LayoutUnit overrideContainingBlockContentLogicalWidth = gridAreaBreadthForCh
ild(child, ForColumns, columnTracks); | 619 LayoutUnit overrideContainingBlockContentLogicalWidth = gridAreaBreadthForCh
ild(child, ForColumns, columnTracks); |
| 620 if (child.style()->logicalHeight().isPercent() || oldOverrideContainingBlock
ContentLogicalWidth != overrideContainingBlockContentLogicalWidth) { | 620 if (child.hasRelativeLogicalHeight() || oldOverrideContainingBlockContentLog
icalWidth != overrideContainingBlockContentLogicalWidth) { |
| 621 layoutScope.setNeedsLayout(&child); | 621 layoutScope.setNeedsLayout(&child); |
| 622 // We need to clear the stretched height to properly compute logical hei
ght during layout. | 622 // We need to clear the stretched height to properly compute logical hei
ght during layout. |
| 623 child.clearOverrideLogicalContentHeight(); | 623 child.clearOverrideLogicalContentHeight(); |
| 624 } | 624 } |
| 625 | 625 |
| 626 child.setOverrideContainingBlockContentLogicalWidth(overrideContainingBlockC
ontentLogicalWidth); | 626 child.setOverrideContainingBlockContentLogicalWidth(overrideContainingBlockC
ontentLogicalWidth); |
| 627 // If |child| has a percentage logical height, we shouldn't let it override
its intrinsic height, which is | 627 // If |child| has a relative logical height, we shouldn't let it override it
s intrinsic height, which is |
| 628 // what we are interested in here. Thus we need to set the override logical
height to -1 (no possible resolution). | 628 // what we are interested in here. Thus we need to set the override logical
height to -1 (no possible resolution). |
| 629 child.setOverrideContainingBlockContentLogicalHeight(-1); | 629 if (child.hasRelativeLogicalHeight()) |
| 630 child.setOverrideContainingBlockContentLogicalHeight(-1); |
| 630 child.layoutIfNeeded(); | 631 child.layoutIfNeeded(); |
| 631 // If the child was stretched we should use its intrinsic height. | 632 // If the child was stretched we should use its intrinsic height. |
| 632 return (child.hasOverrideHeight() ? childIntrinsicHeight(child) : child.logi
calHeight()) + child.marginLogicalHeight(); | 633 return (child.hasOverrideHeight() ? childIntrinsicHeight(child) : child.logi
calHeight()) + child.marginLogicalHeight(); |
| 633 } | 634 } |
| 634 | 635 |
| 635 LayoutUnit LayoutGrid::minContentForChild(LayoutBox& child, GridTrackSizingDirec
tion direction, Vector<GridTrack>& columnTracks) | 636 LayoutUnit LayoutGrid::minContentForChild(LayoutBox& child, GridTrackSizingDirec
tion direction, Vector<GridTrack>& columnTracks) |
| 636 { | 637 { |
| 637 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon
talWritingMode(); | 638 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon
talWritingMode(); |
| 638 // FIXME: Properly support orthogonal writing mode. | 639 // FIXME: Properly support orthogonal writing mode. |
| 639 if (hasOrthogonalWritingMode) | 640 if (hasOrthogonalWritingMode) |
| 640 return 0; | 641 return 0; |
| 641 | 642 |
| 642 if (direction == ForColumns) { | 643 if (direction == ForColumns) { |
| 643 // If |child| has a percentage logical width, we shouldn't let it overri
de its intrinsic width, which is | 644 // If |child| has a relative logical width, we shouldn't let it override
its intrinsic width, which is |
| 644 // what we are interested in here. Thus we need to set the override logi
cal width to -1 (no possible resolution). | 645 // what we are interested in here. Thus we need to set the override logi
cal width to -1 (no possible resolution). |
| 645 if (child.style()->logicalWidth().isPercent()) | 646 if (child.hasRelativeLogicalWidth()) |
| 646 child.setOverrideContainingBlockContentLogicalWidth(-1); | 647 child.setOverrideContainingBlockContentLogicalWidth(-1); |
| 647 | 648 |
| 648 // FIXME: It's unclear if we should return the intrinsic width or the pr
eferred width. | 649 // FIXME: It's unclear if we should return the intrinsic width or the pr
eferred width. |
| 649 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html | 650 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html |
| 650 return child.minPreferredLogicalWidth() + marginIntrinsicLogicalWidthFor
Child(child); | 651 return child.minPreferredLogicalWidth() + marginIntrinsicLogicalWidthFor
Child(child); |
| 651 } | 652 } |
| 652 | 653 |
| 653 return logicalHeightForChild(child, columnTracks); | 654 return logicalHeightForChild(child, columnTracks); |
| 654 } | 655 } |
| 655 | 656 |
| 656 LayoutUnit LayoutGrid::maxContentForChild(LayoutBox& child, GridTrackSizingDirec
tion direction, Vector<GridTrack>& columnTracks) | 657 LayoutUnit LayoutGrid::maxContentForChild(LayoutBox& child, GridTrackSizingDirec
tion direction, Vector<GridTrack>& columnTracks) |
| 657 { | 658 { |
| 658 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon
talWritingMode(); | 659 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon
talWritingMode(); |
| 659 // FIXME: Properly support orthogonal writing mode. | 660 // FIXME: Properly support orthogonal writing mode. |
| 660 if (hasOrthogonalWritingMode) | 661 if (hasOrthogonalWritingMode) |
| 661 return LayoutUnit(); | 662 return LayoutUnit(); |
| 662 | 663 |
| 663 if (direction == ForColumns) { | 664 if (direction == ForColumns) { |
| 664 // If |child| has a percentage logical width, we shouldn't let it overri
de its intrinsic width, which is | 665 // If |child| has a relative logical width, we shouldn't let it override
its intrinsic width, which is |
| 665 // what we are interested in here. Thus we need to set the override logi
cal width to -1 (no possible resolution). | 666 // what we are interested in here. Thus we need to set the override logi
cal width to -1 (no possible resolution). |
| 666 if (child.style()->logicalWidth().isPercent()) | 667 if (child.hasRelativeLogicalWidth()) |
| 667 child.setOverrideContainingBlockContentLogicalWidth(-1); | 668 child.setOverrideContainingBlockContentLogicalWidth(-1); |
| 668 | 669 |
| 669 // FIXME: It's unclear if we should return the intrinsic width or the pr
eferred width. | 670 // FIXME: It's unclear if we should return the intrinsic width or the pr
eferred width. |
| 670 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html | 671 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html |
| 671 return child.maxPreferredLogicalWidth() + marginIntrinsicLogicalWidthFor
Child(child); | 672 return child.maxPreferredLogicalWidth() + marginIntrinsicLogicalWidthFor
Child(child); |
| 672 } | 673 } |
| 673 | 674 |
| 674 return logicalHeightForChild(child, columnTracks); | 675 return logicalHeightForChild(child, columnTracks); |
| 675 } | 676 } |
| 676 | 677 |
| (...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1760 if (isOutOfFlowPositioned()) | 1761 if (isOutOfFlowPositioned()) |
| 1761 return "LayoutGrid (positioned)"; | 1762 return "LayoutGrid (positioned)"; |
| 1762 if (isAnonymous()) | 1763 if (isAnonymous()) |
| 1763 return "LayoutGrid (generated)"; | 1764 return "LayoutGrid (generated)"; |
| 1764 if (isRelPositioned()) | 1765 if (isRelPositioned()) |
| 1765 return "LayoutGrid (relative positioned)"; | 1766 return "LayoutGrid (relative positioned)"; |
| 1766 return "LayoutGrid"; | 1767 return "LayoutGrid"; |
| 1767 } | 1768 } |
| 1768 | 1769 |
| 1769 } // namespace blink | 1770 } // namespace blink |
| OLD | NEW |