Index: third_party/WebKit/Source/core/paint/TablePainter.cpp |
diff --git a/third_party/WebKit/Source/core/paint/TablePainter.cpp b/third_party/WebKit/Source/core/paint/TablePainter.cpp |
index ae3463d30ff73130e733b061eaf791e4de173ec9..8ae9320f1f3c542897d1dd956d3b806dabcf2217 100644 |
--- a/third_party/WebKit/Source/core/paint/TablePainter.cpp |
+++ b/third_party/WebKit/Source/core/paint/TablePainter.cpp |
@@ -20,34 +20,30 @@ namespace blink { |
void TablePainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) |
{ |
PaintPhase paintPhase = paintInfo.phase; |
- if ((paintPhase == PaintPhaseSelfBlockBackground || paintPhase == PaintPhaseBlockBackground) && m_layoutTable.hasBoxDecorationBackground() && m_layoutTable.style()->visibility() == VISIBLE) |
- paintBoxDecorationBackground(paintInfo, paintOffset); |
+ |
+ if (shouldPaintSelfBlockBackground(paintPhase)) { |
+ if (m_layoutTable.hasBoxDecorationBackground() && m_layoutTable.style()->visibility() == VISIBLE) |
pdr.
2016/01/14 19:51:50
Can this check be moved into paintBoxDecorationBac
Xianzhu
2016/01/15 01:05:33
Done.
|
+ paintBoxDecorationBackground(paintInfo, paintOffset); |
+ if (paintPhase == PaintPhaseSelfBlockBackgroundOnly) |
+ return; |
+ } |
if (paintPhase == PaintPhaseMask) { |
paintMask(paintInfo, paintOffset); |
return; |
} |
- // We're done. We don't bother painting any children. |
- if (paintPhase == PaintPhaseSelfBlockBackground) |
- return; |
- |
- // We don't paint our own background, but we do let the kids paint their backgrounds. |
- if (paintPhase == PaintPhaseDescendantBlockBackgrounds) |
- paintPhase = PaintPhaseBlockBackground; |
- |
- PaintInfo info(paintInfo); |
- info.phase = paintPhase; |
- info.updatePaintingRootForChildren(&m_layoutTable); |
+ PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); |
+ paintInfoForDescendants.updatePaintingRootForChildren(&m_layoutTable); |
for (LayoutObject* child = m_layoutTable.firstChild(); child; child = child->nextSibling()) { |
if (child->isBox() && !toLayoutBox(child)->hasSelfPaintingLayer() && (child->isTableSection() || child->isTableCaption())) { |
LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChild(toLayoutBox(child), paintOffset); |
- child->paint(info, childPoint); |
+ child->paint(paintInfoForDescendants, childPoint); |
} |
} |
- if (m_layoutTable.collapseBorders() && paintPhase == PaintPhaseBlockBackground && m_layoutTable.style()->visibility() == VISIBLE) { |
+ if (m_layoutTable.collapseBorders() && shouldPaintDescendantBlockBackgrounds(paintPhase) && m_layoutTable.style()->visibility() == VISIBLE) { |
// Using our cached sorted styles, we then do individual passes, |
// painting each style of border from lowest precedence to highest precedence. |
LayoutTable::CollapsedBorderValues collapsedBorders = m_layoutTable.collapsedBorders(); |
@@ -55,13 +51,12 @@ void TablePainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& pa |
for (size_t i = 0; i < count; ++i) { |
for (LayoutTableSection* section = m_layoutTable.bottomSection(); section; section = m_layoutTable.sectionAbove(section)) { |
LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChild(section, paintOffset); |
- TableSectionPainter(*section).paintCollapsedBorders(info, childPoint, collapsedBorders[i]); |
+ TableSectionPainter(*section).paintCollapsedBorders(paintInfoForDescendants, childPoint, collapsedBorders[i]); |
} |
} |
} |
- // Paint outline. |
- if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) && m_layoutTable.style()->hasOutline() && m_layoutTable.style()->visibility() == VISIBLE) |
+ if (shouldPaintSelfOutline(paintPhase)) |
ObjectPainter(m_layoutTable).paintOutline(paintInfo, paintOffset); |
} |