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/SVGTextPainter.h" | 6 #include "core/paint/SVGTextPainter.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/RenderSVGText.h" | 10 #include "core/rendering/svg/RenderSVGText.h" |
11 #include "platform/graphics/GraphicsContextStateSaver.h" | 11 #include "platform/graphics/GraphicsContextStateSaver.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 void SVGTextPainter::paint(const PaintInfo& paintInfo) | 15 void SVGTextPainter::paint(const PaintInfo& paintInfo) |
16 { | 16 { |
17 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection) | 17 if (paintInfo.phase != PaintPhaseForeground && paintInfo.phase != PaintPhase Selection) |
18 return; | 18 return; |
19 | 19 |
20 PaintInfo blockInfo(paintInfo); | 20 PaintInfo blockInfo(paintInfo); |
21 GraphicsContextStateSaver stateSaver(*blockInfo.context, false); | 21 GraphicsContextStateSaver stateSaver(*blockInfo.context, false); |
22 | 22 |
23 blockInfo.applyTransform(m_renderSVGText.localToParentTransform(), &stateSav er); | 23 blockInfo.applyTransform(m_renderSVGText.localToParentTransform(), &stateSav er); |
24 | 24 |
25 // When transitioning from SVG to block painters we need to keep the PaintIn fo rect up-to-date | |
26 // because it can be used for clipping. | |
27 AffineTransform transformToRoot = m_renderSVGText.cachedPaintInvalidationTra nsform() * m_renderSVGText.localToParentTransform(); | |
fs
2014/12/17 10:16:10
Nit: Same as for fO. (Would it make sense to move
pdr.
2014/12/18 22:22:40
Good idea. Done.
| |
28 if (blockInfo.rect != LayoutRect::infiniteRect()) | |
29 blockInfo.rect = enclosingIntRect(transformToRoot.inverse().mapRect(Floa tRect(blockInfo.rect))); | |
30 | |
25 BlockPainter(m_renderSVGText).paint(blockInfo, LayoutPoint()); | 31 BlockPainter(m_renderSVGText).paint(blockInfo, LayoutPoint()); |
26 | 32 |
27 // Paint the outlines, if any | 33 // Paint the outlines, if any |
28 if (paintInfo.phase == PaintPhaseForeground) { | 34 if (paintInfo.phase == PaintPhaseForeground) { |
29 blockInfo.phase = PaintPhaseSelfOutline; | 35 blockInfo.phase = PaintPhaseSelfOutline; |
30 BlockPainter(m_renderSVGText).paint(blockInfo, LayoutPoint()); | 36 BlockPainter(m_renderSVGText).paint(blockInfo, LayoutPoint()); |
31 } | 37 } |
32 } | 38 } |
33 | 39 |
34 } // namespace blink | 40 } // namespace blink |
OLD | NEW |