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

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: Patch for landing Created 7 years, 1 month 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/css/CSSComputedStyleDeclaration.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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 } 393 }
394 } 394 }
395 395
396 LayoutUnit RenderGrid::computeUsedBreadthOfMinLength(GridTrackSizingDirection di rection, const GridLength& gridLength) const 396 LayoutUnit RenderGrid::computeUsedBreadthOfMinLength(GridTrackSizingDirection di rection, const GridLength& gridLength) const
397 { 397 {
398 if (gridLength.isFlex()) 398 if (gridLength.isFlex())
399 return 0; 399 return 0;
400 400
401 const Length& trackLength = gridLength.length(); 401 const Length& trackLength = gridLength.length();
402 ASSERT(!trackLength.isAuto()); 402 ASSERT(!trackLength.isAuto());
403 if (trackLength.isFixed() || trackLength.isPercent() || trackLength.isViewpo rtPercentage()) 403 if (trackLength.isSpecified())
404 return computeUsedBreadthOfSpecifiedLength(direction, trackLength); 404 return computeUsedBreadthOfSpecifiedLength(direction, trackLength);
405 405
406 ASSERT(trackLength.isMinContent() || trackLength.isMaxContent()); 406 ASSERT(trackLength.isMinContent() || trackLength.isMaxContent());
407 return 0; 407 return 0;
408 } 408 }
409 409
410 LayoutUnit RenderGrid::computeUsedBreadthOfMaxLength(GridTrackSizingDirection di rection, const GridLength& gridLength, LayoutUnit usedBreadth) const 410 LayoutUnit RenderGrid::computeUsedBreadthOfMaxLength(GridTrackSizingDirection di rection, const GridLength& gridLength, LayoutUnit usedBreadth) const
411 { 411 {
412 if (gridLength.isFlex()) 412 if (gridLength.isFlex())
413 return usedBreadth; 413 return usedBreadth;
414 414
415 const Length& trackLength = gridLength.length(); 415 const Length& trackLength = gridLength.length();
416 ASSERT(!trackLength.isAuto()); 416 ASSERT(!trackLength.isAuto());
417 if (trackLength.isFixed() || trackLength.isPercent() || trackLength.isViewpo rtPercentage()) { 417 if (trackLength.isSpecified()) {
418 LayoutUnit computedBreadth = computeUsedBreadthOfSpecifiedLength(directi on, trackLength); 418 LayoutUnit computedBreadth = computeUsedBreadthOfSpecifiedLength(directi on, trackLength);
419 ASSERT(computedBreadth != infinity); 419 ASSERT(computedBreadth != infinity);
420 return computedBreadth; 420 return computedBreadth;
421 } 421 }
422 422
423 ASSERT(trackLength.isMinContent() || trackLength.isMaxContent()); 423 ASSERT(trackLength.isMinContent() || trackLength.isMaxContent());
424 return infinity; 424 return infinity;
425 } 425 }
426 426
427 LayoutUnit RenderGrid::computeUsedBreadthOfSpecifiedLength(GridTrackSizingDirect ion direction, const Length& trackLength) const 427 LayoutUnit RenderGrid::computeUsedBreadthOfSpecifiedLength(GridTrackSizingDirect ion direction, const Length& trackLength) const
428 { 428 {
429 // FIXME: We still need to support calc() here (https://webkit.org/b/103761) . 429 ASSERT(trackLength.isSpecified());
430 ASSERT(trackLength.isFixed() || trackLength.isPercent() || trackLength.isVie wportPercentage());
431 // FIXME: The -1 here should be replaced by whatever the intrinsic height of the grid is. 430 // FIXME: The -1 here should be replaced by whatever the intrinsic height of the grid is.
432 return valueForLength(trackLength, direction == ForColumns ? logicalWidth() : computeContentLogicalHeight(style()->logicalHeight(), -1), view()); 431 return valueForLength(trackLength, direction == ForColumns ? logicalWidth() : computeContentLogicalHeight(style()->logicalHeight(), -1), view());
433 } 432 }
434 433
435 static bool sortByGridNormalizedFlexValue(const GridTrackForNormalization& track 1, const GridTrackForNormalization& track2) 434 static bool sortByGridNormalizedFlexValue(const GridTrackForNormalization& track 1, const GridTrackForNormalization& track2)
436 { 435 {
437 return track1.m_normalizedFlexValue < track2.m_normalizedFlexValue; 436 return track1.m_normalizedFlexValue < track2.m_normalizedFlexValue;
438 } 437 }
439 438
440 double RenderGrid::computeNormalizedFractionBreadth(Vector<GridTrack>& tracks, G ridTrackSizingDirection direction, LayoutUnit availableLogicalSpace) const 439 double RenderGrid::computeNormalizedFractionBreadth(Vector<GridTrack>& tracks, G ridTrackSizingDirection direction, LayoutUnit availableLogicalSpace) const
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 if (isOutOfFlowPositioned()) 1142 if (isOutOfFlowPositioned())
1144 return "RenderGrid (positioned)"; 1143 return "RenderGrid (positioned)";
1145 if (isAnonymous()) 1144 if (isAnonymous())
1146 return "RenderGrid (generated)"; 1145 return "RenderGrid (generated)";
1147 if (isRelPositioned()) 1146 if (isRelPositioned())
1148 return "RenderGrid (relative positioned)"; 1147 return "RenderGrid (relative positioned)";
1149 return "RenderGrid"; 1148 return "RenderGrid";
1150 } 1149 }
1151 1150
1152 } // namespace WebCore 1151 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/CSSComputedStyleDeclaration.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698