| 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/PaintInfo.h" | 8 #include "core/layout/PaintInfo.h" |
| 9 #include "core/layout/svg/line/SVGInlineFlowBox.h" | 9 #include "core/layout/svg/line/SVGInlineFlowBox.h" |
| 10 #include "core/layout/svg/line/SVGInlineTextBox.h" | 10 #include "core/layout/svg/line/SVGInlineTextBox.h" |
| 11 #include "core/layout/svg/line/SVGRootInlineBox.h" | 11 #include "core/layout/svg/line/SVGRootInlineBox.h" |
| 12 #include "core/paint/RenderDrawingRecorder.h" | 12 #include "core/paint/RenderDrawingRecorder.h" |
| 13 #include "core/paint/SVGInlineFlowBoxPainter.h" | 13 #include "core/paint/SVGInlineFlowBoxPainter.h" |
| 14 #include "core/paint/SVGInlineTextBoxPainter.h" | 14 #include "core/paint/SVGInlineTextBoxPainter.h" |
| 15 #include "core/paint/SVGPaintContext.h" | 15 #include "core/paint/SVGPaintContext.h" |
| 16 | 16 |
| 17 namespace blink { | 17 namespace blink { |
| 18 | 18 |
| 19 void SVGRootInlineBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoin
t& paintOffset) | 19 void SVGRootInlineBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoin
t& paintOffset) |
| 20 { | 20 { |
| 21 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh
aseSelection); | 21 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh
aseSelection); |
| 22 | 22 |
| 23 bool isPrinting = m_svgRootInlineBox.renderer().document().printing(); | 23 bool isPrinting = m_svgRootInlineBox.layoutObject().document().printing(); |
| 24 bool hasSelection = !isPrinting && m_svgRootInlineBox.selectionState() != La
youtObject::SelectionNone; | 24 bool hasSelection = !isPrinting && m_svgRootInlineBox.selectionState() != La
youtObject::SelectionNone; |
| 25 | 25 |
| 26 PaintInfo paintInfoBeforeFiltering(paintInfo); | 26 PaintInfo paintInfoBeforeFiltering(paintInfo); |
| 27 if (hasSelection) { | 27 if (hasSelection) { |
| 28 RenderDrawingRecorder recorder(paintInfoBeforeFiltering.context, m_svgRo
otInlineBox.renderer(), paintInfoBeforeFiltering.phase, paintInfoBeforeFiltering
.rect); | 28 RenderDrawingRecorder recorder(paintInfoBeforeFiltering.context, m_svgRo
otInlineBox.layoutObject(), paintInfoBeforeFiltering.phase, paintInfoBeforeFilte
ring.rect); |
| 29 if (!recorder.canUseCachedDrawing()) { | 29 if (!recorder.canUseCachedDrawing()) { |
| 30 for (InlineBox* child = m_svgRootInlineBox.firstChild(); child; chil
d = child->nextOnLine()) { | 30 for (InlineBox* child = m_svgRootInlineBox.firstChild(); child; chil
d = child->nextOnLine()) { |
| 31 if (child->isSVGInlineTextBox()) | 31 if (child->isSVGInlineTextBox()) |
| 32 SVGInlineTextBoxPainter(*toSVGInlineTextBox(child)).paintSel
ectionBackground(paintInfoBeforeFiltering); | 32 SVGInlineTextBoxPainter(*toSVGInlineTextBox(child)).paintSel
ectionBackground(paintInfoBeforeFiltering); |
| 33 else if (child->isSVGInlineFlowBox()) | 33 else if (child->isSVGInlineFlowBox()) |
| 34 SVGInlineFlowBoxPainter(*toSVGInlineFlowBox(child)).paintSel
ectionBackground(paintInfoBeforeFiltering); | 34 SVGInlineFlowBoxPainter(*toSVGInlineFlowBox(child)).paintSel
ectionBackground(paintInfoBeforeFiltering); |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 | 38 |
| 39 SVGPaintContext paintContext(m_svgRootInlineBox.renderer(), paintInfoBeforeF
iltering); | 39 SVGPaintContext paintContext(m_svgRootInlineBox.layoutObject(), paintInfoBef
oreFiltering); |
| 40 if (paintContext.applyClipMaskAndFilterIfNecessary()) { | 40 if (paintContext.applyClipMaskAndFilterIfNecessary()) { |
| 41 for (InlineBox* child = m_svgRootInlineBox.firstChild(); child; child =
child->nextOnLine()) | 41 for (InlineBox* child = m_svgRootInlineBox.firstChild(); child; child =
child->nextOnLine()) |
| 42 child->paint(paintContext.paintInfo(), paintOffset, 0, 0); | 42 child->paint(paintContext.paintInfo(), paintOffset, 0, 0); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 } // namespace blink | 46 } // namespace blink |
| OLD | NEW |