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

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..1e8ec92d9150107a5090449feb816dcb29755617 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,10 @@ 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);
- }
+ // The delegate forwards calls to paint() in LayoutObject::paintAsPseudoStackingContext() to
+ // BlockPainter::paint(), instead of m_layoutSVGForeignObject.paint() (which would call this method again).
+ BlockPainterDelegate delegate(m_layoutSVGForeignObject);
+ ObjectPainter(delegate).paintAsPseudoStackingContext(paintContext.paintInfo(), LayoutPoint());
}
}
« no previous file with comments | « third_party/WebKit/Source/core/paint/ObjectPainter.cpp ('k') | third_party/WebKit/Source/core/paint/ScrollbarPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698