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

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

Issue 2059433002: Use transform paint property nodes in SVG [spv2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@svgTransformProps2
Patch Set: Post-blinkon rebase, add some dchecks, add some fixmes Created 4 years, 6 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
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/SVGContainerPainter.h" 5 #include "core/paint/SVGContainerPainter.h"
6 6
7 #include "core/layout/svg/LayoutSVGContainer.h" 7 #include "core/layout/svg/LayoutSVGContainer.h"
8 #include "core/layout/svg/LayoutSVGViewportContainer.h" 8 #include "core/layout/svg/LayoutSVGViewportContainer.h"
9 #include "core/layout/svg/SVGLayoutSupport.h" 9 #include "core/layout/svg/SVGLayoutSupport.h"
10 #include "core/paint/FloatClipRecorder.h" 10 #include "core/paint/FloatClipRecorder.h"
11 #include "core/paint/ObjectPainter.h" 11 #include "core/paint/ObjectPainter.h"
12 #include "core/paint/PaintInfo.h" 12 #include "core/paint/PaintInfo.h"
13 #include "core/paint/SVGPaintContext.h" 13 #include "core/paint/SVGPaintContext.h"
14 #include "core/paint/TransformRecorder.h"
15 #include "core/svg/SVGSVGElement.h" 14 #include "core/svg/SVGSVGElement.h"
16 #include "wtf/Optional.h" 15 #include "wtf/Optional.h"
17 16
18 namespace blink { 17 namespace blink {
19 18
20 void SVGContainerPainter::paint(const PaintInfo& paintInfo) 19 void SVGContainerPainter::paint(const PaintInfo& paintInfo)
21 { 20 {
22 // Spec: groups w/o children still may render filter content. 21 // Spec: groups w/o children still may render filter content.
23 if (!m_layoutSVGContainer.firstChild() && !m_layoutSVGContainer.selfWillPain t()) 22 if (!m_layoutSVGContainer.firstChild() && !m_layoutSVGContainer.selfWillPain t())
24 return; 23 return;
25 24
26 FloatRect boundingBox = m_layoutSVGContainer.paintInvalidationRectInLocalSVG Coordinates(); 25 FloatRect boundingBox = m_layoutSVGContainer.paintInvalidationRectInLocalSVG Coordinates();
27 // LayoutSVGHiddenContainer's paint invalidation rect is always empty but we need to paint its descendants. 26 // LayoutSVGHiddenContainer's paint invalidation rect is always empty but we need to paint its descendants.
28 if (!m_layoutSVGContainer.isSVGHiddenContainer() 27 if (!m_layoutSVGContainer.isSVGHiddenContainer()
29 && !paintInfo.cullRect().intersectsCullRect(m_layoutSVGContainer.localTo SVGParentTransform(), boundingBox)) 28 && !paintInfo.cullRect().intersectsCullRect(m_layoutSVGContainer.localTo SVGParentTransform(), boundingBox))
30 return; 29 return;
31 30
32 // Spec: An empty viewBox on the <svg> element disables rendering. 31 // Spec: An empty viewBox on the <svg> element disables rendering.
33 ASSERT(m_layoutSVGContainer.element()); 32 ASSERT(m_layoutSVGContainer.element());
34 if (isSVGSVGElement(*m_layoutSVGContainer.element()) && toSVGSVGElement(*m_l ayoutSVGContainer.element()).hasEmptyViewBox()) 33 if (isSVGSVGElement(*m_layoutSVGContainer.element()) && toSVGSVGElement(*m_l ayoutSVGContainer.element()).hasEmptyViewBox())
35 return; 34 return;
36 35
37 PaintInfo paintInfoBeforeFiltering(paintInfo); 36 PaintInfo paintInfoBeforeFiltering(paintInfo);
38 paintInfoBeforeFiltering.updateCullRect(m_layoutSVGContainer.localToSVGParen tTransform()); 37 paintInfoBeforeFiltering.updateCullRect(m_layoutSVGContainer.localToSVGParen tTransform());
39 TransformRecorder transformRecorder(paintInfoBeforeFiltering.context, m_layo utSVGContainer, m_layoutSVGContainer.localToSVGParentTransform()); 38 SVGTransformContext transformContext(paintInfoBeforeFiltering.context, m_lay outSVGContainer, m_layoutSVGContainer.localToSVGParentTransform());
40 { 39 {
41 Optional<FloatClipRecorder> clipRecorder; 40 Optional<FloatClipRecorder> clipRecorder;
42 if (m_layoutSVGContainer.isSVGViewportContainer() && SVGLayoutSupport::i sOverflowHidden(&m_layoutSVGContainer)) { 41 if (m_layoutSVGContainer.isSVGViewportContainer() && SVGLayoutSupport::i sOverflowHidden(&m_layoutSVGContainer)) {
43 FloatRect viewport = m_layoutSVGContainer.localToSVGParentTransform( ).inverse().mapRect(toLayoutSVGViewportContainer(m_layoutSVGContainer).viewport( )); 42 FloatRect viewport = m_layoutSVGContainer.localToSVGParentTransform( ).inverse().mapRect(toLayoutSVGViewportContainer(m_layoutSVGContainer).viewport( ));
44 clipRecorder.emplace(paintInfoBeforeFiltering.context, m_layoutSVGCo ntainer, paintInfoBeforeFiltering.phase, viewport); 43 clipRecorder.emplace(paintInfoBeforeFiltering.context, m_layoutSVGCo ntainer, paintInfoBeforeFiltering.phase, viewport);
45 } 44 }
46 45
47 SVGPaintContext paintContext(m_layoutSVGContainer, paintInfoBeforeFilter ing); 46 SVGPaintContext paintContext(m_layoutSVGContainer, paintInfoBeforeFilter ing);
48 bool continueRendering = true; 47 bool continueRendering = true;
49 if (paintContext.paintInfo().phase == PaintPhaseForeground) 48 if (paintContext.paintInfo().phase == PaintPhaseForeground)
(...skipping 12 matching lines...) Expand all
62 PaintInfo outlinePaintInfo(paintInfoBeforeFiltering); 61 PaintInfo outlinePaintInfo(paintInfoBeforeFiltering);
63 outlinePaintInfo.phase = PaintPhaseSelfOutlineOnly; 62 outlinePaintInfo.phase = PaintPhaseSelfOutlineOnly;
64 ObjectPainter(m_layoutSVGContainer).paintOutline(outlinePaintInfo, Layou tPoint(boundingBox.location())); 63 ObjectPainter(m_layoutSVGContainer).paintOutline(outlinePaintInfo, Layou tPoint(boundingBox.location()));
65 } 64 }
66 65
67 if (paintInfoBeforeFiltering.isPrinting()) 66 if (paintInfoBeforeFiltering.isPrinting())
68 ObjectPainter(m_layoutSVGContainer).addPDFURLRectIfNeeded(paintInfoBefor eFiltering, LayoutPoint()); 67 ObjectPainter(m_layoutSVGContainer).addPDFURLRectIfNeeded(paintInfoBefor eFiltering, LayoutPoint());
69 } 68 }
70 69
71 } // namespace blink 70 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698