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

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

Issue 701433002: Lazily allocate svg shape transforms, shrink RenderSVGShape by 44B (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2008 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005, 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2005, 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Google, Inc. 5 * Copyright (C) 2009 Google, Inc.
6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 6 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
7 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
8 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com> 8 * Copyright (C) 2009 Jeff Schiller <codedread@gmail.com>
9 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> 9 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org>
10 * Copyright (C) 2011 University of Szeged 10 * Copyright (C) 2011 University of Szeged
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 if (m_needsShapeUpdate || m_needsBoundariesUpdate) { 117 if (m_needsShapeUpdate || m_needsBoundariesUpdate) {
118 updateShapeFromElement(); 118 updateShapeFromElement();
119 m_needsShapeUpdate = false; 119 m_needsShapeUpdate = false;
120 updatePaintInvalidationBoundingBox(); 120 updatePaintInvalidationBoundingBox();
121 m_needsBoundariesUpdate = false; 121 m_needsBoundariesUpdate = false;
122 updateCachedBoundariesInParents = true; 122 updateCachedBoundariesInParents = true;
123 } 123 }
124 124
125 if (m_needsTransformUpdate) { 125 if (m_needsTransformUpdate) {
126 m_localTransform = toSVGGraphicsElement(element())->calculateAnimatedLo calTransform(); 126 SVGGraphicsElement* graphicsElement = toSVGGraphicsElement(element());
127 m_localTransform = graphicsElement->hasAnimatedLocalTransform() ? adoptP tr(new AffineTransform(graphicsElement->calculateAnimatedLocalTransform())) : 0;
fs 2014/11/05 13:46:47 It'd be nice to not reallocate the transform for e
f(malita) 2014/11/06 22:16:15 +1 for avoiding unnecessary reallocations. Even if
pdr. 2014/11/07 04:20:27 Agreed and done :)
127 m_needsTransformUpdate = false; 128 m_needsTransformUpdate = false;
128 updateCachedBoundariesInParents = true; 129 updateCachedBoundariesInParents = true;
129 } 130 }
130 131
131 // Invalidate all resources of this client if our layout changed. 132 // Invalidate all resources of this client if our layout changed.
132 if (everHadLayout() && selfNeedsLayout()) 133 if (everHadLayout() && selfNeedsLayout())
133 SVGResourcesCache::clientLayoutChanged(this); 134 SVGResourcesCache::clientLayoutChanged(this);
134 135
135 // If our bounds changed, notify the parents. 136 // If our bounds changed, notify the parents.
136 if (updateCachedBoundariesInParents) 137 if (updateCachedBoundariesInParents)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 rects.append(rect); 169 rects.append(rect);
169 } 170 }
170 171
171 bool RenderSVGShape::nodeAtFloatPoint(const HitTestRequest& request, HitTestResu lt& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) 172 bool RenderSVGShape::nodeAtFloatPoint(const HitTestRequest& request, HitTestResu lt& result, const FloatPoint& pointInParent, HitTestAction hitTestAction)
172 { 173 {
173 // We only draw in the foreground phase, so we only hit-test then. 174 // We only draw in the foreground phase, so we only hit-test then.
174 if (hitTestAction != HitTestForeground) 175 if (hitTestAction != HitTestForeground)
175 return false; 176 return false;
176 177
177 FloatPoint localPoint; 178 FloatPoint localPoint;
178 if (!SVGRenderSupport::transformToUserSpaceAndCheckClipping(this, m_localTra nsform, pointInParent, localPoint)) 179 if (!SVGRenderSupport::transformToUserSpaceAndCheckClipping(this, localToPar entTransform(), pointInParent, localPoint))
179 return false; 180 return false;
180 181
181 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_GEOMETRY_HITTESTIN G, request, style()->pointerEvents()); 182 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_GEOMETRY_HITTESTIN G, request, style()->pointerEvents());
182 if (nodeAtFloatPointInternal(request, localPoint, hitRules)) { 183 if (nodeAtFloatPointInternal(request, localPoint, hitRules)) {
183 updateHitTestResult(result, roundedLayoutPoint(localPoint)); 184 updateHitTestResult(result, roundedLayoutPoint(localPoint));
184 return true; 185 return true;
185 } 186 }
186 187
187 return false; 188 return false;
188 } 189 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 bool RenderSVGShape::hasSmoothStroke() const 250 bool RenderSVGShape::hasSmoothStroke() const
250 { 251 {
251 const SVGRenderStyle& svgStyle = style()->svgStyle(); 252 const SVGRenderStyle& svgStyle = style()->svgStyle();
252 return svgStyle.strokeDashArray()->isEmpty() 253 return svgStyle.strokeDashArray()->isEmpty()
253 && svgStyle.strokeMiterLimit() == SVGRenderStyle::initialStrokeMiterLimi t() 254 && svgStyle.strokeMiterLimit() == SVGRenderStyle::initialStrokeMiterLimi t()
254 && svgStyle.joinStyle() == SVGRenderStyle::initialJoinStyle() 255 && svgStyle.joinStyle() == SVGRenderStyle::initialJoinStyle()
255 && svgStyle.capStyle() == SVGRenderStyle::initialCapStyle(); 256 && svgStyle.capStyle() == SVGRenderStyle::initialCapStyle();
256 } 257 }
257 258
258 } 259 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698