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

Unified Diff: Source/core/svg/SVGImageElement.cpp

Issue 898873002: CL for perf tryjob (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « Source/core/svg/SVGImageElement.h ('k') | Source/core/svg/SVGLength.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGImageElement.cpp
diff --git a/Source/core/svg/SVGImageElement.cpp b/Source/core/svg/SVGImageElement.cpp
index e4313786a3e0633ace4db4a1e2210ca7e76c39df..1af4d6121d446f7b307ef5cb3e6e21c583e6ee86 100644
--- a/Source/core/svg/SVGImageElement.cpp
+++ b/Source/core/svg/SVGImageElement.cpp
@@ -89,21 +89,28 @@ bool SVGImageElement::isSupportedAttribute(const QualifiedName& attrName)
return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
}
-bool SVGImageElement::isPresentationAttribute(const QualifiedName& name) const
+bool SVGImageElement::isPresentationAttribute(const QualifiedName& attrName) const
{
- if (name == SVGNames::widthAttr || name == SVGNames::heightAttr)
+ if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr
+ || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr)
return true;
- return SVGGraphicsElement::isPresentationAttribute(name);
+ return SVGGraphicsElement::isPresentationAttribute(attrName);
}
void SVGImageElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
{
- if (!isSupportedAttribute(name))
- SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, style);
- else if (name == SVGNames::widthAttr)
+ RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute(name);
+
+ if (property == m_width)
addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, value);
- else if (name == SVGNames::heightAttr)
+ else if (property == m_height)
addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, value);
+ else if (property == m_x)
+ addPropertyToPresentationAttributeStyle(style, CSSPropertyX, m_x->currentValue()->valueInSpecifiedUnits(), m_x->currentValue()->cssUnitTypeQuirk());
+ else if (property == m_y)
+ addPropertyToPresentationAttributeStyle(style, CSSPropertyY, m_y->currentValue()->valueInSpecifiedUnits(), m_y->currentValue()->cssUnitTypeQuirk());
+ else
+ SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, style);
}
void SVGImageElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
@@ -120,6 +127,13 @@ void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName)
SVGElement::InvalidationGuard invalidationGuard(this);
+ if (attrName == SVGNames::xAttr
+ || attrName == SVGNames::yAttr) {
+ invalidateSVGPresentationAttributeStyle();
+ setNeedsStyleRecalc(LocalStyleChange,
+ StyleChangeReasonForTracing::fromAttribute(attrName));
+ }
+
bool isLengthAttribute = attrName == SVGNames::xAttr
|| attrName == SVGNames::yAttr
|| attrName == SVGNames::widthAttr
« no previous file with comments | « Source/core/svg/SVGImageElement.h ('k') | Source/core/svg/SVGLength.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698