| 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/LayoutObjectDrawingRecorder.h" |
| 11 #include "core/paint/PaintInfo.h" | 12 #include "core/paint/PaintInfo.h" |
| 12 #include "core/paint/SVGPaintContext.h" | 13 #include "core/paint/SVGPaintContext.h" |
| 13 #include "core/paint/TransformRecorder.h" | 14 #include "core/paint/TransformRecorder.h" |
| 14 #include "core/svg/SVGSVGElement.h" | 15 #include "core/svg/SVGSVGElement.h" |
| 15 #include "platform/graphics/paint/ClipRecorder.h" | 16 #include "platform/graphics/paint/ClipRecorder.h" |
| 16 #include "wtf/Optional.h" | 17 #include "wtf/Optional.h" |
| 17 | 18 |
| 18 namespace blink { | 19 namespace blink { |
| 19 | 20 |
| 20 void SVGRootPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintO
ffset) | 21 void SVGRootPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintO
ffset) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 36 | 37 |
| 37 // Don't paint if we don't have kids, except if we have filters we should pa
int those. | 38 // Don't paint if we don't have kids, except if we have filters we should pa
int those. |
| 38 if (!m_layoutSVGRoot.firstChild()) { | 39 if (!m_layoutSVGRoot.firstChild()) { |
| 39 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObj
ect(&m_layoutSVGRoot); | 40 SVGResources* resources = SVGResourcesCache::cachedResourcesForLayoutObj
ect(&m_layoutSVGRoot); |
| 40 if (!resources || !resources->filter()) | 41 if (!resources || !resources->filter()) |
| 41 return; | 42 return; |
| 42 } | 43 } |
| 43 | 44 |
| 44 PaintInfo paintInfoBeforeFiltering(paintInfo); | 45 PaintInfo paintInfoBeforeFiltering(paintInfo); |
| 45 | 46 |
| 47 Optional<ScopedPaintChunkProperties> propertyScope; |
| 48 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) |
| 49 LayoutObjectDrawingRecorder::updatePropertyScope(propertyScope, paintInf
oBeforeFiltering.context, m_layoutSVGRoot); |
| 50 |
| 46 // Apply initial viewport clip. | 51 // Apply initial viewport clip. |
| 47 Optional<ClipRecorder> clipRecorder; | 52 Optional<ClipRecorder> clipRecorder; |
| 48 if (m_layoutSVGRoot.shouldApplyViewportClip()) { | 53 if (m_layoutSVGRoot.shouldApplyViewportClip()) { |
| 49 // TODO(pdr): Clip the paint info cull rect here. | 54 // TODO(pdr): Clip the paint info cull rect here. |
| 50 clipRecorder.emplace(paintInfoBeforeFiltering.context, m_layoutSVGRoot,
paintInfoBeforeFiltering.displayItemTypeForClipping(), LayoutRect(pixelSnappedIn
tRect(m_layoutSVGRoot.overflowClipRect(paintOffset)))); | 55 clipRecorder.emplace(paintInfoBeforeFiltering.context, m_layoutSVGRoot,
paintInfoBeforeFiltering.displayItemTypeForClipping(), LayoutRect(pixelSnappedIn
tRect(m_layoutSVGRoot.overflowClipRect(paintOffset)))); |
| 51 } | 56 } |
| 52 | 57 |
| 53 // Convert from container offsets (html layoutObjects) to a relative transfo
rm (svg layoutObjects). | 58 // Convert from container offsets (html layoutObjects) to a relative transfo
rm (svg layoutObjects). |
| 54 // Transform from our paint container's coordinate system to our local coord
s. | 59 // Transform from our paint container's coordinate system to our local coord
s. |
| 55 IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset); | 60 IntPoint adjustedPaintOffset = roundedIntPoint(paintOffset); |
| 56 AffineTransform paintOffsetToBorderBox = AffineTransform::translation(adjust
edPaintOffset.x(), adjustedPaintOffset.y()) * m_layoutSVGRoot.localToBorderBoxTr
ansform(); | 61 AffineTransform paintOffsetToBorderBox = AffineTransform::translation(adjust
edPaintOffset.x(), adjustedPaintOffset.y()) * m_layoutSVGRoot.localToBorderBoxTr
ansform(); |
| 57 paintInfoBeforeFiltering.updateCullRect(paintOffsetToBorderBox); | 62 paintInfoBeforeFiltering.updateCullRect(paintOffsetToBorderBox); |
| 58 TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layo
utSVGRoot, paintOffsetToBorderBox); | 63 TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layo
utSVGRoot, paintOffsetToBorderBox); |
| 59 | 64 |
| 60 SVGPaintContext paintContext(m_layoutSVGRoot, paintInfoBeforeFiltering); | 65 SVGPaintContext paintContext(m_layoutSVGRoot, paintInfoBeforeFiltering); |
| 61 if (paintContext.paintInfo().phase == PaintPhaseForeground && !paintContext.
applyClipMaskAndFilterIfNecessary()) | 66 if (paintContext.paintInfo().phase == PaintPhaseForeground && !paintContext.
applyClipMaskAndFilterIfNecessary()) |
| 62 return; | 67 return; |
| 63 | 68 |
| 64 BoxPainter(m_layoutSVGRoot).paint(paintContext.paintInfo(), LayoutPoint()); | 69 BoxPainter(m_layoutSVGRoot).paint(paintContext.paintInfo(), LayoutPoint()); |
| 65 } | 70 } |
| 66 | 71 |
| 67 } // namespace blink | 72 } // namespace blink |
| OLD | NEW |