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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp

Issue 1907333002: Order bounds update correctly for LayoutSVGShape and LayoutSVGImage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Shuffle clientLayoutChanged instead. Created 4 years, 7 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/layout/svg/LayoutSVGShape.h ('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 /* 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 SVGGraphicsElement* graphicsElement = toSVGGraphicsElement(element()); 149 SVGGraphicsElement* graphicsElement = toSVGGraphicsElement(element());
150 if (graphicsElement->hasAnimatedLocalTransform()) { 150 if (graphicsElement->hasAnimatedLocalTransform()) {
151 m_localTransform.setTransform(graphicsElement->calculateAnimatedLocalTra nsform()); 151 m_localTransform.setTransform(graphicsElement->calculateAnimatedLocalTra nsform());
152 } else { 152 } else {
153 m_localTransform = AffineTransform(); 153 m_localTransform = AffineTransform();
154 } 154 }
155 } 155 }
156 156
157 void LayoutSVGShape::layout() 157 void LayoutSVGShape::layout()
158 { 158 {
159 bool updateCachedBoundariesInParents = false;
160 LayoutAnalyzer::Scope analyzer(*this); 159 LayoutAnalyzer::Scope analyzer(*this);
161 160
161 // Invalidate all resources of this client if our layout changed.
162 if (everHadLayout() && selfNeedsLayout())
163 SVGResourcesCache::clientLayoutChanged(this);
164
165 bool updateParentBoundaries = false;
166 // updateShapeFromElement() also updates the object & stroke bounds - which
167 // feeds into the paint invalidation rect - so we need to call it for both
168 // the shape-update and the bounds-update flag, since .
162 if (m_needsShapeUpdate || m_needsBoundariesUpdate) { 169 if (m_needsShapeUpdate || m_needsBoundariesUpdate) {
163 updateShapeFromElement(); 170 updateShapeFromElement();
164 m_needsShapeUpdate = false; 171 m_needsShapeUpdate = false;
165 updatePaintInvalidationBoundingBox(); 172
173 m_paintInvalidationBoundingBox = strokeBoundingBox();
174 SVGLayoutSupport::intersectPaintInvalidationRectWithResources(this, m_pa intInvalidationBoundingBox);
166 m_needsBoundariesUpdate = false; 175 m_needsBoundariesUpdate = false;
167 updateCachedBoundariesInParents = true; 176
177 updateParentBoundaries = true;
168 } 178 }
169 179
170 if (m_needsTransformUpdate) { 180 if (m_needsTransformUpdate) {
171 updateLocalTransform(); 181 updateLocalTransform();
172 m_needsTransformUpdate = false; 182 m_needsTransformUpdate = false;
173 updateCachedBoundariesInParents = true; 183 updateParentBoundaries = true;
174 } 184 }
175 185
176 // Invalidate all resources of this client if our layout changed.
177 if (everHadLayout() && selfNeedsLayout())
178 SVGResourcesCache::clientLayoutChanged(this);
179
180 // If our bounds changed, notify the parents. 186 // If our bounds changed, notify the parents.
181 if (updateCachedBoundariesInParents) 187 if (updateParentBoundaries)
182 LayoutSVGModelObject::setNeedsBoundariesUpdate(); 188 LayoutSVGModelObject::setNeedsBoundariesUpdate();
183 189
190 ASSERT(!m_needsShapeUpdate);
191 ASSERT(!m_needsBoundariesUpdate);
192 ASSERT(!m_needsTransformUpdate);
184 clearNeedsLayout(); 193 clearNeedsLayout();
185 } 194 }
186 195
187 Path* LayoutSVGShape::nonScalingStrokePath(const Path* path, const AffineTransfo rm& strokeTransform) const 196 Path* LayoutSVGShape::nonScalingStrokePath(const Path* path, const AffineTransfo rm& strokeTransform) const
188 { 197 {
189 LayoutSVGShapeRareData& rareData = ensureRareData(); 198 LayoutSVGShapeRareData& rareData = ensureRareData();
190 if (!rareData.m_cachedNonScalingStrokePath.isEmpty() && strokeTransform == r areData.m_cachedNonScalingStrokeTransform) 199 if (!rareData.m_cachedNonScalingStrokePath.isEmpty() && strokeTransform == r areData.m_cachedNonScalingStrokeTransform)
191 return &rareData.m_cachedNonScalingStrokePath; 200 return &rareData.m_cachedNonScalingStrokePath;
192 201
193 rareData.m_cachedNonScalingStrokePath = *path; 202 rareData.m_cachedNonScalingStrokePath = *path;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 strokeBoundingBox.unite(strokeBoundingRect); 285 strokeBoundingBox.unite(strokeBoundingRect);
277 } 286 }
278 } else { 287 } else {
279 strokeBoundingBox.unite(path().strokeBoundingRect(strokeData)); 288 strokeBoundingBox.unite(path().strokeBoundingRect(strokeData));
280 } 289 }
281 } 290 }
282 291
283 return strokeBoundingBox; 292 return strokeBoundingBox;
284 } 293 }
285 294
286 void LayoutSVGShape::updatePaintInvalidationBoundingBox()
287 {
288 m_paintInvalidationBoundingBox = strokeBoundingBox();
289 SVGLayoutSupport::intersectPaintInvalidationRectWithResources(this, m_paintI nvalidationBoundingBox);
290 }
291
292 float LayoutSVGShape::strokeWidth() const 295 float LayoutSVGShape::strokeWidth() const
293 { 296 {
294 SVGLengthContext lengthContext(element()); 297 SVGLengthContext lengthContext(element());
295 return lengthContext.valueForLength(style()->svgStyle().strokeWidth()); 298 return lengthContext.valueForLength(style()->svgStyle().strokeWidth());
296 } 299 }
297 300
298 LayoutSVGShapeRareData& LayoutSVGShape::ensureRareData() const 301 LayoutSVGShapeRareData& LayoutSVGShape::ensureRareData() const
299 { 302 {
300 if (!m_rareData) 303 if (!m_rareData)
301 m_rareData = adoptPtr(new LayoutSVGShapeRareData()); 304 m_rareData = adoptPtr(new LayoutSVGShapeRareData());
302 return *m_rareData.get(); 305 return *m_rareData.get();
303 } 306 }
304 307
305 } // namespace blink 308 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698