| 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/SVGLayoutSupport.h" | 8 #include "core/layout/svg/SVGLayoutSupport.h" |
| 9 #include "core/paint/BoxPainter.h" | 9 #include "core/paint/BoxPainter.h" |
| 10 #include "core/paint/ObjectPaintProperties.h" | 10 #include "core/paint/ObjectPaintProperties.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 if (shouldPaintSelfOutline(paintInfo.phase)) | 32 if (shouldPaintSelfOutline(paintInfo.phase)) |
| 33 return; | 33 return; |
| 34 | 34 |
| 35 // An empty viewBox also disables rendering. | 35 // An empty viewBox also disables rendering. |
| 36 // (http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute) | 36 // (http://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute) |
| 37 SVGSVGElement* svg = toSVGSVGElement(m_layoutSVGRoot.node()); | 37 SVGSVGElement* svg = toSVGSVGElement(m_layoutSVGRoot.node()); |
| 38 ASSERT(svg); | 38 ASSERT(svg); |
| 39 if (svg->hasEmptyViewBox()) | 39 if (svg->hasEmptyViewBox()) |
| 40 return; | 40 return; |
| 41 | 41 |
| 42 // Don't paint if we don't have kids, except if we have filters we should pa
int those. | |
| 43 if (!m_layoutSVGRoot.firstChild() && !SVGLayoutSupport::hasFilterResource(m_
layoutSVGRoot)) | |
| 44 return; | |
| 45 | |
| 46 PaintInfo paintInfoBeforeFiltering(paintInfo); | 42 PaintInfo paintInfoBeforeFiltering(paintInfo); |
| 47 | 43 |
| 48 Optional<ScopedPaintChunkProperties> transformPropertyScope; | 44 Optional<ScopedPaintChunkProperties> transformPropertyScope; |
| 49 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 45 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 50 const auto* objectProperties = m_layoutSVGRoot.objectPaintProperties(); | 46 const auto* objectProperties = m_layoutSVGRoot.objectPaintProperties(); |
| 51 if (objectProperties && objectProperties->svgLocalTransform()) { | 47 if (objectProperties && objectProperties->svgLocalTransform()) { |
| 52 auto& paintController = paintInfoBeforeFiltering.context.getPaintCon
troller(); | 48 auto& paintController = paintInfoBeforeFiltering.context.getPaintCon
troller(); |
| 53 PaintChunkProperties properties(paintController.currentPaintChunkPro
perties()); | 49 PaintChunkProperties properties(paintController.currentPaintChunkPro
perties()); |
| 54 properties.transform = objectProperties->svgLocalTransform(); | 50 properties.transform = objectProperties->svgLocalTransform(); |
| 55 transformPropertyScope.emplace(paintController, properties); | 51 transformPropertyScope.emplace(paintController, properties); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 if (paintContext.paintInfo().phase == PaintPhaseForeground && !paintContext.
applyClipMaskAndFilterIfNecessary()) | 86 if (paintContext.paintInfo().phase == PaintPhaseForeground && !paintContext.
applyClipMaskAndFilterIfNecessary()) |
| 91 return; | 87 return; |
| 92 | 88 |
| 93 BoxPainter(m_layoutSVGRoot).paint(paintContext.paintInfo(), LayoutPoint()); | 89 BoxPainter(m_layoutSVGRoot).paint(paintContext.paintInfo(), LayoutPoint()); |
| 94 | 90 |
| 95 PaintTiming& timing = PaintTiming::from(m_layoutSVGRoot.node()->document().t
opDocument()); | 91 PaintTiming& timing = PaintTiming::from(m_layoutSVGRoot.node()->document().t
opDocument()); |
| 96 timing.markFirstContentfulPaint(); | 92 timing.markFirstContentfulPaint(); |
| 97 } | 93 } |
| 98 | 94 |
| 99 } // namespace blink | 95 } // namespace blink |
| OLD | NEW |