| 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" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 // Don't paint if we don't have kids, except if we have filters we should pa
int those. | 43 // Don't paint if we don't have kids, except if we have filters we should pa
int those. |
| 44 if (!m_layoutSVGRoot.firstChild()) { | 44 if (!m_layoutSVGRoot.firstChild()) { |
| 45 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObj
ect(&m_layoutSVGRoot); | 45 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObj
ect(&m_layoutSVGRoot); |
| 46 if (!resources || !resources->filter()) | 46 if (!resources || !resources->filter()) |
| 47 return; | 47 return; |
| 48 } | 48 } |
| 49 | 49 |
| 50 PaintInfo paintInfoBeforeFiltering(paintInfo); | 50 PaintInfo paintInfoBeforeFiltering(paintInfo); |
| 51 | 51 |
| 52 // At the HTML->SVG boundary, SVGRoot will have a paint offset transform | 52 Optional<ScopedPaintChunkProperties> transformPropertyScope; |
| 53 // paint property but may not have a PaintLayer, so we need to update the | 53 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 54 // paint properties here since they will not be updated by PaintLayer | |
| 55 // (See: PaintPropertyTreeBuilder::createPaintOffsetTranslationIfNeeded). | |
| 56 Optional<ScopedPaintChunkProperties> paintOffsetTranslationPropertyScope; | |
| 57 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && !m_layoutSVGRoot.has
Layer()) { | |
| 58 const auto* objectProperties = m_layoutSVGRoot.objectPaintProperties(); | 54 const auto* objectProperties = m_layoutSVGRoot.objectPaintProperties(); |
| 59 if (objectProperties && objectProperties->paintOffsetTranslation()) { | 55 if (objectProperties && objectProperties->svgLocalTransform()) { |
| 56 auto& paintController = paintInfoBeforeFiltering.context.getPaintCon
troller(); |
| 57 PaintChunkProperties properties(paintController.currentPaintChunkPro
perties()); |
| 58 properties.transform = objectProperties->svgLocalTransform(); |
| 59 transformPropertyScope.emplace(paintController, properties); |
| 60 } else if (objectProperties && objectProperties->paintOffsetTranslation(
) && !m_layoutSVGRoot.hasLayer()) { |
| 61 // TODO(pdr): Always create an svgLocalTransform and remove this pai
nt offset quirk. |
| 62 // At the HTML->SVG boundary, SVGRoot will have a paint offset trans
form |
| 63 // paint property but may not have a PaintLayer, so we need to updat
e the |
| 64 // paint properties here since they will not be updated by PaintLaye
r |
| 65 // (See: PaintPropertyTreeBuilder::createPaintOffsetTranslationIfNee
ded). |
| 60 auto& paintController = paintInfoBeforeFiltering.context.getPaintCon
troller(); | 66 auto& paintController = paintInfoBeforeFiltering.context.getPaintCon
troller(); |
| 61 PaintChunkProperties properties(paintController.currentPaintChunkPro
perties()); | 67 PaintChunkProperties properties(paintController.currentPaintChunkPro
perties()); |
| 62 properties.transform = objectProperties->paintOffsetTranslation(); | 68 properties.transform = objectProperties->paintOffsetTranslation(); |
| 63 paintOffsetTranslationPropertyScope.emplace(paintController, propert
ies); | 69 transformPropertyScope.emplace(paintController, properties); |
| 64 } | 70 } |
| 65 } | 71 } |
| 66 | 72 |
| 67 // Apply initial viewport clip. | 73 // Apply initial viewport clip. |
| 68 Optional<ClipRecorder> clipRecorder; | 74 Optional<ClipRecorder> clipRecorder; |
| 69 if (m_layoutSVGRoot.shouldApplyViewportClip()) { | 75 if (m_layoutSVGRoot.shouldApplyViewportClip()) { |
| 70 // TODO(pdr): Clip the paint info cull rect here. | 76 // TODO(pdr): Clip the paint info cull rect here. |
| 71 clipRecorder.emplace(paintInfoBeforeFiltering.context, m_layoutSVGRoot,
paintInfoBeforeFiltering.displayItemTypeForClipping(), LayoutRect(pixelSnappedIn
tRect(m_layoutSVGRoot.overflowClipRect(paintOffset)))); | 77 clipRecorder.emplace(paintInfoBeforeFiltering.context, m_layoutSVGRoot,
paintInfoBeforeFiltering.displayItemTypeForClipping(), LayoutRect(pixelSnappedIn
tRect(m_layoutSVGRoot.overflowClipRect(paintOffset)))); |
| 72 } | 78 } |
| 73 | 79 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 88 if (paintContext.paintInfo().phase == PaintPhaseForeground && !paintContext.
applyClipMaskAndFilterIfNecessary()) | 94 if (paintContext.paintInfo().phase == PaintPhaseForeground && !paintContext.
applyClipMaskAndFilterIfNecessary()) |
| 89 return; | 95 return; |
| 90 | 96 |
| 91 BoxPainter(m_layoutSVGRoot).paint(paintContext.paintInfo(), LayoutPoint()); | 97 BoxPainter(m_layoutSVGRoot).paint(paintContext.paintInfo(), LayoutPoint()); |
| 92 | 98 |
| 93 PaintTiming& timing = PaintTiming::from(m_layoutSVGRoot.node()->document().t
opDocument()); | 99 PaintTiming& timing = PaintTiming::from(m_layoutSVGRoot.node()->document().t
opDocument()); |
| 94 timing.markFirstContentfulPaint(); | 100 timing.markFirstContentfulPaint(); |
| 95 } | 101 } |
| 96 | 102 |
| 97 } // namespace blink | 103 } // namespace blink |
| OLD | NEW |