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

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

Issue 896773002: [svg2] Make 'x' and 'y' presentation attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase 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 3503927898d3dcd5ab85494ea87ddee6328edc63..22ed66350b041b9c7d380548610b03bf66fae985 100644
--- a/Source/core/svg/SVGImageElement.cpp
+++ b/Source/core/svg/SVGImageElement.cpp
@@ -89,21 +89,36 @@ 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);
+}
+
+bool SVGImageElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attrName) const
+{
+ if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr
+ || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr)
+ return true;
+ return SVGGraphicsElement::isPresentationAttributeWithSVGDOM(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)
+ addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m_x->currentValue());
+ else if (property == m_y)
+ addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m_y->currentValue());
+ else
+ SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, style);
}
void SVGImageElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
@@ -125,8 +140,12 @@ void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName)
|| attrName == SVGNames::widthAttr
|| attrName == SVGNames::heightAttr;
- if (isLengthAttribute)
+ if (isLengthAttribute) {
+ invalidateSVGPresentationAttributeStyle();
+ setNeedsStyleRecalc(LocalStyleChange,
+ StyleChangeReasonForTracing::fromAttribute(attrName));
updateRelativeLengthsInformation();
+ }
if (SVGURIReference::isKnownAttribute(attrName)) {
if (inDocument())
« 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