| 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" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 m_layoutSVGForeignObject.localSVGTransform()); | 43 m_layoutSVGForeignObject.localSVGTransform()); |
| 44 SVGTransformContext transformContext( | 44 SVGTransformContext transformContext( |
| 45 paintInfoBeforeFiltering.context, m_layoutSVGForeignObject, | 45 paintInfoBeforeFiltering.context, m_layoutSVGForeignObject, |
| 46 m_layoutSVGForeignObject.localSVGTransform()); | 46 m_layoutSVGForeignObject.localSVGTransform()); |
| 47 | 47 |
| 48 // In theory we should just let BlockPainter::paint() handle the clip, but for | 48 // In theory we should just let BlockPainter::paint() handle the clip, but for |
| 49 // now we don't allow normal overflow clip for LayoutSVGBlock, so we have to | 49 // now we don't allow normal overflow clip for LayoutSVGBlock, so we have to |
| 50 // apply clip manually. See LayoutSVGBlock::allowsOverflowClip() for details. | 50 // apply clip manually. See LayoutSVGBlock::allowsOverflowClip() for details. |
| 51 Optional<FloatClipRecorder> clipRecorder; | 51 Optional<FloatClipRecorder> clipRecorder; |
| 52 if (SVGLayoutSupport::isOverflowHidden(&m_layoutSVGForeignObject)) { | 52 if (SVGLayoutSupport::isOverflowHidden(&m_layoutSVGForeignObject)) { |
| 53 clipRecorder.emplace(paintInfoBeforeFiltering.context, | 53 clipRecorder.emplace( |
| 54 m_layoutSVGForeignObject, | 54 paintInfoBeforeFiltering.context, paintInfoBeforeFiltering.phase, |
| 55 paintInfoBeforeFiltering.phase, | 55 FloatRect(m_layoutSVGForeignObject.frameRect()), |
| 56 FloatRect(m_layoutSVGForeignObject.frameRect())); | 56 m_layoutSVGForeignObject.visualRect(), |
| 57 m_layoutSVGForeignObject.debugName(), |
| 58 m_layoutSVGForeignObject |
| 59 .paintedOutputOfObjectHasNoEffectRegardlessOfSize()); |
| 57 } | 60 } |
| 58 | 61 |
| 59 SVGPaintContext paintContext(m_layoutSVGForeignObject, | 62 SVGPaintContext paintContext(m_layoutSVGForeignObject, |
| 60 paintInfoBeforeFiltering); | 63 paintInfoBeforeFiltering); |
| 61 bool continueRendering = true; | 64 bool continueRendering = true; |
| 62 if (paintContext.paintInfo().phase == PaintPhaseForeground) | 65 if (paintContext.paintInfo().phase == PaintPhaseForeground) |
| 63 continueRendering = paintContext.applyClipMaskAndFilterIfNecessary(); | 66 continueRendering = paintContext.applyClipMaskAndFilterIfNecessary(); |
| 64 | 67 |
| 65 if (continueRendering) { | 68 if (continueRendering) { |
| 66 // Paint all phases of FO elements atomically as though the FO element | 69 // Paint all phases of FO elements atomically as though the FO element |
| 67 // established its own stacking context. The delegate forwards calls to | 70 // established its own stacking context. The delegate forwards calls to |
| 68 // paint() in LayoutObject::paintAllPhasesAtomically() to | 71 // paint() in LayoutObject::paintAllPhasesAtomically() to |
| 69 // BlockPainter::paint(), instead of m_layoutSVGForeignObject.paint() (which | 72 // BlockPainter::paint(), instead of m_layoutSVGForeignObject.paint() (which |
| 70 // would call this method again). | 73 // would call this method again). |
| 71 BlockPainterDelegate delegate(m_layoutSVGForeignObject); | 74 BlockPainterDelegate delegate(m_layoutSVGForeignObject); |
| 72 ObjectPainter(delegate).paintAllPhasesAtomically(paintContext.paintInfo(), | 75 ObjectPainter(delegate).paintAllPhasesAtomically(paintContext.paintInfo(), |
| 73 LayoutPoint()); | 76 LayoutPoint()); |
| 74 } | 77 } |
| 75 } | 78 } |
| 76 | 79 |
| 77 } // namespace blink | 80 } // namespace blink |
| OLD | NEW |