Chromium Code Reviews| Index: third_party/WebKit/Source/core/paint/SVGForeignObjectPainter.cpp |
| diff --git a/third_party/WebKit/Source/core/paint/SVGForeignObjectPainter.cpp b/third_party/WebKit/Source/core/paint/SVGForeignObjectPainter.cpp |
| index aaa8f0f43c76be976e40cdfc828010687a86064c..331f3b3190133d89effda6201b8d8ec08009e85b 100644 |
| --- a/third_party/WebKit/Source/core/paint/SVGForeignObjectPainter.cpp |
| +++ b/third_party/WebKit/Source/core/paint/SVGForeignObjectPainter.cpp |
| @@ -8,6 +8,7 @@ |
| #include "core/layout/svg/SVGLayoutSupport.h" |
| #include "core/paint/BlockPainter.h" |
| #include "core/paint/FloatClipRecorder.h" |
| +#include "core/paint/ObjectPainter.h" |
| #include "core/paint/PaintInfo.h" |
| #include "core/paint/SVGPaintContext.h" |
| #include "core/paint/TransformRecorder.h" |
| @@ -15,6 +16,25 @@ |
| namespace blink { |
| +namespace { |
| + |
| +class BlockPainterDelegate : public LayoutBlock { |
| +public: |
| + BlockPainterDelegate(const LayoutSVGForeignObject& layoutSVGForeignObject) |
| + : LayoutBlock(nullptr) |
| + , m_layoutSVGForeignObject(layoutSVGForeignObject) |
| + { } |
| + |
| +private: |
| + void paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) const final |
| + { |
| + BlockPainter(m_layoutSVGForeignObject).paint(paintInfo, paintOffset); |
| + } |
| + const LayoutSVGForeignObject& m_layoutSVGForeignObject; |
| +}; |
| + |
| +} // namespace |
| + |
| void SVGForeignObjectPainter::paint(const PaintInfo& paintInfo) |
| { |
| if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhaseSelection) |
| @@ -35,20 +55,8 @@ void SVGForeignObjectPainter::paint(const PaintInfo& paintInfo) |
| if (continueRendering) { |
| // Paint all phases of FO elements atomically as though the FO element established its own stacking context. |
| - bool preservePhase = paintContext.paintInfo().phase == PaintPhaseSelection || paintContext.paintInfo().phase == PaintPhaseTextClip; |
| - const LayoutPoint childPoint = IntPoint(); |
| - paintContext.paintInfo().phase = preservePhase ? paintContext.paintInfo().phase : PaintPhaseBlockBackground; |
| - BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo(), childPoint); |
| - if (!preservePhase) { |
| - paintContext.paintInfo().phase = PaintPhaseChildBlockBackgrounds; |
| - BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo(), childPoint); |
| - paintContext.paintInfo().phase = PaintPhaseFloat; |
| - BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo(), childPoint); |
| - paintContext.paintInfo().phase = PaintPhaseForeground; |
| - BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo(), childPoint); |
| - paintContext.paintInfo().phase = PaintPhaseOutline; |
| - BlockPainter(m_layoutSVGForeignObject).paint(paintContext.paintInfo(), childPoint); |
| - } |
| + BlockPainterDelegate delegate(m_layoutSVGForeignObject); |
|
chrishtr
2016/01/07 01:51:26
What prevents you from just calling BlockPainter(m
Xianzhu
2016/01/07 17:02:40
It would call m_layoutSVGForeignObject.paint() aga
|
| + ObjectPainter(delegate).paintAsStackingContext(paintContext.paintInfo(), LayoutPoint()); |
| } |
| } |