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/SVGRootPainter.h" | 6 #include "core/paint/SVGRootPainter.h" |
7 | 7 |
8 #include "core/paint/BoxPainter.h" | 8 #include "core/paint/BoxPainter.h" |
9 #include "core/rendering/PaintInfo.h" | 9 #include "core/rendering/PaintInfo.h" |
10 #include "core/rendering/svg/RenderSVGRoot.h" | 10 #include "core/rendering/svg/RenderSVGRoot.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 // Apply initial viewport clip. | 46 // Apply initial viewport clip. |
47 if (m_renderSVGRoot.shouldApplyViewportClip()) | 47 if (m_renderSVGRoot.shouldApplyViewportClip()) |
48 childPaintInfo.context->clip(pixelSnappedIntRect(m_renderSVGRoot.overflo
wClipRect(paintOffset))); | 48 childPaintInfo.context->clip(pixelSnappedIntRect(m_renderSVGRoot.overflo
wClipRect(paintOffset))); |
49 | 49 |
50 // Convert from container offsets (html renderers) to a relative transform (
svg renderers). | 50 // Convert from container offsets (html renderers) to a relative transform (
svg renderers). |
51 // Transform from our paint container's coordinate system to our local coord
s. | 51 // Transform from our paint container's coordinate system to our local coord
s. |
52 IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset); | 52 IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset); |
53 childPaintInfo.applyTransform(AffineTransform::translation(adjustedPaintOffs
et.x(), adjustedPaintOffset.y()) * m_renderSVGRoot.localToBorderBoxTransform()); | 53 childPaintInfo.applyTransform(AffineTransform::translation(adjustedPaintOffs
et.x(), adjustedPaintOffset.y()) * m_renderSVGRoot.localToBorderBoxTransform()); |
54 | 54 |
| 55 // SVG doesn't use paintOffset internally but we need to bake it into the pa
int rect. |
| 56 childPaintInfo.rect.move(-adjustedPaintOffset.x(), -adjustedPaintOffset.y())
; |
| 57 |
55 SVGRenderingContext renderingContext; | 58 SVGRenderingContext renderingContext; |
56 if (childPaintInfo.phase == PaintPhaseForeground) { | 59 if (childPaintInfo.phase == PaintPhaseForeground) { |
57 renderingContext.prepareToRenderSVGContent(&m_renderSVGRoot, childPaintI
nfo); | 60 renderingContext.prepareToRenderSVGContent(&m_renderSVGRoot, childPaintI
nfo); |
58 if (!renderingContext.isRenderingPrepared()) | 61 if (!renderingContext.isRenderingPrepared()) |
59 return; | 62 return; |
60 } | 63 } |
61 | 64 |
62 BoxPainter(m_renderSVGRoot).paint(childPaintInfo, LayoutPoint()); | 65 BoxPainter(m_renderSVGRoot).paint(childPaintInfo, LayoutPoint()); |
63 } | 66 } |
64 | 67 |
65 } // namespace blink | 68 } // namespace blink |
OLD | NEW |