Commit 30f0845f authored by chrishtr@chromium.org's avatar chrishtr@chromium.org

Paint code cleanup: remove unnecessary indirections through the Render* code in several cases.

BUG=423071

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

git-svn-id: svn://svn.chromium.org/blink/trunk@185167 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b40b5b78
......@@ -211,7 +211,7 @@ void BlockPainter::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOff
// Don't paint focus ring for anonymous block continuation because the
// inline element having outline-style:auto paints the whole focus ring.
if (!m_renderBlock.style()->outlineStyleIsAuto() || !m_renderBlock.isAnonymousBlockContinuation())
m_renderBlock.paintOutline(paintInfo, LayoutRect(paintOffset, m_renderBlock.size()));
ObjectPainter(m_renderBlock).paintOutline(paintInfo, LayoutRect(paintOffset, m_renderBlock.size()));
}
// 6. paint continuation outlines.
......
......@@ -6,6 +6,7 @@
#include "core/paint/ReplacedPainter.h"
#include "core/paint/BoxPainter.h"
#include "core/paint/ObjectPainter.h"
#include "core/rendering/GraphicsContextAnnotator.h"
#include "core/rendering/PaintInfo.h"
#include "core/rendering/RenderLayer.h"
......@@ -35,7 +36,7 @@ void ReplacedPainter::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset
LayoutRect paintRect = LayoutRect(adjustedPaintOffset, m_renderReplaced.size());
if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && m_renderReplaced.style()->outlineWidth())
m_renderReplaced.paintOutline(paintInfo, paintRect);
ObjectPainter(m_renderReplaced).paintOutline(paintInfo, paintRect);
if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection && !m_renderReplaced.canHaveChildren() && paintInfo.phase != PaintPhaseClippingMask)
return;
......
......@@ -7,6 +7,7 @@
#include "core/paint/BoxPainter.h"
#include "core/paint/DrawingRecorder.h"
#include "core/paint/ObjectPainter.h"
#include "core/rendering/GraphicsContextAnnotator.h"
#include "core/rendering/PaintInfo.h"
#include "core/rendering/RenderBoxClipper.h"
......@@ -41,7 +42,7 @@ void TablePainter::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOff
paintBoxDecorationBackground(paintInfo, paintOffset);
if (paintPhase == PaintPhaseMask) {
m_renderTable.paintMask(paintInfo, paintOffset);
paintMask(paintInfo, paintOffset);
return;
}
......@@ -84,7 +85,7 @@ void TablePainter::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOff
// Paint outline.
if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) && m_renderTable.style()->hasOutline() && m_renderTable.style()->visibility() == VISIBLE)
m_renderTable.paintOutline(paintInfo, LayoutRect(paintOffset, m_renderTable.size()));
ObjectPainter(m_renderTable).paintOutline(paintInfo, LayoutRect(paintOffset, m_renderTable.size()));
}
void TablePainter::paintBoxDecorationBackground(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
......
......@@ -5,6 +5,7 @@
#include "config.h"
#include "core/paint/TableRowPainter.h"
#include "core/paint/ObjectPainter.h"
#include "core/rendering/GraphicsContextAnnotator.h"
#include "core/rendering/PaintInfo.h"
#include "core/rendering/RenderTableCell.h"
......@@ -32,7 +33,7 @@ void TableRowPainter::paintOutlineForRowIfNeeded(PaintInfo& paintInfo, const Lay
LayoutPoint adjustedPaintOffset = paintOffset + m_renderTableRow.location();
PaintPhase paintPhase = paintInfo.phase;
if ((paintPhase == PaintPhaseOutline || paintPhase == PaintPhaseSelfOutline) && m_renderTableRow.style()->visibility() == VISIBLE)
m_renderTableRow.paintOutline(paintInfo, LayoutRect(adjustedPaintOffset, m_renderTableRow.size()));
ObjectPainter(m_renderTableRow).paintOutline(paintInfo, LayoutRect(adjustedPaintOffset, m_renderTableRow.size()));
}
} // namespace blink
......@@ -5,6 +5,7 @@
#include "config.h"
#include "core/paint/TableSectionPainter.h"
#include "core/paint/ObjectPainter.h"
#include "core/paint/TableRowPainter.h"
#include "core/rendering/GraphicsContextAnnotator.h"
#include "core/rendering/PaintInfo.h"
......@@ -39,7 +40,7 @@ void TableSectionPainter::paint(PaintInfo& paintInfo, const LayoutPoint& paintOf
}
if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && m_renderTableSection.style()->visibility() == VISIBLE)
m_renderTableSection.paintOutline(paintInfo, LayoutRect(adjustedPaintOffset, m_renderTableSection.size()));
ObjectPainter(m_renderTableSection).paintOutline(paintInfo, LayoutRect(adjustedPaintOffset, m_renderTableSection.size()));
}
static inline bool compareCellPositions(RenderTableCell* elem1, RenderTableCell* elem2)
......
......@@ -966,11 +966,6 @@ bool RenderObject::mustInvalidateBackgroundOrBorderPaintOnHeightChange() const
return false;
}
void RenderObject::paintOutline(PaintInfo& paintInfo, const LayoutRect& paintRect)
{
ObjectPainter(*this).paintOutline(paintInfo, paintRect);
}
void RenderObject::addChildFocusRingRects(Vector<LayoutRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer) const
{
for (RenderObject* current = slowFirstChild(); current; current = current->nextSibling()) {
......
......@@ -1138,8 +1138,6 @@ protected:
void propagateStyleToAnonymousChildren(bool blockChildrenOnly = false);
virtual void updateAnonymousChildStyle(const RenderObject* child, RenderStyle* style) const { }
public:
void paintOutline(PaintInfo&, const LayoutRect&);
protected:
void addChildFocusRingRects(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer) const;
......
......@@ -223,6 +223,7 @@ void RenderPart::layout()
clearNeedsLayout();
}
// FIXME: factor into PartPainter.
void RenderPart::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
ANNOTATE_GRAPHICS_CONTEXT(paintInfo, this);
......@@ -241,7 +242,7 @@ void RenderPart::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
}
if ((paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSelfOutline) && style()->hasOutline())
paintOutline(paintInfo, LayoutRect(adjustedPaintOffset, size()));
ObjectPainter(*this).paintOutline(paintInfo, LayoutRect(adjustedPaintOffset, size()));
if (paintInfo.phase != PaintPhaseForeground)
return;
......
......@@ -269,10 +269,9 @@ public:
void addColumn(const RenderTableCol*);
void removeColumn(const RenderTableCol*);
// FIXME: this method should be moved into TablePainter.
virtual void paintBoxDecorationBackground(PaintInfo&, const LayoutPoint&) override;
virtual void paintBoxDecorationBackground(PaintInfo&, const LayoutPoint&) override final;
virtual void paintMask(PaintInfo&, const LayoutPoint&) override;
virtual void paintMask(PaintInfo&, const LayoutPoint&) override final;
const CollapsedBorderValues& collapsedBorders() { return m_collapsedBorders; }
void subtractCaptionRect(LayoutRect&) 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