| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/SVGForeignObjectPainter.h" | 5 #include "core/paint/SVGForeignObjectPainter.h" |
| 6 | 6 |
| 7 #include "core/layout/svg/LayoutSVGForeignObject.h" | 7 #include "core/layout/svg/LayoutSVGForeignObject.h" |
| 8 #include "core/layout/svg/SVGLayoutSupport.h" | 8 #include "core/layout/svg/SVGLayoutSupport.h" |
| 9 #include "core/paint/BlockPainter.h" | 9 #include "core/paint/BlockPainter.h" |
| 10 #include "core/paint/FloatClipRecorder.h" | 10 #include "core/paint/FloatClipRecorder.h" |
| 11 #include "core/paint/ObjectPainter.h" | 11 #include "core/paint/ObjectPainter.h" |
| 12 #include "core/paint/PaintInfo.h" | 12 #include "core/paint/PaintInfo.h" |
| 13 #include "core/paint/SVGPaintContext.h" | 13 #include "core/paint/SVGPaintContext.h" |
| 14 #include "core/paint/TransformRecorder.h" | |
| 15 #include "wtf/Optional.h" | 14 #include "wtf/Optional.h" |
| 16 | 15 |
| 17 namespace blink { | 16 namespace blink { |
| 18 | 17 |
| 19 namespace { | 18 namespace { |
| 20 | 19 |
| 21 class BlockPainterDelegate : public LayoutBlock { | 20 class BlockPainterDelegate : public LayoutBlock { |
| 22 public: | 21 public: |
| 23 BlockPainterDelegate(const LayoutSVGForeignObject& layoutSVGForeignObject) | 22 BlockPainterDelegate(const LayoutSVGForeignObject& layoutSVGForeignObject) |
| 24 : LayoutBlock(nullptr) | 23 : LayoutBlock(nullptr) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 35 | 34 |
| 36 } // namespace | 35 } // namespace |
| 37 | 36 |
| 38 void SVGForeignObjectPainter::paint(const PaintInfo& paintInfo) | 37 void SVGForeignObjectPainter::paint(const PaintInfo& paintInfo) |
| 39 { | 38 { |
| 40 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection) | 39 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection) |
| 41 return; | 40 return; |
| 42 | 41 |
| 43 PaintInfo paintInfoBeforeFiltering(paintInfo); | 42 PaintInfo paintInfoBeforeFiltering(paintInfo); |
| 44 paintInfoBeforeFiltering.updateCullRect(m_layoutSVGForeignObject.localSVGTra
nsform()); | 43 paintInfoBeforeFiltering.updateCullRect(m_layoutSVGForeignObject.localSVGTra
nsform()); |
| 45 TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layo
utSVGForeignObject, m_layoutSVGForeignObject.localSVGTransform()); | 44 SVGTransformContext transformContext(paintInfoBeforeFiltering.context, m_lay
outSVGForeignObject, m_layoutSVGForeignObject.localSVGTransform()); |
| 46 | 45 |
| 47 Optional<FloatClipRecorder> clipRecorder; | 46 Optional<FloatClipRecorder> clipRecorder; |
| 48 if (SVGLayoutSupport::isOverflowHidden(&m_layoutSVGForeignObject)) | 47 if (SVGLayoutSupport::isOverflowHidden(&m_layoutSVGForeignObject)) |
| 49 clipRecorder.emplace(paintInfoBeforeFiltering.context, m_layoutSVGForeig
nObject, paintInfoBeforeFiltering.phase, m_layoutSVGForeignObject.viewportRect()
); | 48 clipRecorder.emplace(paintInfoBeforeFiltering.context, m_layoutSVGForeig
nObject, paintInfoBeforeFiltering.phase, m_layoutSVGForeignObject.viewportRect()
); |
| 50 | 49 |
| 51 SVGPaintContext paintContext(m_layoutSVGForeignObject, paintInfoBeforeFilter
ing); | 50 SVGPaintContext paintContext(m_layoutSVGForeignObject, paintInfoBeforeFilter
ing); |
| 52 bool continueRendering = true; | 51 bool continueRendering = true; |
| 53 if (paintContext.paintInfo().phase == PaintPhaseForeground) | 52 if (paintContext.paintInfo().phase == PaintPhaseForeground) |
| 54 continueRendering = paintContext.applyClipMaskAndFilterIfNecessary(); | 53 continueRendering = paintContext.applyClipMaskAndFilterIfNecessary(); |
| 55 | 54 |
| 56 if (continueRendering) { | 55 if (continueRendering) { |
| 57 // Paint all phases of FO elements atomically as though the FO element e
stablished its own stacking context. | 56 // Paint all phases of FO elements atomically as though the FO element e
stablished its own stacking context. |
| 58 // The delegate forwards calls to paint() in LayoutObject::paintAllPhase
sAtomically() to | 57 // The delegate forwards calls to paint() in LayoutObject::paintAllPhase
sAtomically() to |
| 59 // BlockPainter::paint(), instead of m_layoutSVGForeignObject.paint() (w
hich would call this method again). | 58 // BlockPainter::paint(), instead of m_layoutSVGForeignObject.paint() (w
hich would call this method again). |
| 60 BlockPainterDelegate delegate(m_layoutSVGForeignObject); | 59 BlockPainterDelegate delegate(m_layoutSVGForeignObject); |
| 61 ObjectPainter(delegate).paintAllPhasesAtomically(paintContext.paintInfo(
), LayoutPoint()); | 60 ObjectPainter(delegate).paintAllPhasesAtomically(paintContext.paintInfo(
), LayoutPoint()); |
| 62 } | 61 } |
| 63 } | 62 } |
| 64 | 63 |
| 65 } // namespace blink | 64 } // namespace blink |
| OLD | NEW |