| 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> propertyScope; | 44 Optional<ScopedPaintChunkProperties> propertyScope; |
| 49 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 45 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 50 const auto* objectProperties = m_layoutSVGRoot.objectPaintProperties(); | 46 const auto* objectProperties = m_layoutSVGRoot.objectPaintProperties(); |
| 51 // If a transform exists, we can rely on a paint layer existing to apply
it. | 47 // If a transform exists, we can rely on a paint layer existing to apply
it. |
| 52 DCHECK(!objectProperties || !objectProperties->transform() || m_layoutSV
GRoot.hasLayer()); | 48 DCHECK(!objectProperties || !objectProperties->transform() || m_layoutSV
GRoot.hasLayer()); |
| 53 if (objectProperties && objectProperties->svgLocalToBorderBoxTransform()
) { | 49 if (objectProperties && objectProperties->svgLocalToBorderBoxTransform()
) { |
| 54 auto& paintController = paintInfoBeforeFiltering.context.getPaintCon
troller(); | 50 auto& paintController = paintInfoBeforeFiltering.context.getPaintCon
troller(); |
| 55 PaintChunkProperties properties(paintController.currentPaintChunkPro
perties()); | 51 PaintChunkProperties properties(paintController.currentPaintChunkPro
perties()); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 82 if (paintContext.paintInfo().phase == PaintPhaseForeground && !paintContext.
applyClipMaskAndFilterIfNecessary()) | 78 if (paintContext.paintInfo().phase == PaintPhaseForeground && !paintContext.
applyClipMaskAndFilterIfNecessary()) |
| 83 return; | 79 return; |
| 84 | 80 |
| 85 BoxPainter(m_layoutSVGRoot).paint(paintContext.paintInfo(), LayoutPoint()); | 81 BoxPainter(m_layoutSVGRoot).paint(paintContext.paintInfo(), LayoutPoint()); |
| 86 | 82 |
| 87 PaintTiming& timing = PaintTiming::from(m_layoutSVGRoot.node()->document().t
opDocument()); | 83 PaintTiming& timing = PaintTiming::from(m_layoutSVGRoot.node()->document().t
opDocument()); |
| 88 timing.markFirstContentfulPaint(); | 84 timing.markFirstContentfulPaint(); |
| 89 } | 85 } |
| 90 | 86 |
| 91 } // namespace blink | 87 } // namespace blink |
| OLD | NEW |