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 m_renderSVGText.updatePaintInfoRect(blockInfo.rect); |
| 28 |
25 BlockPainter(m_renderSVGText).paint(blockInfo, LayoutPoint()); | 29 BlockPainter(m_renderSVGText).paint(blockInfo, LayoutPoint()); |
26 | 30 |
27 // Paint the outlines, if any | 31 // Paint the outlines, if any |
28 if (paintInfo.phase == PaintPhaseForeground) { | 32 if (paintInfo.phase == PaintPhaseForeground) { |
29 blockInfo.phase = PaintPhaseSelfOutline; | 33 blockInfo.phase = PaintPhaseSelfOutline; |
30 BlockPainter(m_renderSVGText).paint(blockInfo, LayoutPoint()); | 34 BlockPainter(m_renderSVGText).paint(blockInfo, LayoutPoint()); |
31 } | 35 } |
32 } | 36 } |
33 | 37 |
34 } // namespace blink | 38 } // namespace blink |
OLD | NEW |