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

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: Address reviewer comments 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 if (graphicsElement->hasAnimatedLocalTransform()) {
pdr. 2014/11/07 04:21:33 I'm not a huge fan of how this looks... do either
f(malita) 2014/11/07 18:23:12 Not necessarily better, but if you want to optimiz
fs 2014/11/10 11:36:43 No greater suggestions here either. You could get
128 if (m_localTransform)
129 *m_localTransform = graphicsElement->calculateAnimatedLocalTrans form();
130 else
131 m_localTransform = adoptPtr(new AffineTransform(graphicsElement- >calculateAnimatedLocalTransform()));
132 } else {
133 m_localTransform = 0;
134 }
135
127 m_needsTransformUpdate = false; 136 m_needsTransformUpdate = false;
128 updateCachedBoundariesInParents = true; 137 updateCachedBoundariesInParents = true;
129 } 138 }
130 139
131 // Invalidate all resources of this client if our layout changed. 140 // Invalidate all resources of this client if our layout changed.
132 if (everHadLayout() && selfNeedsLayout()) 141 if (everHadLayout() && selfNeedsLayout())
133 SVGResourcesCache::clientLayoutChanged(this); 142 SVGResourcesCache::clientLayoutChanged(this);
134 143
135 // If our bounds changed, notify the parents. 144 // If our bounds changed, notify the parents.
136 if (updateCachedBoundariesInParents) 145 if (updateCachedBoundariesInParents)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 rects.append(rect); 177 rects.append(rect);
169 } 178 }
170 179
171 bool RenderSVGShape::nodeAtFloatPoint(const HitTestRequest& request, HitTestResu lt& result, const FloatPoint& pointInParent, HitTestAction hitTestAction) 180 bool RenderSVGShape::nodeAtFloatPoint(const HitTestRequest& request, HitTestResu lt& result, const FloatPoint& pointInParent, HitTestAction hitTestAction)
172 { 181 {
173 // We only draw in the foreground phase, so we only hit-test then. 182 // We only draw in the foreground phase, so we only hit-test then.
174 if (hitTestAction != HitTestForeground) 183 if (hitTestAction != HitTestForeground)
175 return false; 184 return false;
176 185
177 FloatPoint localPoint; 186 FloatPoint localPoint;
178 if (!SVGRenderSupport::transformToUserSpaceAndCheckClipping(this, m_localTra nsform, pointInParent, localPoint)) 187 if (!SVGRenderSupport::transformToUserSpaceAndCheckClipping(this, localToPar entTransform(), pointInParent, localPoint))
179 return false; 188 return false;
180 189
181 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_GEOMETRY_HITTESTIN G, request, style()->pointerEvents()); 190 PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_GEOMETRY_HITTESTIN G, request, style()->pointerEvents());
182 if (nodeAtFloatPointInternal(request, localPoint, hitRules)) { 191 if (nodeAtFloatPointInternal(request, localPoint, hitRules)) {
183 updateHitTestResult(result, roundedLayoutPoint(localPoint)); 192 updateHitTestResult(result, roundedLayoutPoint(localPoint));
184 return true; 193 return true;
185 } 194 }
186 195
187 return false; 196 return false;
188 } 197 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 bool RenderSVGShape::hasSmoothStroke() const 258 bool RenderSVGShape::hasSmoothStroke() const
250 { 259 {
251 const SVGRenderStyle& svgStyle = style()->svgStyle(); 260 const SVGRenderStyle& svgStyle = style()->svgStyle();
252 return svgStyle.strokeDashArray()->isEmpty() 261 return svgStyle.strokeDashArray()->isEmpty()
253 && svgStyle.strokeMiterLimit() == SVGRenderStyle::initialStrokeMiterLimi t() 262 && svgStyle.strokeMiterLimit() == SVGRenderStyle::initialStrokeMiterLimi t()
254 && svgStyle.joinStyle() == SVGRenderStyle::initialJoinStyle() 263 && svgStyle.joinStyle() == SVGRenderStyle::initialJoinStyle()
255 && svgStyle.capStyle() == SVGRenderStyle::initialCapStyle(); 264 && svgStyle.capStyle() == SVGRenderStyle::initialCapStyle();
256 } 265 }
257 266
258 } 267 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698