void TablePainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) { PaintPhase paintPhase = paintInfo.phase; if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground) && m_layoutTable.hasBoxDecorationBackground() && m_layoutTable.style()->visibility() == VISIBLE) paintBoxDecorationBackground(paintInfo, paintOffset); if (paintPhase == PaintPhaseMask) { paintMask(paintInfo, paintOffset); return; } // We're done. We don't bother painting any children. if (paintPhase == PaintPhaseBlockBackground) return; // We don't paint our own background, but we do let the kids paint their backgrounds. if (paintPhase == PaintPhaseChildBlockBackgrounds) paintPhase = PaintPhaseChildBlockBackground; PaintInfo info(paintInfo); info.phase = paintPhase; info.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); } } if (m_layoutTable.collapseBorders() && paintPhase == PaintPhaseChildBlockBackground && 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. info.phase = PaintPhaseCollapsedTableBorders; LayoutTable::CollapsedBorderValues collapsedBorders = m_layoutTable.collapsedBorders(); size_t count = collapsedBorders.size(); for (size_t i = 0; i < count; ++i) { // FIXME: pass this value into children rather than storing temporarily on the LayoutTable object. m_layoutTable.setCurrentBorderValue(&collapsedBorders[i]); for (LayoutTableSection* section = m_layoutTable.bottomSection(); section; section = m_layoutTable.sectionAbove(section)) { LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChild(section, paintOffset); section->paint(info, childPoint); } } m_layoutTable.setCurrentBorderValue(0); } // Paint outline. if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) && m_layoutTable.style()->hasOutline() && m_layoutTable.style()->visibility() == VISIBLE) { LayoutRect overflowRect(m_layoutTable.visualOverflowRect()); overflowRect.moveBy(paintOffset); ObjectPainter(m_layoutTable).paintOutline(paintInfo, LayoutRect(paintOffset, m_layoutTable.size()), overflowRect); } }
void TablePainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) { PaintPhase paintPhase = paintInfo.phase; if (shouldPaintSelfBlockBackground(paintPhase)) { paintBoxDecorationBackground(paintInfo, paintOffset); if (paintPhase == PaintPhaseSelfBlockBackgroundOnly) return; } if (paintPhase == PaintPhaseMask) { paintMask(paintInfo, paintOffset); return; } if (paintPhase != PaintPhaseSelfOutlineOnly) { PaintInfo paintInfoForDescendants = paintInfo.forDescendants(); 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(paintInfoForDescendants, childPoint); } } if (m_layoutTable.collapseBorders() && shouldPaintDescendantBlockBackgrounds(paintPhase) && m_layoutTable.style()->visibility() == EVisibility::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(); size_t count = collapsedBorders.size(); 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( paintInfoForDescendants, childPoint, collapsedBorders[i]); } } } } if (shouldPaintSelfOutline(paintPhase)) ObjectPainter(m_layoutTable).paintOutline(paintInfo, paintOffset); }