コード例 #1
0
void TableSectionPainter::paintCell(LayoutTableCell* cell, const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
    LayoutPoint cellPoint = m_layoutTableSection.flipForWritingModeForChild(cell, paintOffset);
    PaintPhase paintPhase = paintInfo.phase;
    LayoutTableRow* row = toLayoutTableRow(cell->parent());

    if ((paintPhase == PaintPhaseBlockBackground || paintPhase == PaintPhaseChildBlockBackground)
        && BlockPainter(*cell).intersectsPaintRect(paintInfo, paintOffset)) {
        // We need to handle painting a stack of backgrounds. This stack (from bottom to top) consists of
        // the column group, column, row group, row, and then the cell.
        LayoutTableCol* column = m_layoutTableSection.table()->colElement(cell->col());
        LayoutTableCol* columnGroup = column ? column->enclosingColumnGroup() : 0;

        bool columnHasBackground = column && column->hasBackground();
        bool columnGroupHasBackground = columnGroup && columnGroup->hasBackground();
        bool sectionHasBackground = m_layoutTableSection.hasBackground();
        bool rowHasBackground = row->hasBackground();

        if (columnHasBackground || columnGroupHasBackground || sectionHasBackground || rowHasBackground) {
            TableCellPainter tableCellPainter(*cell);
            if (!LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, *cell, DisplayItem::TableCellBackgroundFromContainers, paintOffset)) {
                LayoutObjectDrawingRecorder recorder(*paintInfo.context, *cell, DisplayItem::TableCellBackgroundFromContainers, tableCellPainter.paintBounds(cellPoint, TableCellPainter::AddOffsetFromParent), paintOffset);
                // Column groups and columns first.
                // FIXME: Columns and column groups do not currently support opacity, and they are being painted "too late" in
                // the stack, since we have already opened a transparency layer (potentially) for the table row group.
                // Note that we deliberately ignore whether or not the cell has a layer, since these backgrounds paint "behind" the
                // cell.
                if (columnGroupHasBackground)
                    tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellPoint, columnGroup);
                if (columnHasBackground)
                    tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellPoint, column);

                // Paint the row group next.
                if (sectionHasBackground)
                    tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellPoint, &m_layoutTableSection);

                // Paint the row next, but only if it doesn't have a layer. If a row has a layer, it will be responsible for
                // painting the row background for the cell.
                if (rowHasBackground && !row->hasSelfPaintingLayer())
                    tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellPoint, row);
            }
        }
    }
    if ((!cell->hasSelfPaintingLayer() && !row->hasSelfPaintingLayer()))
        cell->paint(paintInfo, cellPoint);
}
コード例 #2
0
void TableSectionPainter::paintCell(const LayoutTableCell& cell, const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
    LayoutPoint cellPoint = m_layoutTableSection.flipForWritingModeForChild(&cell, paintOffset);
    PaintPhase paintPhase = paintInfo.phase;
    const LayoutTableRow* row = toLayoutTableRow(cell.parent());

    if ((paintPhase == PaintPhaseSelfBlockBackground || paintPhase == PaintPhaseBlockBackground)
        && BlockPainter(cell).intersectsPaintRect(paintInfo, paintOffset)) {
        // We need to handle painting a stack of backgrounds. This stack (from bottom to top) consists of
        // the column group, column, row group, row, and then the cell.

        LayoutTable::ColAndColGroup colAndColGroup = m_layoutTableSection.table()->colElement(cell.col());
        LayoutTableCol* column = colAndColGroup.col;
        LayoutTableCol* columnGroup = colAndColGroup.colgroup;
        TableCellPainter tableCellPainter(cell);

        // Column groups and columns first.
        // FIXME: Columns and column groups do not currently support opacity, and they are being painted "too late" in
        // the stack, since we have already opened a transparency layer (potentially) for the table row group.
        // Note that we deliberately ignore whether or not the cell has a layer, since these backgrounds paint "behind" the
        // cell.
        if (columnGroup && columnGroup->hasBackground())
            tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellPoint, columnGroup, DisplayItem::TableCellBackgroundFromColumnGroup);
        if (column && column->hasBackground())
            tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellPoint, column, DisplayItem::TableCellBackgroundFromColumn);

        // Paint the row group next.
        if (m_layoutTableSection.hasBackground())
            tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellPoint, &m_layoutTableSection, DisplayItem::TableCellBackgroundFromSection);

        // Paint the row next, but only if it doesn't have a layer. If a row has a layer, it will be responsible for
        // painting the row background for the cell.
        if (row->hasBackground() && !row->hasSelfPaintingLayer())
            tableCellPainter.paintBackgroundsBehindCell(paintInfo, cellPoint, row, DisplayItem::TableCellBackgroundFromRow);
    }
    if ((!cell.hasSelfPaintingLayer() && !row->hasSelfPaintingLayer()))
        cell.paint(paintInfo, cellPoint);
}