Commit 7a10493b authored by chrishtr@chromium.org's avatar chrishtr@chromium.org

Move painting code from RenderTableCell to TableCellPainter.

BUG=412088

Review URL: https://codereview.chromium.org/724483002

git-svn-id: svn://svn.chromium.org/blink/trunk@185329 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 16a50c6d
...@@ -1508,6 +1508,8 @@ ...@@ -1508,6 +1508,8 @@
'paint/SVGShapePainter.h', 'paint/SVGShapePainter.h',
'paint/SVGTextPainter.cpp', 'paint/SVGTextPainter.cpp',
'paint/SVGTextPainter.h', 'paint/SVGTextPainter.h',
'paint/TableCellPainter.cpp',
'paint/TableCellPainter.h',
'paint/TablePainter.cpp', 'paint/TablePainter.cpp',
'paint/TablePainter.h', 'paint/TablePainter.h',
'paint/TableRowPainter.cpp', 'paint/TableRowPainter.cpp',
......
This diff is collapsed.
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef TableCellPainter_h
#define TableCellPainter_h
#include "core/rendering/style/CollapsedBorderValue.h"
namespace blink {
struct PaintInfo;
class LayoutPoint;
class RenderObject;
class RenderStyle;
class RenderTableCell;
class TableCellPainter {
public:
TableCellPainter(RenderTableCell& renderTableCell) : m_renderTableCell(renderTableCell) { }
void paint(PaintInfo&, const LayoutPoint&);
void paintCollapsedBorders(PaintInfo&, const LayoutPoint&);
void paintBackgroundsBehindCell(PaintInfo&, const LayoutPoint&, RenderObject* backgroundObject);
void paintBoxDecorationBackground(PaintInfo&, const LayoutPoint& paintOffset);
void paintMask(PaintInfo&, const LayoutPoint& paintOffset);
private:
CollapsedBorderValue cachedCollapsedLeftBorder(const RenderStyle*) const;
CollapsedBorderValue cachedCollapsedRightBorder(const RenderStyle*) const;
CollapsedBorderValue cachedCollapsedTopBorder(const RenderStyle*) const;
CollapsedBorderValue cachedCollapsedBottomBorder(const RenderStyle*) const;
RenderTableCell& m_renderTableCell;
};
} // namespace blink
#endif // TableCellPainter_h
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "core/paint/TableRowPainter.h" #include "core/paint/TableRowPainter.h"
#include "core/paint/ObjectPainter.h" #include "core/paint/ObjectPainter.h"
#include "core/paint/TableCellPainter.h"
#include "core/rendering/GraphicsContextAnnotator.h" #include "core/rendering/GraphicsContextAnnotator.h"
#include "core/rendering/PaintInfo.h" #include "core/rendering/PaintInfo.h"
#include "core/rendering/RenderTableCell.h" #include "core/rendering/RenderTableCell.h"
...@@ -22,7 +23,7 @@ void TableRowPainter::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset ...@@ -22,7 +23,7 @@ void TableRowPainter::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset
for (RenderTableCell* cell = m_renderTableRow.firstCell(); cell; cell = cell->nextCell()) { for (RenderTableCell* cell = m_renderTableRow.firstCell(); cell; cell = cell->nextCell()) {
// Paint the row background behind the cell. // Paint the row background behind the cell.
if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == PaintPhaseChildBlockBackground) if (paintInfo.phase == PaintPhaseBlockBackground || paintInfo.phase == PaintPhaseChildBlockBackground)
cell->paintBackgroundsBehindCell(paintInfo, paintOffset, &m_renderTableRow); TableCellPainter(*cell).paintBackgroundsBehindCell(paintInfo, paintOffset, &m_renderTableRow);
if (!cell->hasSelfPaintingLayer()) if (!cell->hasSelfPaintingLayer())
cell->paint(paintInfo, paintOffset); cell->paint(paintInfo, paintOffset);
} }
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "core/paint/TableSectionPainter.h" #include "core/paint/TableSectionPainter.h"
#include "core/paint/ObjectPainter.h" #include "core/paint/ObjectPainter.h"
#include "core/paint/TableCellPainter.h"
#include "core/paint/TableRowPainter.h" #include "core/paint/TableRowPainter.h"
#include "core/rendering/GraphicsContextAnnotator.h" #include "core/rendering/GraphicsContextAnnotator.h"
#include "core/rendering/PaintInfo.h" #include "core/rendering/PaintInfo.h"
...@@ -83,7 +84,7 @@ void TableSectionPainter::paintObject(PaintInfo& paintInfo, const LayoutPoint& p ...@@ -83,7 +84,7 @@ void TableSectionPainter::paintObject(PaintInfo& paintInfo, const LayoutPoint& p
if (!cell || (row > dirtiedRows.start() && m_renderTableSection.primaryCellAt(row - 1, col) == cell) || (col > dirtiedColumns.start() && m_renderTableSection.primaryCellAt(row, col - 1) == cell)) if (!cell || (row > dirtiedRows.start() && m_renderTableSection.primaryCellAt(row - 1, col) == cell) || (col > dirtiedColumns.start() && m_renderTableSection.primaryCellAt(row, col - 1) == cell))
continue; continue;
LayoutPoint cellPoint = m_renderTableSection.flipForWritingModeForChild(cell, paintOffset); LayoutPoint cellPoint = m_renderTableSection.flipForWritingModeForChild(cell, paintOffset);
cell->paintCollapsedBorders(paintInfo, cellPoint); TableCellPainter(*cell).paintCollapsedBorders(paintInfo, cellPoint);
} }
} }
} else { } else {
...@@ -146,7 +147,7 @@ void TableSectionPainter::paintObject(PaintInfo& paintInfo, const LayoutPoint& p ...@@ -146,7 +147,7 @@ void TableSectionPainter::paintObject(PaintInfo& paintInfo, const LayoutPoint& p
if (paintInfo.phase == PaintPhaseCollapsedTableBorders) { if (paintInfo.phase == PaintPhaseCollapsedTableBorders) {
for (unsigned i = cells.size(); i > 0; --i) { for (unsigned i = cells.size(); i > 0; --i) {
LayoutPoint cellPoint = m_renderTableSection.flipForWritingModeForChild(cells[i - 1], paintOffset); LayoutPoint cellPoint = m_renderTableSection.flipForWritingModeForChild(cells[i - 1], paintOffset);
cells[i - 1]->paintCollapsedBorders(paintInfo, cellPoint); TableCellPainter(*cells[i - 1]).paintCollapsedBorders(paintInfo, cellPoint);
} }
} else { } else {
for (unsigned i = 0; i < cells.size(); ++i) for (unsigned i = 0; i < cells.size(); ++i)
...@@ -173,16 +174,16 @@ void TableSectionPainter::paintCell(RenderTableCell* cell, PaintInfo& paintInfo, ...@@ -173,16 +174,16 @@ void TableSectionPainter::paintCell(RenderTableCell* cell, PaintInfo& paintInfo,
// the stack, since we have already opened a transparency layer (potentially) for the table row group. // 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 // Note that we deliberately ignore whether or not the cell has a layer, since these backgrounds paint "behind" the
// cell. // cell.
cell->paintBackgroundsBehindCell(paintInfo, cellPoint, columnGroup); TableCellPainter(*cell).paintBackgroundsBehindCell(paintInfo, cellPoint, columnGroup);
cell->paintBackgroundsBehindCell(paintInfo, cellPoint, column); TableCellPainter(*cell).paintBackgroundsBehindCell(paintInfo, cellPoint, column);
// Paint the row group next. // Paint the row group next.
cell->paintBackgroundsBehindCell(paintInfo, cellPoint, &m_renderTableSection); TableCellPainter(*cell).paintBackgroundsBehindCell(paintInfo, cellPoint, &m_renderTableSection);
// Paint the row next, but only if it doesn't have a layer. If a row has a layer, it will be responsible for // 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. // painting the row background for the cell.
if (!row->hasSelfPaintingLayer()) if (!row->hasSelfPaintingLayer())
cell->paintBackgroundsBehindCell(paintInfo, cellPoint, row); TableCellPainter(*cell).paintBackgroundsBehindCell(paintInfo, cellPoint, row);
} }
if ((!cell->hasSelfPaintingLayer() && !row->hasSelfPaintingLayer())) if ((!cell->hasSelfPaintingLayer() && !row->hasSelfPaintingLayer()))
cell->paint(paintInfo, cellPoint); cell->paint(paintInfo, cellPoint);
......
...@@ -128,9 +128,6 @@ public: ...@@ -128,9 +128,6 @@ public:
virtual void paint(PaintInfo&, const LayoutPoint&) override; virtual void paint(PaintInfo&, const LayoutPoint&) override;
void paintCollapsedBorders(PaintInfo&, const LayoutPoint&);
void paintBackgroundsBehindCell(PaintInfo&, const LayoutPoint&, RenderObject* backgroundObject);
LayoutUnit cellBaselinePosition() const; LayoutUnit cellBaselinePosition() const;
bool isBaselineAligned() const bool isBaselineAligned() const
{ {
...@@ -263,11 +260,6 @@ private: ...@@ -263,11 +260,6 @@ private:
CollapsedBorderValue collapsedBeforeBorder(IncludeBorderColorOrNot = IncludeBorderColor) const; CollapsedBorderValue collapsedBeforeBorder(IncludeBorderColorOrNot = IncludeBorderColor) const;
CollapsedBorderValue collapsedAfterBorder(IncludeBorderColorOrNot = IncludeBorderColor) const; CollapsedBorderValue collapsedAfterBorder(IncludeBorderColorOrNot = IncludeBorderColor) const;
CollapsedBorderValue cachedCollapsedLeftBorder(const RenderStyle*) const;
CollapsedBorderValue cachedCollapsedRightBorder(const RenderStyle*) const;
CollapsedBorderValue cachedCollapsedTopBorder(const RenderStyle*) const;
CollapsedBorderValue cachedCollapsedBottomBorder(const RenderStyle*) const;
CollapsedBorderValue computeCollapsedStartBorder(IncludeBorderColorOrNot = IncludeBorderColor) const; CollapsedBorderValue computeCollapsedStartBorder(IncludeBorderColorOrNot = IncludeBorderColor) const;
CollapsedBorderValue computeCollapsedEndBorder(IncludeBorderColorOrNot = IncludeBorderColor) const; CollapsedBorderValue computeCollapsedEndBorder(IncludeBorderColorOrNot = IncludeBorderColor) const;
CollapsedBorderValue computeCollapsedBeforeBorder(IncludeBorderColorOrNot = IncludeBorderColor) const; CollapsedBorderValue computeCollapsedBeforeBorder(IncludeBorderColorOrNot = IncludeBorderColor) const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment