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

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: New version Created 5 years, 10 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
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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 } 631 }
632 632
633 LayoutUnit LayoutGrid::minContentForChild(LayoutBox& child, GridTrackSizingDirec tion direction, Vector<GridTrack>& columnTracks) 633 LayoutUnit LayoutGrid::minContentForChild(LayoutBox& child, GridTrackSizingDirec tion direction, Vector<GridTrack>& columnTracks)
634 { 634 {
635 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); 635 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode();
636 // FIXME: Properly support orthogonal writing mode. 636 // FIXME: Properly support orthogonal writing mode.
637 if (hasOrthogonalWritingMode) 637 if (hasOrthogonalWritingMode)
638 return 0; 638 return 0;
639 639
640 if (direction == ForColumns) { 640 if (direction == ForColumns) {
641 // If |child| has a percentage logical width, we shouldn't let it overri de its intrinsic width, which is
642 // what we are interested in here. Thus we need to set the override logi cal width to -1 (no possible resolution).
643 if (child.style()->logicalWidth().isPercent())
644 child.setOverrideContainingBlockContentLogicalWidth(-1);
Julien - ping for review 2015/02/27 02:07:03 Our need to change the override constantly means t
Manuel Rego 2015/02/27 08:48:50 I agree. We should try to find a best alternative
645
Manuel Rego 2015/02/25 16:57:59 In addition to previous changes I needed to add th
641 // FIXME: It's unclear if we should return the intrinsic width or the pr eferred width. 646 // FIXME: It's unclear if we should return the intrinsic width or the pr eferred width.
642 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html 647 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html
643 return child.minPreferredLogicalWidth() + marginIntrinsicLogicalWidthFor Child(child); 648 return child.minPreferredLogicalWidth() + marginIntrinsicLogicalWidthFor Child(child);
644 } 649 }
645 650
646 return logicalHeightForChild(child, columnTracks); 651 return logicalHeightForChild(child, columnTracks);
647 } 652 }
648 653
649 LayoutUnit LayoutGrid::maxContentForChild(LayoutBox& child, GridTrackSizingDirec tion direction, Vector<GridTrack>& columnTracks) 654 LayoutUnit LayoutGrid::maxContentForChild(LayoutBox& child, GridTrackSizingDirec tion direction, Vector<GridTrack>& columnTracks)
650 { 655 {
651 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode(); 656 bool hasOrthogonalWritingMode = child.isHorizontalWritingMode() != isHorizon talWritingMode();
652 // FIXME: Properly support orthogonal writing mode. 657 // FIXME: Properly support orthogonal writing mode.
653 if (hasOrthogonalWritingMode) 658 if (hasOrthogonalWritingMode)
654 return LayoutUnit(); 659 return LayoutUnit();
655 660
656 if (direction == ForColumns) { 661 if (direction == ForColumns) {
662 // If |child| has a percentage logical width, we shouldn't let it overri de its intrinsic width, which is
663 // what we are interested in here. Thus we need to set the override logi cal width to -1 (no possible resolution).
664 if (child.style()->logicalWidth().isPercent())
665 child.setOverrideContainingBlockContentLogicalWidth(-1);
666
657 // FIXME: It's unclear if we should return the intrinsic width or the pr eferred width. 667 // FIXME: It's unclear if we should return the intrinsic width or the pr eferred width.
658 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html 668 // See http://lists.w3.org/Archives/Public/www-style/2013Jan/0245.html
659 return child.maxPreferredLogicalWidth() + marginIntrinsicLogicalWidthFor Child(child); 669 return child.maxPreferredLogicalWidth() + marginIntrinsicLogicalWidthFor Child(child);
660 } 670 }
661 671
662 return logicalHeightForChild(child, columnTracks); 672 return logicalHeightForChild(child, columnTracks);
663 } 673 }
664 674
665 // We're basically using a class instead of a std::pair for two reasons. First o f all, accessing gridItem() or 675 // We're basically using a class instead of a std::pair for two reasons. First o f all, accessing gridItem() or
666 // coordinate() is much more self-explanatory that using .first or .second membe rs in the pair. Secondly the class 676 // coordinate() is much more self-explanatory that using .first or .second membe rs in the pair. Secondly the class
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
1745 if (isOutOfFlowPositioned()) 1755 if (isOutOfFlowPositioned())
1746 return "LayoutGrid (positioned)"; 1756 return "LayoutGrid (positioned)";
1747 if (isAnonymous()) 1757 if (isAnonymous())
1748 return "LayoutGrid (generated)"; 1758 return "LayoutGrid (generated)";
1749 if (isRelPositioned()) 1759 if (isRelPositioned())
1750 return "LayoutGrid (relative positioned)"; 1760 return "LayoutGrid (relative positioned)";
1751 return "LayoutGrid"; 1761 return "LayoutGrid";
1752 } 1762 }
1753 1763
1754 } // namespace blink 1764 } // namespace blink
OLDNEW
« Source/core/layout/LayoutBox.h ('K') | « Source/core/layout/LayoutBox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698