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

Side by Side Diff: Source/core/rendering/svg/RenderSVGResourceGradient.cpp

Issue 652243002: Hoist paint-server transform adaption out of preparePaintServer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 3 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 4 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org>
5 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 5 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 27 matching lines...) Expand all
38 markAllClientsForInvalidation(markForInvalidation ? PaintInvalidation : Pare ntOnlyInvalidation); 38 markAllClientsForInvalidation(markForInvalidation ? PaintInvalidation : Pare ntOnlyInvalidation);
39 } 39 }
40 40
41 void RenderSVGResourceGradient::removeClientFromCache(RenderObject* client, bool markForInvalidation) 41 void RenderSVGResourceGradient::removeClientFromCache(RenderObject* client, bool markForInvalidation)
42 { 42 {
43 ASSERT(client); 43 ASSERT(client);
44 m_gradientMap.remove(client); 44 m_gradientMap.remove(client);
45 markClientForInvalidation(client, markForInvalidation ? PaintInvalidation : ParentOnlyInvalidation); 45 markClientForInvalidation(client, markForInvalidation ? PaintInvalidation : ParentOnlyInvalidation);
46 } 46 }
47 47
48 SVGPaintServer RenderSVGResourceGradient::preparePaintServer(RenderObject* objec t, RenderStyle* style, RenderSVGResourceModeFlags resourceMode) 48 SVGPaintServer RenderSVGResourceGradient::preparePaintServer(RenderObject* objec t)
49 { 49 {
50 ASSERT(object); 50 ASSERT(object);
51 ASSERT(style);
52 51
53 clearInvalidationMask(); 52 clearInvalidationMask();
54 53
55 // Be sure to synchronize all SVG properties on the gradientElement _before_ processing any further. 54 // Be sure to synchronize all SVG properties on the gradientElement _before_ processing any further.
56 // Otherwhise the call to collectGradientAttributes() in createTileImage(), may cause the SVG DOM property 55 // Otherwhise the call to collectGradientAttributes() in createTileImage(), may cause the SVG DOM property
57 // synchronization to kick in, which causes removeAllClientsFromCache() to b e called, which in turn deletes our 56 // synchronization to kick in, which causes removeAllClientsFromCache() to b e called, which in turn deletes our
58 // GradientData object! Leaving out the line below will cause svg/dynamic-up dates/SVG*GradientElement-svgdom* to crash. 57 // GradientData object! Leaving out the line below will cause svg/dynamic-up dates/SVG*GradientElement-svgdom* to crash.
59 SVGGradientElement* gradientElement = toSVGGradientElement(element()); 58 SVGGradientElement* gradientElement = toSVGGradientElement(element());
60 if (!gradientElement) 59 if (!gradientElement)
61 return SVGPaintServer::invalid(); 60 return SVGPaintServer::invalid();
(...skipping 28 matching lines...) Expand all
90 89
91 AffineTransform gradientTransform; 90 AffineTransform gradientTransform;
92 calculateGradientTransform(gradientTransform); 91 calculateGradientTransform(gradientTransform);
93 92
94 gradientData->userspaceTransform *= gradientTransform; 93 gradientData->userspaceTransform *= gradientTransform;
95 } 94 }
96 95
97 if (!gradientData->gradient) 96 if (!gradientData->gradient)
98 return SVGPaintServer::invalid(); 97 return SVGPaintServer::invalid();
99 98
100 const SVGRenderStyle& svgStyle = style->svgStyle(); 99 gradientData->gradient->setGradientSpaceTransform(gradientData->userspaceTra nsform);
101
102 AffineTransform computedGradientSpaceTransform = computeResourceSpaceTransfo rm(object, gradientData->userspaceTransform, svgStyle, resourceMode);
103 gradientData->gradient->setGradientSpaceTransform(computedGradientSpaceTrans form);
104 100
105 return SVGPaintServer(gradientData->gradient); 101 return SVGPaintServer(gradientData->gradient);
106 } 102 }
107 103
108 bool RenderSVGResourceGradient::isChildAllowed(RenderObject* child, RenderStyle* ) const 104 bool RenderSVGResourceGradient::isChildAllowed(RenderObject* child, RenderStyle* ) const
109 { 105 {
110 if (child->isSVGGradientStop()) 106 if (child->isSVGGradientStop())
111 return true; 107 return true;
112 108
113 if (!child->isSVGResourceContainer()) 109 if (!child->isSVGResourceContainer())
(...skipping 24 matching lines...) Expand all
138 return SpreadMethodReflect; 134 return SpreadMethodReflect;
139 case SVGSpreadMethodRepeat: 135 case SVGSpreadMethodRepeat:
140 return SpreadMethodRepeat; 136 return SpreadMethodRepeat;
141 } 137 }
142 138
143 ASSERT_NOT_REACHED(); 139 ASSERT_NOT_REACHED();
144 return SpreadMethodPad; 140 return SpreadMethodPad;
145 } 141 }
146 142
147 } 143 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698