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

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

Issue 2336663002: [css-grid] Too many gaps with trailing collapsing tracks (Closed)
Patch Set: Patch for landing 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 | « third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-auto-fit-columns.html ('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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 // the grid (so the gap becomes 0) or there is a non empty track before that . 558 // the grid (so the gap becomes 0) or there is a non empty track before that .
559 559
560 LayoutUnit gapAccumulator; 560 LayoutUnit gapAccumulator;
561 size_t endLine = startLine + span; 561 size_t endLine = startLine + span;
562 562
563 for (size_t line = startLine; line < endLine - 1; ++line) { 563 for (size_t line = startLine; line < endLine - 1; ++line) {
564 if (!isEmptyAutoRepeatTrack(direction, line)) 564 if (!isEmptyAutoRepeatTrack(direction, line))
565 gapAccumulator += gap; 565 gapAccumulator += gap;
566 } 566 }
567 567
568 // The above loop adds one extra gap for trailing collapsed tracks.
569 if (gapAccumulator && isEmptyAutoRepeatTrack(direction, endLine - 1)) {
570 DCHECK_GE(gapAccumulator, gap);
571 gapAccumulator -= gap;
572 }
573
568 // If the startLine is the start line of a collapsed track we need to go bac kwards till we reach 574 // If the startLine is the start line of a collapsed track we need to go bac kwards till we reach
569 // a non collapsed track. If we find a non collapsed track we need to add th at gap. 575 // a non collapsed track. If we find a non collapsed track we need to add th at gap.
570 if (startLine && isEmptyAutoRepeatTrack(direction, startLine)) { 576 if (startLine && isEmptyAutoRepeatTrack(direction, startLine)) {
571 size_t nonEmptyTracksBeforeStartLine = startLine; 577 size_t nonEmptyTracksBeforeStartLine = startLine;
572 auto begin = isRowAxis ? m_autoRepeatEmptyColumns->begin() : m_autoRepea tEmptyRows->begin(); 578 auto begin = isRowAxis ? m_autoRepeatEmptyColumns->begin() : m_autoRepea tEmptyRows->begin();
573 for (auto it = begin; *it != startLine; ++it) { 579 for (auto it = begin; *it != startLine; ++it) {
574 DCHECK(nonEmptyTracksBeforeStartLine); 580 DCHECK(nonEmptyTracksBeforeStartLine);
575 --nonEmptyTracksBeforeStartLine; 581 --nonEmptyTracksBeforeStartLine;
576 } 582 }
577 if (nonEmptyTracksBeforeStartLine) 583 if (nonEmptyTracksBeforeStartLine)
(...skipping 2084 matching lines...) Expand 10 before | Expand all | Expand 10 after
2662 return isOrthogonalChild(child) ? childLocation.transposedPoint() : childLoc ation; 2668 return isOrthogonalChild(child) ? childLocation.transposedPoint() : childLoc ation;
2663 } 2669 }
2664 2670
2665 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const 2671 void LayoutGrid::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& pa intOffset) const
2666 { 2672 {
2667 if (!m_gridItemArea.isEmpty()) 2673 if (!m_gridItemArea.isEmpty())
2668 GridPainter(*this).paintChildren(paintInfo, paintOffset); 2674 GridPainter(*this).paintChildren(paintInfo, paintOffset);
2669 } 2675 }
2670 2676
2671 } // namespace blink 2677 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-auto-fit-columns.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698