| OLD | NEW |
| 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/rendering/PaintInfo.h" | 8 #include "core/rendering/PaintInfo.h" |
| 9 #include "core/rendering/RenderGrid.h" | 9 #include "core/rendering/RenderGrid.h" |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 Vector<std::pair<RenderBox*, size_t> > gridItemsToBePainted; | 50 Vector<std::pair<RenderBox*, size_t> > gridItemsToBePainted; |
| 51 | 51 |
| 52 for (GridSpan::iterator row = dirtiedRows.begin(); row != dirtiedRows.end();
++row) { | 52 for (GridSpan::iterator row = dirtiedRows.begin(); row != dirtiedRows.end();
++row) { |
| 53 for (GridSpan::iterator column = dirtiedColumns.begin(); column != dirti
edColumns.end(); ++column) { | 53 for (GridSpan::iterator column = dirtiedColumns.begin(); column != dirti
edColumns.end(); ++column) { |
| 54 const Vector<RenderBox*, 1>& children = m_renderGrid.gridCell(row.to
Int(), column.toInt()); | 54 const Vector<RenderBox*, 1>& children = m_renderGrid.gridCell(row.to
Int(), column.toInt()); |
| 55 for (size_t j = 0; j < children.size(); ++j) | 55 for (size_t j = 0; j < children.size(); ++j) |
| 56 gridItemsToBePainted.append(std::make_pair(children[j], m_render
Grid.paintIndexForGridItem(children[j]))); | 56 gridItemsToBePainted.append(std::make_pair(children[j], m_render
Grid.paintIndexForGridItem(children[j]))); |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 | 59 |
| 60 for (Vector<RenderBox*>::const_iterator it = m_renderGrid.itemsOverflowingGr
idArea().begin(); it != m_renderGrid.itemsOverflowingGridArea().end(); ++it) { | 60 for (const auto& it : m_renderGrid.itemsOverflowingGridArea()) { |
| 61 if ((*it)->frameRect().intersects(localPaintInvalidationRect)) | 61 if (it->frameRect().intersects(localPaintInvalidationRect)) |
| 62 gridItemsToBePainted.append(std::make_pair(*it, m_renderGrid.paintIn
dexForGridItem(*it))); | 62 gridItemsToBePainted.append(std::make_pair(it, m_renderGrid.paintInd
exForGridItem(it))); |
| 63 } | 63 } |
| 64 | 64 |
| 65 // Sort grid items following order-modified document order. | 65 // Sort grid items following order-modified document order. |
| 66 // See http://www.w3.org/TR/css-flexbox/#order-modified-document-order | 66 // See http://www.w3.org/TR/css-flexbox/#order-modified-document-order |
| 67 std::stable_sort(gridItemsToBePainted.begin(), gridItemsToBePainted.end(), G
ridItemsSorter()); | 67 std::stable_sort(gridItemsToBePainted.begin(), gridItemsToBePainted.end(), G
ridItemsSorter()); |
| 68 | 68 |
| 69 RenderBox* previous = 0; | 69 RenderBox* previous = 0; |
| 70 for (Vector<std::pair<RenderBox*, size_t> >::const_iterator it = gridItemsTo
BePainted.begin(); it != gridItemsToBePainted.end(); ++it) { | 70 for (const auto& it : gridItemsToBePainted) { |
| 71 // We might have duplicates because of spanning children are included in
all cells they span. | 71 // We might have duplicates because of spanning children are included in
all cells they span. |
| 72 // Skip them here to avoid painting items several times. | 72 // Skip them here to avoid painting items several times. |
| 73 RenderBox* current = it->first; | 73 RenderBox* current = it.first; |
| 74 if (current == previous) | 74 if (current == previous) |
| 75 continue; | 75 continue; |
| 76 | 76 |
| 77 paintChild(*current, paintInfo, paintOffset); | 77 paintChild(*current, paintInfo, paintOffset); |
| 78 previous = current; | 78 previous = current; |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 void GridPainter::paintChild(RenderBox& child, const PaintInfo& paintInfo, const
LayoutPoint& paintOffset) | 82 void GridPainter::paintChild(RenderBox& child, const PaintInfo& paintInfo, const
LayoutPoint& paintOffset) |
| 83 { | 83 { |
| 84 LayoutPoint childPoint = m_renderGrid.flipForWritingModeForChild(&child, pai
ntOffset); | 84 LayoutPoint childPoint = m_renderGrid.flipForWritingModeForChild(&child, pai
ntOffset); |
| 85 if (!child.hasSelfPaintingLayer() && !child.isFloating()) | 85 if (!child.hasSelfPaintingLayer() && !child.isFloating()) |
| 86 child.paint(paintInfo, childPoint); | 86 child.paint(paintInfo, childPoint); |
| 87 } | 87 } |
| 88 | 88 |
| 89 } // namespace blink | 89 } // namespace blink |
| OLD | NEW |