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/SVGRootInlineBoxPainter.h" | 6 #include "core/paint/SVGRootInlineBoxPainter.h" |
7 | 7 |
| 8 #include "core/paint/SVGInlineFlowBoxPainter.h" |
8 #include "core/paint/SVGInlineTextBoxPainter.h" | 9 #include "core/paint/SVGInlineTextBoxPainter.h" |
9 #include "core/rendering/PaintInfo.h" | 10 #include "core/rendering/PaintInfo.h" |
10 #include "core/rendering/svg/SVGInlineFlowBox.h" | 11 #include "core/rendering/svg/SVGInlineFlowBox.h" |
11 #include "core/rendering/svg/SVGInlineTextBox.h" | 12 #include "core/rendering/svg/SVGInlineTextBox.h" |
12 #include "core/rendering/svg/SVGRenderingContext.h" | 13 #include "core/rendering/svg/SVGRenderingContext.h" |
13 #include "core/rendering/svg/SVGRootInlineBox.h" | 14 #include "core/rendering/svg/SVGRootInlineBox.h" |
14 #include "platform/graphics/GraphicsContextStateSaver.h" | 15 #include "platform/graphics/GraphicsContextStateSaver.h" |
15 | 16 |
16 namespace blink { | 17 namespace blink { |
17 | 18 |
18 void SVGRootInlineBoxPainter::paint(PaintInfo& paintInfo, const LayoutPoint& pai
ntOffset) | 19 void SVGRootInlineBoxPainter::paint(PaintInfo& paintInfo, const LayoutPoint& pai
ntOffset) |
19 { | 20 { |
20 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh
aseSelection); | 21 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh
aseSelection); |
21 | 22 |
22 bool isPrinting = m_svgRootInlineBox.renderer().document().printing(); | 23 bool isPrinting = m_svgRootInlineBox.renderer().document().printing(); |
23 bool hasSelection = !isPrinting && m_svgRootInlineBox.selectionState() != Re
nderObject::SelectionNone; | 24 bool hasSelection = !isPrinting && m_svgRootInlineBox.selectionState() != Re
nderObject::SelectionNone; |
24 | 25 |
25 PaintInfo childPaintInfo(paintInfo); | 26 PaintInfo childPaintInfo(paintInfo); |
26 if (hasSelection) { | 27 if (hasSelection) { |
27 for (InlineBox* child = m_svgRootInlineBox.firstChild(); child; child =
child->nextOnLine()) { | 28 for (InlineBox* child = m_svgRootInlineBox.firstChild(); child; child =
child->nextOnLine()) { |
28 if (child->isSVGInlineTextBox()) | 29 if (child->isSVGInlineTextBox()) |
29 SVGInlineTextBoxPainter(*toSVGInlineTextBox(child)).paintSelecti
onBackground(childPaintInfo); | 30 SVGInlineTextBoxPainter(*toSVGInlineTextBox(child)).paintSelecti
onBackground(childPaintInfo); |
30 else if (child->isSVGInlineFlowBox()) | 31 else if (child->isSVGInlineFlowBox()) |
31 toSVGInlineFlowBox(child)->paintSelectionBackground(childPaintIn
fo); | 32 SVGInlineFlowBoxPainter(*toSVGInlineFlowBox(child)).paintSelecti
onBackground(childPaintInfo); |
32 } | 33 } |
33 } | 34 } |
34 | 35 |
35 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 36 GraphicsContextStateSaver stateSaver(*paintInfo.context); |
36 SVGRenderingContext renderingContext(&m_svgRootInlineBox.renderer(), paintIn
fo); | 37 SVGRenderingContext renderingContext(&m_svgRootInlineBox.renderer(), paintIn
fo); |
37 if (renderingContext.isRenderingPrepared()) { | 38 if (renderingContext.isRenderingPrepared()) { |
38 for (InlineBox* child = m_svgRootInlineBox.firstChild(); child; child =
child->nextOnLine()) | 39 for (InlineBox* child = m_svgRootInlineBox.firstChild(); child; child =
child->nextOnLine()) |
39 child->paint(paintInfo, paintOffset, 0, 0); | 40 child->paint(paintInfo, paintOffset, 0, 0); |
40 } | 41 } |
41 } | 42 } |
42 | 43 |
43 } // namespace blink | 44 } // namespace blink |
OLD | NEW |