Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Side by Side Diff: third_party/WebKit/Source/core/paint/SVGRootPainter.cpp

Issue 1865093004: Add a transform paint property for local SVG transforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dcheck that SVG does not scroll and describe it in a comment Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreePrinter.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreePrinter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698