Ejemplo n.º 1
0
void TableRowPainter::paint(const PaintInfo& paintInfo,
                            const LayoutPoint& paintOffset) {
    DCHECK(m_layoutTableRow.hasSelfPaintingLayer());

    // 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();
    if (shouldPaintSelfBlockBackground(paintInfo.phase)) {
        paintBoxShadow(paintInfo, paintOffset, Normal);
        if (m_layoutTableRow.styleRef().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::kTableCellBackgroundFromRow);
        }
        paintBoxShadow(paintInfo, paintOffset, Inset);
    }

    if (paintInfo.phase == PaintPhaseSelfBlockBackgroundOnly)
        return;

    for (LayoutTableCell* cell = m_layoutTableRow.firstCell(); cell;
            cell = cell->nextCell()) {
        if (!cell->hasSelfPaintingLayer())
            cell->paint(paintInfoForCells, paintOffset);
    }
}
Ejemplo n.º 2
0
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);
}
Ejemplo n.º 3
0
void BlockPainter::paintContents(const PaintInfo& paintInfo,
                                 const LayoutPoint& paintOffset) {
  DCHECK(!m_layoutBlock.childrenInline());
  PaintInfo paintInfoForDescendants = paintInfo.forDescendants();
  m_layoutBlock.paintChildren(paintInfoForDescendants, paintOffset);
}