Index: third_party/WebKit/Source/core/paint/TableRowPainter.cpp |
diff --git a/third_party/WebKit/Source/core/paint/TableRowPainter.cpp b/third_party/WebKit/Source/core/paint/TableRowPainter.cpp |
index b7c333e0b4a8f13c7777cdf8bc27d333803d3d09..ac1846c6e49448c4738a7fae02d33cfbe133cfdd 100644 |
--- a/third_party/WebKit/Source/core/paint/TableRowPainter.cpp |
+++ b/third_party/WebKit/Source/core/paint/TableRowPainter.cpp |
@@ -6,6 +6,7 @@ |
#include "core/layout/LayoutTableCell.h" |
#include "core/layout/LayoutTableRow.h" |
+#include "core/paint/BoxPainter.h" |
#include "core/paint/LayoutObjectDrawingRecorder.h" |
#include "core/paint/ObjectPainter.h" |
#include "core/paint/PaintInfo.h" |
@@ -15,31 +16,42 @@ namespace blink { |
void TableRowPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
{ |
- ASSERT(m_layoutTableRow.hasSelfPaintingLayer()); |
+ DCHECK(m_layoutTableRow.hasSelfPaintingLayer()); |
- // TODO(wangxianzhu): This painting order is inconsistent with other outlines. crbug.com/577282. |
- paintOutlineForRowIfNeeded(paintInfo, paintOffset); |
+ // TODO(crbug.com/577282): This painting order is inconsistent with other outlines. |
+ if (shouldPaintSelfOutline(paintInfo.phase)) |
+ paintOutline(paintInfo, paintOffset); |
if (paintInfo.phase == PaintPhaseSelfOutlineOnly) |
return; |
PaintInfo paintInfoForCells = paintInfo.forDescendants(); |
- bool shouldPaintRowBackground = shouldPaintSelfBlockBackground(paintInfo.phase) && m_layoutTableRow.hasBackground(); |
- bool shouldPaintCells = paintInfo.phase != PaintPhaseSelfBlockBackgroundOnly; |
+ if (shouldPaintSelfBlockBackground(paintInfo.phase) && m_layoutTableRow.hasBackground()) { |
+ // Paint row background of behind the cells. |
+ for (LayoutTableCell* cell = m_layoutTableRow.firstCell(); cell; cell = cell->nextCell()) |
+ TableCellPainter(*cell).paintContainerBackgroundBehindCell(paintInfoForCells, paintOffset, m_layoutTableRow, DisplayItem::TableCellBackgroundFromRow); |
+ } |
+ |
+ if (paintInfo.phase == PaintPhaseSelfBlockBackgroundOnly) |
+ return; |
+ |
for (LayoutTableCell* cell = m_layoutTableRow.firstCell(); cell; cell = cell->nextCell()) { |
- if (shouldPaintRowBackground) |
- TableCellPainter(*cell).paintBackgroundsBehindCell(paintInfoForCells, paintOffset, &m_layoutTableRow, DisplayItem::TableCellBackgroundFromRow); |
- if (shouldPaintCells && !cell->hasSelfPaintingLayer()) |
+ if (!cell->hasSelfPaintingLayer()) |
cell->paint(paintInfoForCells, paintOffset); |
} |
} |
-void TableRowPainter::paintOutlineForRowIfNeeded(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
+void TableRowPainter::paintOutline(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
{ |
- PaintPhase paintPhase = paintInfo.phase; |
- if (shouldPaintSelfOutline(paintPhase)) { |
- LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableRow.location(); |
- ObjectPainter(m_layoutTableRow).paintOutline(paintInfo, adjustedPaintOffset); |
- } |
+ DCHECK(shouldPaintSelfOutline(paintInfo.phase)); |
+ LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableRow.location(); |
+ ObjectPainter(m_layoutTableRow).paintOutline(paintInfo, adjustedPaintOffset); |
+} |
+ |
+void TableRowPainter::paintBackgroundBehindCell(const LayoutTableCell& cell, const PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
+{ |
+ DCHECK(m_layoutTableRow.hasBackground() && !m_layoutTableRow.hasSelfPaintingLayer()); |
+ LayoutPoint cellPoint = m_layoutTableRow.section()->flipForWritingModeForChild(&cell, paintOffset); |
+ TableCellPainter(cell).paintContainerBackgroundBehindCell(paintInfo, cellPoint, m_layoutTableRow, DisplayItem::TableCellBackgroundFromRow); |
} |
} // namespace blink |