| 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/layout/api/SelectionState.h" |
| 8 #include "core/layout/svg/line/SVGInlineFlowBox.h" | 9 #include "core/layout/svg/line/SVGInlineFlowBox.h" |
| 9 #include "core/layout/svg/line/SVGInlineTextBox.h" | 10 #include "core/layout/svg/line/SVGInlineTextBox.h" |
| 10 #include "core/layout/svg/line/SVGRootInlineBox.h" | 11 #include "core/layout/svg/line/SVGRootInlineBox.h" |
| 11 #include "core/paint/LayoutObjectDrawingRecorder.h" | 12 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 12 #include "core/paint/PaintInfo.h" | 13 #include "core/paint/PaintInfo.h" |
| 13 #include "core/paint/SVGInlineFlowBoxPainter.h" | 14 #include "core/paint/SVGInlineFlowBoxPainter.h" |
| 14 #include "core/paint/SVGInlineTextBoxPainter.h" | 15 #include "core/paint/SVGInlineTextBoxPainter.h" |
| 15 #include "core/paint/SVGPaintContext.h" | 16 #include "core/paint/SVGPaintContext.h" |
| 16 | 17 |
| 17 namespace blink { | 18 namespace blink { |
| 18 | 19 |
| 19 void SVGRootInlineBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoin
t& paintOffset) | 20 void SVGRootInlineBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoin
t& paintOffset) |
| 20 { | 21 { |
| 21 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh
aseSelection); | 22 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh
aseSelection); |
| 22 | 23 |
| 23 bool hasSelection = !paintInfo.isPrinting() && m_svgRootInlineBox.selectionS
tate() != LayoutObject::SelectionNone; | 24 bool hasSelection = !paintInfo.isPrinting() && m_svgRootInlineBox.selectionS
tate() != SelectionNone; |
| 24 | 25 |
| 25 PaintInfo paintInfoBeforeFiltering(paintInfo); | 26 PaintInfo paintInfoBeforeFiltering(paintInfo); |
| 26 if (hasSelection && !LayoutObjectDrawingRecorder::useCachedDrawingIfPossible
(*paintInfoBeforeFiltering.context, m_svgRootInlineBox.layoutObject(), paintInfo
BeforeFiltering.phase)) { | 27 if (hasSelection && !LayoutObjectDrawingRecorder::useCachedDrawingIfPossible
(*paintInfoBeforeFiltering.context, m_svgRootInlineBox.layoutObject(), paintInfo
BeforeFiltering.phase)) { |
| 27 LayoutObjectDrawingRecorder recorder(*paintInfoBeforeFiltering.context,
m_svgRootInlineBox.layoutObject(), paintInfoBeforeFiltering.phase, paintInfoBefo
reFiltering.rect); | 28 LayoutObjectDrawingRecorder recorder(*paintInfoBeforeFiltering.context,
m_svgRootInlineBox.layoutObject(), paintInfoBeforeFiltering.phase, paintInfoBefo
reFiltering.rect); |
| 28 for (InlineBox* child = m_svgRootInlineBox.firstChild(); child; child =
child->nextOnLine()) { | 29 for (InlineBox* child = m_svgRootInlineBox.firstChild(); child; child =
child->nextOnLine()) { |
| 29 if (child->isSVGInlineTextBox()) | 30 if (child->isSVGInlineTextBox()) |
| 30 SVGInlineTextBoxPainter(*toSVGInlineTextBox(child)).paintSelecti
onBackground(paintInfoBeforeFiltering); | 31 SVGInlineTextBoxPainter(*toSVGInlineTextBox(child)).paintSelecti
onBackground(paintInfoBeforeFiltering); |
| 31 else if (child->isSVGInlineFlowBox()) | 32 else if (child->isSVGInlineFlowBox()) |
| 32 SVGInlineFlowBoxPainter(*toSVGInlineFlowBox(child)).paintSelecti
onBackground(paintInfoBeforeFiltering); | 33 SVGInlineFlowBoxPainter(*toSVGInlineFlowBox(child)).paintSelecti
onBackground(paintInfoBeforeFiltering); |
| 33 } | 34 } |
| 34 } | 35 } |
| 35 | 36 |
| 36 SVGPaintContext paintContext(m_svgRootInlineBox.layoutObject(), paintInfoBef
oreFiltering); | 37 SVGPaintContext paintContext(m_svgRootInlineBox.layoutObject(), paintInfoBef
oreFiltering); |
| 37 if (paintContext.applyClipMaskAndFilterIfNecessary()) { | 38 if (paintContext.applyClipMaskAndFilterIfNecessary()) { |
| 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(paintContext.paintInfo(), paintOffset, 0, 0); | 40 child->paint(paintContext.paintInfo(), paintOffset, 0, 0); |
| 40 } | 41 } |
| 41 } | 42 } |
| 42 | 43 |
| 43 } // namespace blink | 44 } // namespace blink |
| OLD | NEW |