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

Unified 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: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp
index b7671c4696908d97dcb7e9ab9ca4fa87a98a1779..93a965ea2bbf22c3cad4769ce0d4b7f44963ca8d 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGShape.cpp
@@ -156,29 +156,39 @@ void LayoutSVGShape::updateLocalTransform()
void LayoutSVGShape::layout()
{
- bool updateCachedBoundariesInParents = false;
LayoutAnalyzer::Scope analyzer(*this);
+ bool updateParentBoundaries = false;
+ // updateShapeFromElement() also updates the object & stroke bounds - which
+ // feeds into the paint invalidation rect - so we need to call it for both
+ // the shape-update and the bounds-update flag, since .
if (m_needsShapeUpdate || m_needsBoundariesUpdate) {
updateShapeFromElement();
m_needsShapeUpdate = false;
- updatePaintInvalidationBoundingBox();
- m_needsBoundariesUpdate = false;
- updateCachedBoundariesInParents = true;
+
+ m_needsBoundariesUpdate = true;
+ updateParentBoundaries = true;
}
if (m_needsTransformUpdate) {
updateLocalTransform();
m_needsTransformUpdate = false;
- updateCachedBoundariesInParents = true;
+ updateParentBoundaries = true;
}
// Invalidate all resources of this client if our layout changed.
if (everHadLayout() && selfNeedsLayout())
SVGResourcesCache::clientLayoutChanged(this);
+ if (m_needsBoundariesUpdate) {
+ m_paintInvalidationBoundingBox = strokeBoundingBox();
+ SVGLayoutSupport::intersectPaintInvalidationRectWithResources(this, m_paintInvalidationBoundingBox);
+ m_needsBoundariesUpdate = false;
+ updateParentBoundaries = true;
+ }
+
// If our bounds changed, notify the parents.
- if (updateCachedBoundariesInParents)
+ if (updateParentBoundaries)
LayoutSVGModelObject::setNeedsBoundariesUpdate();
clearNeedsLayout();
@@ -283,12 +293,6 @@ FloatRect LayoutSVGShape::calculateStrokeBoundingBox() const
return strokeBoundingBox;
}
-void LayoutSVGShape::updatePaintInvalidationBoundingBox()
-{
- m_paintInvalidationBoundingBox = strokeBoundingBox();
- SVGLayoutSupport::intersectPaintInvalidationRectWithResources(this, m_paintInvalidationBoundingBox);
-}
-
float LayoutSVGShape::strokeWidth() const
{
SVGLengthContext lengthContext(element());

Powered by Google App Engine
This is Rietveld 408576698