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

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

Issue 23472008: [CSS Grid Layout] Support calc() breadth track size (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@103761-wk
Patch Set: Created 7 years, 3 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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 } 404 }
405 } 405 }
406 406
407 LayoutUnit RenderGrid::computeUsedBreadthOfMinLength(TrackSizingDirection direct ion, const GridLength& gridLength) const 407 LayoutUnit RenderGrid::computeUsedBreadthOfMinLength(TrackSizingDirection direct ion, const GridLength& gridLength) const
408 { 408 {
409 if (gridLength.isFlex()) 409 if (gridLength.isFlex())
410 return 0; 410 return 0;
411 411
412 const Length& trackLength = gridLength.length(); 412 const Length& trackLength = gridLength.length();
413 ASSERT(!trackLength.isAuto()); 413 ASSERT(!trackLength.isAuto());
414 if (trackLength.isFixed() || trackLength.isPercent() || trackLength.isViewpo rtPercentage()) 414 if (trackLength.isFixed() || trackLength.isPercent() || trackLength.isViewpo rtPercentage() || trackLength.isCalculated())
Julien - ping for review 2013/09/24 19:09:16 trackLength.isSpecified() :)
415 return computeUsedBreadthOfSpecifiedLength(direction, trackLength); 415 return computeUsedBreadthOfSpecifiedLength(direction, trackLength);
416 416
417 ASSERT(trackLength.isMinContent() || trackLength.isMaxContent()); 417 ASSERT(trackLength.isMinContent() || trackLength.isMaxContent());
418 return 0; 418 return 0;
419 } 419 }
420 420
421 LayoutUnit RenderGrid::computeUsedBreadthOfMaxLength(TrackSizingDirection direct ion, const GridLength& gridLength, LayoutUnit usedBreadth) const 421 LayoutUnit RenderGrid::computeUsedBreadthOfMaxLength(TrackSizingDirection direct ion, const GridLength& gridLength, LayoutUnit usedBreadth) const
422 { 422 {
423 if (gridLength.isFlex()) 423 if (gridLength.isFlex())
424 return usedBreadth; 424 return usedBreadth;
425 425
426 const Length& trackLength = gridLength.length(); 426 const Length& trackLength = gridLength.length();
427 ASSERT(!trackLength.isAuto()); 427 ASSERT(!trackLength.isAuto());
428 if (trackLength.isFixed() || trackLength.isPercent() || trackLength.isViewpo rtPercentage()) { 428 if (trackLength.isFixed() || trackLength.isPercent() || trackLength.isViewpo rtPercentage() || trackLength.isCalculated()) {
Julien - ping for review 2013/09/24 19:09:16 Ditto.
429 LayoutUnit computedBreadth = computeUsedBreadthOfSpecifiedLength(directi on, trackLength); 429 LayoutUnit computedBreadth = computeUsedBreadthOfSpecifiedLength(directi on, trackLength);
430 ASSERT(computedBreadth != infinity); 430 ASSERT(computedBreadth != infinity);
431 return computedBreadth; 431 return computedBreadth;
432 } 432 }
433 433
434 ASSERT(trackLength.isMinContent() || trackLength.isMaxContent()); 434 ASSERT(trackLength.isMinContent() || trackLength.isMaxContent());
435 return infinity; 435 return infinity;
436 } 436 }
437 437
438 LayoutUnit RenderGrid::computeUsedBreadthOfSpecifiedLength(TrackSizingDirection direction, const Length& trackLength) const 438 LayoutUnit RenderGrid::computeUsedBreadthOfSpecifiedLength(TrackSizingDirection direction, const Length& trackLength) const
439 { 439 {
440 // FIXME: We still need to support calc() here (https://webkit.org/b/103761) . 440 ASSERT(trackLength.isFixed() || trackLength.isPercent() || trackLength.isVie wportPercentage() || trackLength.isCalculated());
Julien - ping for review 2013/09/24 19:09:16 Ditto.
441 ASSERT(trackLength.isFixed() || trackLength.isPercent() || trackLength.isVie wportPercentage());
442 // FIXME: The -1 here should be replaced by whatever the intrinsic height of the grid is. 441 // FIXME: The -1 here should be replaced by whatever the intrinsic height of the grid is.
443 return valueForLength(trackLength, direction == ForColumns ? logicalWidth() : computeContentLogicalHeight(style()->logicalHeight(), -1), view()); 442 return valueForLength(trackLength, direction == ForColumns ? logicalWidth() : computeContentLogicalHeight(style()->logicalHeight(), -1), view());
444 } 443 }
445 444
446 static bool sortByGridNormalizedFlexValue(const GridTrackForNormalization& track 1, const GridTrackForNormalization& track2) 445 static bool sortByGridNormalizedFlexValue(const GridTrackForNormalization& track 1, const GridTrackForNormalization& track2)
447 { 446 {
448 return track1.m_normalizedFlexValue < track2.m_normalizedFlexValue; 447 return track1.m_normalizedFlexValue < track2.m_normalizedFlexValue;
449 } 448 }
450 449
451 double RenderGrid::computeNormalizedFractionBreadth(Vector<GridTrack>& tracks, T rackSizingDirection direction, LayoutUnit availableLogicalSpace) const 450 double RenderGrid::computeNormalizedFractionBreadth(Vector<GridTrack>& tracks, T rackSizingDirection direction, LayoutUnit availableLogicalSpace) const
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 if (isOutOfFlowPositioned()) 1189 if (isOutOfFlowPositioned())
1191 return "RenderGrid (positioned)"; 1190 return "RenderGrid (positioned)";
1192 if (isAnonymous()) 1191 if (isAnonymous())
1193 return "RenderGrid (generated)"; 1192 return "RenderGrid (generated)";
1194 if (isRelPositioned()) 1193 if (isRelPositioned())
1195 return "RenderGrid (relative positioned)"; 1194 return "RenderGrid (relative positioned)";
1196 return "RenderGrid"; 1195 return "RenderGrid";
1197 } 1196 }
1198 1197
1199 } // namespace WebCore 1198 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698