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

Unified Diff: third_party/WebKit/Source/core/svg/SVGMarkerElement.cpp

Issue 2565943002: Add support for caching and invalidating SVG marker transforms (Closed)
Patch Set: rebase Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceMarker.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/svg/SVGMarkerElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGMarkerElement.cpp b/third_party/WebKit/Source/core/svg/SVGMarkerElement.cpp
index 55a49701defd9aadd7c09ac262d8baa1f33c5104..06e7d1468aea08a1e0b7ed26cf8971656c13b308 100644
--- a/third_party/WebKit/Source/core/svg/SVGMarkerElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGMarkerElement.cpp
@@ -99,22 +99,26 @@ AffineTransform SVGMarkerElement::viewBoxToViewTransform(
}
void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName) {
- bool isLengthAttr = attrName == SVGNames::refXAttr ||
- attrName == SVGNames::refYAttr ||
- attrName == SVGNames::markerWidthAttr ||
- attrName == SVGNames::markerHeightAttr;
-
- if (isLengthAttr)
+ bool viewboxAttributeChanged = SVGFitToViewBox::isKnownAttribute(attrName);
+ bool lengthAttributeChanged = attrName == SVGNames::refXAttr ||
+ attrName == SVGNames::refYAttr ||
+ attrName == SVGNames::markerWidthAttr ||
+ attrName == SVGNames::markerHeightAttr;
+ if (lengthAttributeChanged)
updateRelativeLengthsInformation();
- if (isLengthAttr || attrName == SVGNames::markerUnitsAttr ||
- attrName == SVGNames::orientAttr ||
- SVGFitToViewBox::isKnownAttribute(attrName)) {
+ if (viewboxAttributeChanged || lengthAttributeChanged ||
+ attrName == SVGNames::markerUnitsAttr ||
+ attrName == SVGNames::orientAttr) {
SVGElement::InvalidationGuard invalidationGuard(this);
- LayoutSVGResourceContainer* layoutObject =
- toLayoutSVGResourceContainer(this->layoutObject());
- if (layoutObject)
- layoutObject->invalidateCacheAndMarkForLayout();
+ auto* resourceContainer = toLayoutSVGResourceContainer(layoutObject());
+ if (resourceContainer) {
+ // The marker transform depends on both viewbox attributes, and the marker
+ // size attributes (width, height).
+ if (viewboxAttributeChanged || lengthAttributeChanged)
+ resourceContainer->setNeedsTransformUpdate();
+ resourceContainer->invalidateCacheAndMarkForLayout();
+ }
return;
}
« no previous file with comments | « third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceMarker.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698