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