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

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

Issue 926193003: Move rendering/RenderBox to layout/LayoutBox. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/paint/GridPainter.h ('k') | Source/core/paint/LayerPainter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 #include "core/paint/GridPainter.h" 6 #include "core/paint/GridPainter.h"
7 7
8 #include "core/layout/PaintInfo.h" 8 #include "core/layout/PaintInfo.h"
9 #include "core/paint/BlockPainter.h" 9 #include "core/paint/BlockPainter.h"
10 #include "core/rendering/RenderGrid.h" 10 #include "core/rendering/RenderGrid.h"
(...skipping 11 matching lines...) Expand all
22 22
23 size_t endGridAreaIndex = std::upper_bound(coordinates.begin() + startGridAr eaIndex, coordinates.end() - 1, end) - coordinates.begin(); 23 size_t endGridAreaIndex = std::upper_bound(coordinates.begin() + startGridAr eaIndex, coordinates.end() - 1, end) - coordinates.begin();
24 if (endGridAreaIndex > 0) 24 if (endGridAreaIndex > 0)
25 --endGridAreaIndex; 25 --endGridAreaIndex;
26 26
27 return GridSpan(startGridAreaIndex, endGridAreaIndex); 27 return GridSpan(startGridAreaIndex, endGridAreaIndex);
28 } 28 }
29 29
30 class GridItemsSorter { 30 class GridItemsSorter {
31 public: 31 public:
32 bool operator()(const std::pair<RenderBox*, size_t>& firstChild, const std:: pair<RenderBox*, size_t>& secondChild) const 32 bool operator()(const std::pair<LayoutBox*, size_t>& firstChild, const std:: pair<LayoutBox*, size_t>& secondChild) const
33 { 33 {
34 if (firstChild.first->style()->order() != secondChild.first->style()->or der()) 34 if (firstChild.first->style()->order() != secondChild.first->style()->or der())
35 return firstChild.first->style()->order() < secondChild.first->style ()->order(); 35 return firstChild.first->style()->order() < secondChild.first->style ()->order();
36 36
37 return firstChild.second < secondChild.second; 37 return firstChild.second < secondChild.second;
38 } 38 }
39 }; 39 };
40 40
41 void GridPainter::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& p aintOffset) 41 void GridPainter::paintChildren(const PaintInfo& paintInfo, const LayoutPoint& p aintOffset)
42 { 42 {
43 ASSERT(!m_renderGrid.needsLayout()); 43 ASSERT(!m_renderGrid.needsLayout());
44 ASSERT_WITH_SECURITY_IMPLICATION(!m_renderGrid.gridIsDirty()); 44 ASSERT_WITH_SECURITY_IMPLICATION(!m_renderGrid.gridIsDirty());
45 45
46 LayoutRect localPaintInvalidationRect = paintInfo.rect; 46 LayoutRect localPaintInvalidationRect = paintInfo.rect;
47 localPaintInvalidationRect.moveBy(-paintOffset); 47 localPaintInvalidationRect.moveBy(-paintOffset);
48 48
49 GridSpan dirtiedColumns = dirtiedGridAreas(m_renderGrid.columnPositions(), l ocalPaintInvalidationRect.x(), localPaintInvalidationRect.maxX()); 49 GridSpan dirtiedColumns = dirtiedGridAreas(m_renderGrid.columnPositions(), l ocalPaintInvalidationRect.x(), localPaintInvalidationRect.maxX());
50 GridSpan dirtiedRows = dirtiedGridAreas(m_renderGrid.rowPositions(), localPa intInvalidationRect.y(), localPaintInvalidationRect.maxY()); 50 GridSpan dirtiedRows = dirtiedGridAreas(m_renderGrid.rowPositions(), localPa intInvalidationRect.y(), localPaintInvalidationRect.maxY());
51 51
52 Vector<std::pair<RenderBox*, size_t> > gridItemsToBePainted; 52 Vector<std::pair<LayoutBox*, size_t>> gridItemsToBePainted;
53 53
54 for (GridSpan::iterator row = dirtiedRows.begin(); row != dirtiedRows.end(); ++row) { 54 for (GridSpan::iterator row = dirtiedRows.begin(); row != dirtiedRows.end(); ++row) {
55 for (GridSpan::iterator column = dirtiedColumns.begin(); column != dirti edColumns.end(); ++column) { 55 for (GridSpan::iterator column = dirtiedColumns.begin(); column != dirti edColumns.end(); ++column) {
56 const Vector<RenderBox*, 1>& children = m_renderGrid.gridCell(row.to Int(), column.toInt()); 56 const Vector<LayoutBox*, 1>& children = m_renderGrid.gridCell(row.to Int(), column.toInt());
57 for (auto* child : children) 57 for (auto* child : children)
58 gridItemsToBePainted.append(std::make_pair(child, m_renderGrid.p aintIndexForGridItem(child))); 58 gridItemsToBePainted.append(std::make_pair(child, m_renderGrid.p aintIndexForGridItem(child)));
59 } 59 }
60 } 60 }
61 61
62 for (auto* item: m_renderGrid.itemsOverflowingGridArea()) { 62 for (auto* item: m_renderGrid.itemsOverflowingGridArea()) {
63 if (item->frameRect().intersects(localPaintInvalidationRect)) 63 if (item->frameRect().intersects(localPaintInvalidationRect))
64 gridItemsToBePainted.append(std::make_pair(item, m_renderGrid.paintI ndexForGridItem(item))); 64 gridItemsToBePainted.append(std::make_pair(item, m_renderGrid.paintI ndexForGridItem(item)));
65 } 65 }
66 66
67 // Sort grid items following order-modified document order. 67 // Sort grid items following order-modified document order.
68 // See http://www.w3.org/TR/css-flexbox/#order-modified-document-order 68 // See http://www.w3.org/TR/css-flexbox/#order-modified-document-order
69 std::stable_sort(gridItemsToBePainted.begin(), gridItemsToBePainted.end(), G ridItemsSorter()); 69 std::stable_sort(gridItemsToBePainted.begin(), gridItemsToBePainted.end(), G ridItemsSorter());
70 70
71 RenderBox* previous = 0; 71 LayoutBox* previous = 0;
72 for (const auto& gridItemAndPaintIndex : gridItemsToBePainted) { 72 for (const auto& gridItemAndPaintIndex : gridItemsToBePainted) {
73 // We might have duplicates because of spanning children are included in all cells they span. 73 // We might have duplicates because of spanning children are included in all cells they span.
74 // Skip them here to avoid painting items several times. 74 // Skip them here to avoid painting items several times.
75 RenderBox* current = gridItemAndPaintIndex.first; 75 LayoutBox* current = gridItemAndPaintIndex.first;
76 if (current == previous) 76 if (current == previous)
77 continue; 77 continue;
78 78
79 BlockPainter(m_renderGrid).paintChild(*current, paintInfo, paintOffset); 79 BlockPainter(m_renderGrid).paintChild(*current, paintInfo, paintOffset);
80 previous = current; 80 previous = current;
81 } 81 }
82 } 82 }
83 83
84 } // namespace blink 84 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/GridPainter.h ('k') | Source/core/paint/LayerPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698