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/SVGInlineFlowBoxPainter.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 "platform/graphics/GraphicsContextStateSaver.h" | |
14 | 13 |
15 namespace blink { | 14 namespace blink { |
16 | 15 |
17 void SVGInlineFlowBoxPainter::paintSelectionBackground(const PaintInfo& paintInf
o) | 16 void SVGInlineFlowBoxPainter::paintSelectionBackground(const PaintInfo& paintInf
o) |
18 { | 17 { |
19 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh
aseSelection); | 18 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh
aseSelection); |
20 | 19 |
21 PaintInfo childPaintInfo(paintInfo); | 20 PaintInfo childPaintInfo(paintInfo); |
22 for (InlineBox* child = m_svgInlineFlowBox.firstChild(); child; child = chil
d->nextOnLine()) { | 21 for (InlineBox* child = m_svgInlineFlowBox.firstChild(); child; child = chil
d->nextOnLine()) { |
23 if (child->isSVGInlineTextBox()) | 22 if (child->isSVGInlineTextBox()) |
24 SVGInlineTextBoxPainter(*toSVGInlineTextBox(child)).paintSelectionBa
ckground(childPaintInfo); | 23 SVGInlineTextBoxPainter(*toSVGInlineTextBox(child)).paintSelectionBa
ckground(childPaintInfo); |
25 else if (child->isSVGInlineFlowBox()) | 24 else if (child->isSVGInlineFlowBox()) |
26 SVGInlineFlowBoxPainter(*toSVGInlineFlowBox(child)).paintSelectionBa
ckground(childPaintInfo); | 25 SVGInlineFlowBoxPainter(*toSVGInlineFlowBox(child)).paintSelectionBa
ckground(childPaintInfo); |
27 } | 26 } |
28 } | 27 } |
29 | 28 |
30 void SVGInlineFlowBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoin
t& paintOffset) | 29 void SVGInlineFlowBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoin
t& paintOffset) |
31 { | 30 { |
32 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh
aseSelection); | 31 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh
aseSelection); |
33 | 32 |
34 // FIXME: Remove this state saver when SVGRenderSupport::updateGraphicsConte
xt | |
35 // no longer affects the global alpha state. See crbug.com/453225 | |
36 GraphicsContextStateSaver stateSaver(*paintInfo.context); | |
37 | |
38 SVGRenderingContext renderingContext(m_svgInlineFlowBox.renderer(), paintInf
o); | 33 SVGRenderingContext renderingContext(m_svgInlineFlowBox.renderer(), paintInf
o); |
39 if (renderingContext.applyClipMaskAndFilterIfNecessary()) { | 34 if (renderingContext.applyClipMaskAndFilterIfNecessary()) { |
40 for (InlineBox* child = m_svgInlineFlowBox.firstChild(); child; child =
child->nextOnLine()) | 35 for (InlineBox* child = m_svgInlineFlowBox.firstChild(); child; child =
child->nextOnLine()) |
41 child->paint(renderingContext.paintInfo(), paintOffset, 0, 0); | 36 child->paint(renderingContext.paintInfo(), paintOffset, 0, 0); |
42 } | 37 } |
43 } | 38 } |
44 | 39 |
45 } // namespace blink | 40 } // namespace blink |
OLD | NEW |