| 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 "core/paint/SVGRootPainter.h" | 5 #include "core/paint/SVGRootPainter.h" |
| 6 | 6 |
| 7 #include "core/layout/svg/LayoutSVGRoot.h" | 7 #include "core/layout/svg/LayoutSVGRoot.h" |
| 8 #include "core/layout/svg/SVGResources.h" | 8 #include "core/layout/svg/SVGResources.h" |
| 9 #include "core/layout/svg/SVGResourcesCache.h" | 9 #include "core/layout/svg/SVGResourcesCache.h" |
| 10 #include "core/paint/BoxPainter.h" | 10 #include "core/paint/BoxPainter.h" |
| 11 #include "core/paint/PaintInfo.h" | 11 #include "core/paint/PaintInfo.h" |
| 12 #include "core/paint/SVGPaintContext.h" | 12 #include "core/paint/SVGPaintContext.h" |
| 13 #include "core/paint/TransformRecorder.h" | 13 #include "core/paint/TransformRecorder.h" |
| 14 #include "core/svg/SVGSVGElement.h" | 14 #include "core/svg/SVGSVGElement.h" |
| 15 #include "platform/graphics/paint/ClipRecorder.h" | 15 #include "platform/graphics/paint/ClipRecorder.h" |
| 16 #include "wtf/Optional.h" | 16 #include "wtf/Optional.h" |
| 17 | 17 |
| 18 namespace blink { | 18 namespace blink { |
| 19 | 19 |
| 20 void SVGRootPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintO
ffset) | 20 void SVGRootPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintO
ffset) |
| 21 { | 21 { |
| 22 // An empty viewport disables rendering. | 22 // An empty viewport disables rendering. |
| 23 if (m_layoutSVGRoot.pixelSnappedBorderBoxRect().isEmpty()) | 23 if (m_layoutSVGRoot.pixelSnappedBorderBoxRect().isEmpty()) |
| 24 return; | 24 return; |
| 25 | 25 |
| 26 // SVG outlines are painted during PaintPhaseForeground. | 26 // SVG outlines are painted during PaintPhaseForeground. |
| 27 if (paintInfo.phase == PaintPhaseOutline || paintInfo.phase == PaintPhaseSel
fOutline) | 27 if (shouldPaintSelfOutline(paintInfo.phase)) |
| 28 return; | 28 return; |
| 29 | 29 |
| 30 // An empty viewBox also disables rendering. | 30 // An empty viewBox also disables rendering. |
| 31 // (http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute) | 31 // (http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute) |
| 32 SVGSVGElement* svg = toSVGSVGElement(m_layoutSVGRoot.node()); | 32 SVGSVGElement* svg = toSVGSVGElement(m_layoutSVGRoot.node()); |
| 33 ASSERT(svg); | 33 ASSERT(svg); |
| 34 if (svg->hasEmptyViewBox()) | 34 if (svg->hasEmptyViewBox()) |
| 35 return; | 35 return; |
| 36 | 36 |
| 37 // Don't paint if we don't have kids, except if we have filters we should pa
int those. | 37 // Don't paint if we don't have kids, except if we have filters we should pa
int those. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 58 TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layo
utSVGRoot, paintOffsetToBorderBox); | 58 TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layo
utSVGRoot, paintOffsetToBorderBox); |
| 59 | 59 |
| 60 SVGPaintContext paintContext(m_layoutSVGRoot, paintInfoBeforeFiltering); | 60 SVGPaintContext paintContext(m_layoutSVGRoot, paintInfoBeforeFiltering); |
| 61 if (paintContext.paintInfo().phase == PaintPhaseForeground && !paintContext.
applyClipMaskAndFilterIfNecessary()) | 61 if (paintContext.paintInfo().phase == PaintPhaseForeground && !paintContext.
applyClipMaskAndFilterIfNecessary()) |
| 62 return; | 62 return; |
| 63 | 63 |
| 64 BoxPainter(m_layoutSVGRoot).paint(paintContext.paintInfo(), LayoutPoint()); | 64 BoxPainter(m_layoutSVGRoot).paint(paintContext.paintInfo(), LayoutPoint()); |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace blink | 67 } // namespace blink |
| OLD | NEW |