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

Side by Side Diff: third_party/WebKit/Source/core/paint/GridPainter.cpp

Issue 2617783002: Migrate WTF::Vector::append() to ::push_back() [part 12 of N] (Closed)
Patch Set: rebase Created 3 years, 11 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/paint/GridPainter.h" 5 #include "core/paint/GridPainter.h"
6 6
7 #include "core/layout/LayoutGrid.h" 7 #include "core/layout/LayoutGrid.h"
8 #include "core/paint/BlockPainter.h" 8 #include "core/paint/BlockPainter.h"
9 #include "core/paint/PaintInfo.h" 9 #include "core/paint/PaintInfo.h"
10 #include <algorithm> 10 #include <algorithm>
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 lastLine - dirtiedColumns.startLine()); 77 lastLine - dirtiedColumns.startLine());
78 } 78 }
79 79
80 Vector<std::pair<LayoutBox*, size_t>> gridItemsToBePainted; 80 Vector<std::pair<LayoutBox*, size_t>> gridItemsToBePainted;
81 81
82 for (const auto& row : dirtiedRows) { 82 for (const auto& row : dirtiedRows) {
83 for (const auto& column : dirtiedColumns) { 83 for (const auto& column : dirtiedColumns) {
84 const Vector<LayoutBox*, 1>& children = 84 const Vector<LayoutBox*, 1>& children =
85 m_layoutGrid.gridCell(row, column); 85 m_layoutGrid.gridCell(row, column);
86 for (auto* child : children) 86 for (auto* child : children)
87 gridItemsToBePainted.append( 87 gridItemsToBePainted.push_back(
88 std::make_pair(child, m_layoutGrid.paintIndexForGridItem(child))); 88 std::make_pair(child, m_layoutGrid.paintIndexForGridItem(child)));
89 } 89 }
90 } 90 }
91 91
92 for (auto* item : m_layoutGrid.itemsOverflowingGridArea()) { 92 for (auto* item : m_layoutGrid.itemsOverflowingGridArea()) {
93 if (item->frameRect().intersects(localVisualRect)) 93 if (item->frameRect().intersects(localVisualRect))
94 gridItemsToBePainted.append( 94 gridItemsToBePainted.push_back(
95 std::make_pair(item, m_layoutGrid.paintIndexForGridItem(item))); 95 std::make_pair(item, m_layoutGrid.paintIndexForGridItem(item)));
96 } 96 }
97 97
98 std::stable_sort(gridItemsToBePainted.begin(), gridItemsToBePainted.end(), 98 std::stable_sort(gridItemsToBePainted.begin(), gridItemsToBePainted.end(),
99 compareOrderModifiedDocumentOrder); 99 compareOrderModifiedDocumentOrder);
100 100
101 LayoutBox* previous = 0; 101 LayoutBox* previous = 0;
102 for (const auto& gridItemAndPaintIndex : gridItemsToBePainted) { 102 for (const auto& gridItemAndPaintIndex : gridItemsToBePainted) {
103 // We might have duplicates because of spanning children are included in all 103 // We might have duplicates because of spanning children are included in all
104 // cells they span. Skip them here to avoid painting items several times. 104 // cells they span. Skip them here to avoid painting items several times.
105 LayoutBox* current = gridItemAndPaintIndex.first; 105 LayoutBox* current = gridItemAndPaintIndex.first;
106 if (current == previous) 106 if (current == previous)
107 continue; 107 continue;
108 108
109 BlockPainter(m_layoutGrid) 109 BlockPainter(m_layoutGrid)
110 .paintAllChildPhasesAtomically(*current, paintInfo, paintOffset); 110 .paintAllChildPhasesAtomically(*current, paintInfo, paintOffset);
111 previous = current; 111 previous = current;
112 } 112 }
113 } 113 }
114 114
115 } // namespace blink 115 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698