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 "config.h" | 5 #include "config.h" |
6 #include "core/paint/SVGForeignObjectPainter.h" | 6 #include "core/paint/SVGForeignObjectPainter.h" |
7 | 7 |
8 #include "core/paint/BlockPainter.h" | 8 #include "core/paint/BlockPainter.h" |
9 #include "core/rendering/PaintInfo.h" | 9 #include "core/rendering/PaintInfo.h" |
10 #include "core/rendering/svg/RenderSVGForeignObject.h" | 10 #include "core/rendering/svg/RenderSVGForeignObject.h" |
11 #include "core/rendering/svg/SVGRenderSupport.h" | 11 #include "core/rendering/svg/SVGRenderSupport.h" |
12 #include "core/rendering/svg/SVGRenderingContext.h" | 12 #include "core/rendering/svg/SVGRenderingContext.h" |
13 #include "platform/graphics/GraphicsContextStateSaver.h" | 13 #include "platform/graphics/GraphicsContextStateSaver.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 void SVGForeignObjectPainter::paint(const PaintInfo& paintInfo) | 17 void SVGForeignObjectPainter::paint(const PaintInfo& paintInfo) |
18 { | 18 { |
19 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection) | 19 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase
Selection) |
20 return; | 20 return; |
21 | 21 |
22 PaintInfo childPaintInfo(paintInfo); | 22 PaintInfo childPaintInfo(paintInfo); |
23 GraphicsContextStateSaver stateSaver(*childPaintInfo.context); | 23 GraphicsContextStateSaver stateSaver(*childPaintInfo.context); |
24 childPaintInfo.applyTransform(m_renderSVGForeignObject.localTransform()); | 24 childPaintInfo.applyTransform(m_renderSVGForeignObject.localTransform()); |
25 | 25 |
| 26 // When transitioning from SVG to block painters we need to keep the PaintIn
fo rect up-to-date |
| 27 // because it can be used for clipping. |
| 28 m_renderSVGForeignObject.updatePaintInfoRect(childPaintInfo.rect); |
| 29 |
26 if (SVGRenderSupport::isOverflowHidden(&m_renderSVGForeignObject)) | 30 if (SVGRenderSupport::isOverflowHidden(&m_renderSVGForeignObject)) |
27 childPaintInfo.context->clip(m_renderSVGForeignObject.viewportRect()); | 31 childPaintInfo.context->clip(m_renderSVGForeignObject.viewportRect()); |
28 | 32 |
29 SVGRenderingContext renderingContext; | 33 SVGRenderingContext renderingContext; |
30 bool continueRendering = true; | 34 bool continueRendering = true; |
31 if (paintInfo.phase == PaintPhaseForeground) { | 35 if (paintInfo.phase == PaintPhaseForeground) { |
32 renderingContext.prepareToRenderSVGContent(&m_renderSVGForeignObject, ch
ildPaintInfo); | 36 renderingContext.prepareToRenderSVGContent(&m_renderSVGForeignObject, ch
ildPaintInfo); |
33 continueRendering = renderingContext.isRenderingPrepared(); | 37 continueRendering = renderingContext.isRenderingPrepared(); |
34 } | 38 } |
35 | 39 |
(...skipping 10 matching lines...) Expand all Loading... |
46 BlockPainter(m_renderSVGForeignObject).paint(childPaintInfo, childPo
int); | 50 BlockPainter(m_renderSVGForeignObject).paint(childPaintInfo, childPo
int); |
47 childPaintInfo.phase = PaintPhaseForeground; | 51 childPaintInfo.phase = PaintPhaseForeground; |
48 BlockPainter(m_renderSVGForeignObject).paint(childPaintInfo, childPo
int); | 52 BlockPainter(m_renderSVGForeignObject).paint(childPaintInfo, childPo
int); |
49 childPaintInfo.phase = PaintPhaseOutline; | 53 childPaintInfo.phase = PaintPhaseOutline; |
50 BlockPainter(m_renderSVGForeignObject).paint(childPaintInfo, childPo
int); | 54 BlockPainter(m_renderSVGForeignObject).paint(childPaintInfo, childPo
int); |
51 } | 55 } |
52 } | 56 } |
53 } | 57 } |
54 | 58 |
55 } // namespace blink | 59 } // namespace blink |
OLD | NEW |