Chromium Code Reviews| 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 AffineTransform transformToRoot = m_renderSVGForeignObject.cachedPaintInvali dationTransform() * m_renderSVGForeignObject.localTransform(); | |
|
fs
2014/12/17 10:16:10
Nit: Move this into the if-scope?
pdr.
2014/12/18 22:22:40
Done
| |
| 29 if (childPaintInfo.rect != LayoutRect::infiniteRect()) | |
| 30 childPaintInfo.rect = enclosingIntRect(transformToRoot.inverse().mapRect (FloatRect(childPaintInfo.rect))); | |
| 31 | |
| 26 if (SVGRenderSupport::isOverflowHidden(&m_renderSVGForeignObject)) | 32 if (SVGRenderSupport::isOverflowHidden(&m_renderSVGForeignObject)) |
| 27 childPaintInfo.context->clip(m_renderSVGForeignObject.viewportRect()); | 33 childPaintInfo.context->clip(m_renderSVGForeignObject.viewportRect()); |
| 28 | 34 |
| 29 SVGRenderingContext renderingContext; | 35 SVGRenderingContext renderingContext; |
| 30 bool continueRendering = true; | 36 bool continueRendering = true; |
| 31 if (paintInfo.phase == PaintPhaseForeground) { | 37 if (paintInfo.phase == PaintPhaseForeground) { |
| 32 renderingContext.prepareToRenderSVGContent(&m_renderSVGForeignObject, ch ildPaintInfo); | 38 renderingContext.prepareToRenderSVGContent(&m_renderSVGForeignObject, ch ildPaintInfo); |
| 33 continueRendering = renderingContext.isRenderingPrepared(); | 39 continueRendering = renderingContext.isRenderingPrepared(); |
| 34 } | 40 } |
| 35 | 41 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 46 BlockPainter(m_renderSVGForeignObject).paint(childPaintInfo, childPo int); | 52 BlockPainter(m_renderSVGForeignObject).paint(childPaintInfo, childPo int); |
| 47 childPaintInfo.phase = PaintPhaseForeground; | 53 childPaintInfo.phase = PaintPhaseForeground; |
| 48 BlockPainter(m_renderSVGForeignObject).paint(childPaintInfo, childPo int); | 54 BlockPainter(m_renderSVGForeignObject).paint(childPaintInfo, childPo int); |
| 49 childPaintInfo.phase = PaintPhaseOutline; | 55 childPaintInfo.phase = PaintPhaseOutline; |
| 50 BlockPainter(m_renderSVGForeignObject).paint(childPaintInfo, childPo int); | 56 BlockPainter(m_renderSVGForeignObject).paint(childPaintInfo, childPo int); |
| 51 } | 57 } |
| 52 } | 58 } |
| 53 } | 59 } |
| 54 | 60 |
| 55 } // namespace blink | 61 } // namespace blink |
| OLD | NEW |