Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: Source/core/layout/LayoutGrid.cpp

Issue 914993003: [CSS Grid Layout] Determine definite/indefinite size properly in nested grids (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rename isRenderView() calls to isLayoutView() Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/layout/LayoutBox.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 } 625 }
626 626
627 LayoutUnit LayoutGrid::minContentForChild(LayoutBox& child, GridTrackSizingDirec tion direction, Vector<GridTrack>& columnTracks) 627 LayoutUnit LayoutGrid::minContentForChild(LayoutBox& child, GridTrackSizingDirec tion direction, Vector<GridTrack>& columnTracks)
628 { 628 {
629 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); 629 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode();
630 // FIXME: Properly support orthogonal writing mode. 630 // FIXME: Properly support orthogonal writing mode.
631 if (hasOrthogonalWritingMode) 631 if (hasOrthogonalWritingMode)
632 return 0; 632 return 0;
633 633
634 if (direction == ForColumns) { 634 if (direction == ForColumns) {
635 // If |child| has a percentage logical width, we shouldn't let it overri de its intrinsic width, which is
636 // what we are interested in here. Thus we need to set the override logi cal width to -1 (no possible resolution).
637 if (child.style()->logicalWidth().isPercent())
638 child.setOverrideContainingBlockContentLogicalWidth(-1);
639
635 // FIXME: It's unclear if we should return the intrinsic width or the pr eferred width. 640 // FIXME: It's unclear if we should return the intrinsic width or the pr eferred width.
636 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html 641 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html
637 return child.minPreferredLogicalWidth() + marginIntrinsicLogicalWidthFor Child(child); 642 return child.minPreferredLogicalWidth() + marginIntrinsicLogicalWidthFor Child(child);
638 } 643 }
639 644
640 return logicalHeightForChild(child, columnTracks); 645 return logicalHeightForChild(child, columnTracks);
641 } 646 }
642 647
643 LayoutUnit LayoutGrid::maxContentForChild(LayoutBox& child, GridTrackSizingDirec tion direction, Vector<GridTrack>& columnTracks) 648 LayoutUnit LayoutGrid::maxContentForChild(LayoutBox& child, GridTrackSizingDirec tion direction, Vector<GridTrack>& columnTracks)
644 { 649 {
645 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); 650 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode();
646 // FIXME: Properly support orthogonal writing mode. 651 // FIXME: Properly support orthogonal writing mode.
647 if (hasOrthogonalWritingMode) 652 if (hasOrthogonalWritingMode)
648 return LayoutUnit(); 653 return LayoutUnit();
649 654
650 if (direction == ForColumns) { 655 if (direction == ForColumns) {
656 // If |child| has a percentage logical width, we shouldn't let it overri de its intrinsic width, which is
657 // what we are interested in here. Thus we need to set the override logi cal width to -1 (no possible resolution).
658 if (child.style()->logicalWidth().isPercent())
659 child.setOverrideContainingBlockContentLogicalWidth(-1);
660
651 // FIXME: It's unclear if we should return the intrinsic width or the pr eferred width. 661 // FIXME: It's unclear if we should return the intrinsic width or the pr eferred width.
652 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html 662 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html
653 return child.maxPreferredLogicalWidth() + marginIntrinsicLogicalWidthFor Child(child); 663 return child.maxPreferredLogicalWidth() + marginIntrinsicLogicalWidthFor Child(child);
654 } 664 }
655 665
656 return logicalHeightForChild(child, columnTracks); 666 return logicalHeightForChild(child, columnTracks);
657 } 667 }
658 668
659 // We're basically using a class instead of a std::pair for two reasons. First o f all, accessing gridItem() or 669 // We're basically using a class instead of a std::pair for two reasons. First o f all, accessing gridItem() or
660 // coordinate() is much more self-explanatory that using .first or .second membe rs in the pair. Secondly the class 670 // coordinate() is much more self-explanatory that using .first or .second membe rs in the pair. Secondly the class
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 if (isOutOfFlowPositioned()) 1752 if (isOutOfFlowPositioned())
1743 return "LayoutGrid (positioned)"; 1753 return "LayoutGrid (positioned)";
1744 if (isAnonymous()) 1754 if (isAnonymous())
1745 return "LayoutGrid (generated)"; 1755 return "LayoutGrid (generated)";
1746 if (isRelPositioned()) 1756 if (isRelPositioned())
1747 return "LayoutGrid (relative positioned)"; 1757 return "LayoutGrid (relative positioned)";
1748 return "LayoutGrid"; 1758 return "LayoutGrid";
1749 } 1759 }
1750 1760
1751 } // namespace blink 1761 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutBox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698