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

Side by Side Diff: Source/core/rendering/RenderGrid.cpp

Issue 906323003: [CSS Grid Layout] Columns set in percentages collapse to auto width (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@sergio-indefinite
Patch Set: 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
« no previous file with comments | « Source/core/rendering/RenderGrid.h ('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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 } 583 }
584 584
585 accumulatedFractions += track.m_flex; 585 accumulatedFractions += track.m_flex;
586 // This item was processed so we re-add its used breadth to the availabl e space to accurately count the remaining space. 586 // This item was processed so we re-add its used breadth to the availabl e space to accurately count the remaining space.
587 availableLogicalSpaceIgnoringFractionTracks += track.m_track->baseSize() ; 587 availableLogicalSpaceIgnoringFractionTracks += track.m_track->baseSize() ;
588 } 588 }
589 589
590 return availableLogicalSpaceIgnoringFractionTracks / accumulatedFractions; 590 return availableLogicalSpaceIgnoringFractionTracks / accumulatedFractions;
591 } 591 }
592 592
593 bool RenderGrid::hasDefiniteLogicalSize(GridTrackSizingDirection direction) cons t
594 {
595 return (direction == ForRows) ? hasDefiniteLogicalHeight() : hasDefiniteLogi calWidth();
596 }
597
593 GridTrackSize RenderGrid::gridTrackSize(GridTrackSizingDirection direction, size _t i) const 598 GridTrackSize RenderGrid::gridTrackSize(GridTrackSizingDirection direction, size _t i) const
594 { 599 {
595 bool isForColumns = direction == ForColumns; 600 bool isForColumns = direction == ForColumns;
596 const Vector<GridTrackSize>& trackStyles = isForColumns ? style()->gridTempl ateColumns() : style()->gridTemplateRows(); 601 const Vector<GridTrackSize>& trackStyles = isForColumns ? style()->gridTempl ateColumns() : style()->gridTemplateRows();
597 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];
598 603
599 // If the logical width/height of the grid container is indefinite, percenta ge values are treated as <auto> (or in 604 // If the logical width/height of the grid container is indefinite, percenta ge values are treated as <auto> (or in
600 // the case of minmax() as min-content for the first position and max-conten t for the second). 605 // the case of minmax() as min-content for the first position and max-conten t for the second).
601 Length logicalSize = isForColumns ? style()->logicalWidth() : style()->logic alHeight(); 606 if (!hasDefiniteLogicalSize(direction)) {
602 // FIXME: isIntrinsicOrAuto() does not fulfil the 'indefinite size' descript ion as it does not include <percentage>
603 // of indefinite sizes. This is a broather issue as Length does not have the required context to support it.
604 if (logicalSize.isIntrinsicOrAuto()) {
605 const GridLength& oldMinTrackBreadth = trackSize.minTrackBreadth(); 607 const GridLength& oldMinTrackBreadth = trackSize.minTrackBreadth();
606 const GridLength& oldMaxTrackBreadth = trackSize.maxTrackBreadth(); 608 const GridLength& oldMaxTrackBreadth = trackSize.maxTrackBreadth();
607 return GridTrackSize(oldMinTrackBreadth.isPercentage() ? Length(MinConte nt) : oldMinTrackBreadth, oldMaxTrackBreadth.isPercentage() ? Length(MaxContent) : oldMaxTrackBreadth); 609 return GridTrackSize(oldMinTrackBreadth.isPercentage() ? Length(MinConte nt) : oldMinTrackBreadth, oldMaxTrackBreadth.isPercentage() ? Length(MaxContent) : oldMaxTrackBreadth);
608 } 610 }
609 611
610 return trackSize; 612 return trackSize;
611 } 613 }
612 614
613 LayoutUnit RenderGrid::logicalHeightForChild(RenderBox& child, Vector<GridTrack> & columnTracks) 615 LayoutUnit RenderGrid::logicalHeightForChild(RenderBox& child, Vector<GridTrack> & columnTracks)
614 { 616 {
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1730 if (isOutOfFlowPositioned()) 1732 if (isOutOfFlowPositioned())
1731 return "RenderGrid (positioned)"; 1733 return "RenderGrid (positioned)";
1732 if (isAnonymous()) 1734 if (isAnonymous())
1733 return "RenderGrid (generated)"; 1735 return "RenderGrid (generated)";
1734 if (isRelPositioned()) 1736 if (isRelPositioned())
1735 return "RenderGrid (relative positioned)"; 1737 return "RenderGrid (relative positioned)";
1736 return "RenderGrid"; 1738 return "RenderGrid";
1737 } 1739 }
1738 1740
1739 } // namespace blink 1741 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderGrid.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698