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

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

Issue 2325573003: [css-grid] Avoid computing available space if gap is not a percentage (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 525
526 bool LayoutGrid::isEmptyAutoRepeatTrack(GridTrackSizingDirection direction, size _t line) const 526 bool LayoutGrid::isEmptyAutoRepeatTrack(GridTrackSizingDirection direction, size _t line) const
527 { 527 {
528 DCHECK(hasAutoRepeatEmptyTracks(direction)); 528 DCHECK(hasAutoRepeatEmptyTracks(direction));
529 return direction == ForColumns ? m_autoRepeatEmptyColumns->contains(line) : m_autoRepeatEmptyRows->contains(line); 529 return direction == ForColumns ? m_autoRepeatEmptyColumns->contains(line) : m_autoRepeatEmptyRows->contains(line);
530 } 530 }
531 531
532 LayoutUnit LayoutGrid::gridGapForDirection(GridTrackSizingDirection direction, S izingOperation sizingOperation) const 532 LayoutUnit LayoutGrid::gridGapForDirection(GridTrackSizingDirection direction, S izingOperation sizingOperation) const
533 { 533 {
534 LayoutUnit availableSize; 534 LayoutUnit availableSize;
535 if (sizingOperation == TrackSizing) 535 const Length& gap = direction == ForColumns ? styleRef().gridColumnGap() : s tyleRef().gridRowGap();
536 if (sizingOperation == TrackSizing && gap.isPercent())
536 availableSize = direction == ForColumns ? availableLogicalWidth() : avai lableLogicalHeightForPercentageComputation(); 537 availableSize = direction == ForColumns ? availableLogicalWidth() : avai lableLogicalHeightForPercentageComputation();
537 538
538 // TODO(rego): Maybe we could cache the computed percentage as a performance improvement. 539 // TODO(rego): Maybe we could cache the computed percentage as a performance improvement.
539 return valueForLength(direction == ForColumns ? styleRef().gridColumnGap() : styleRef().gridRowGap(), availableSize); 540 return valueForLength(gap, availableSize);
540 } 541 }
541 542
542 LayoutUnit LayoutGrid::guttersSize(GridTrackSizingDirection direction, size_t st artLine, size_t span, SizingOperation sizingOperation) const 543 LayoutUnit LayoutGrid::guttersSize(GridTrackSizingDirection direction, size_t st artLine, size_t span, SizingOperation sizingOperation) const
543 { 544 {
544 if (span <= 1) 545 if (span <= 1)
545 return LayoutUnit(); 546 return LayoutUnit();
546 547
547 bool isRowAxis = direction == ForColumns; 548 bool isRowAxis = direction == ForColumns;
548 LayoutUnit gap = gridGapForDirection(direction, sizingOperation); 549 LayoutUnit gap = gridGapForDirection(direction, sizingOperation);
549 550
(...skipping 2111 matching lines...) Expand 10 before | Expand all | Expand 10 after
2661 return isOrthogonalChild(child) ? childLocation.transposedPoint() : childLoc ation; 2662 return isOrthogonalChild(child) ? childLocation.transposedPoint() : childLoc ation;
2662 } 2663 }
2663 2664
2664 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const 2665 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const
2665 { 2666 {
2666 if (!m_gridItemArea.isEmpty()) 2667 if (!m_gridItemArea.isEmpty())
2667 GridPainter(*this).paintChildren(paintInfo, paintOffset); 2668 GridPainter(*this).paintChildren(paintInfo, paintOffset);
2668 } 2669 }
2669 2670
2670 } // namespace blink 2671 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698