Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Unified Diff: third_party/WebKit/Source/core/paint/SVGForeignObjectPainter.cpp

Issue 1562183002: ObjectPainter::paintAsStackingContext() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());
}
}

Powered by Google App Engine
This is Rietveld 408576698