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

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

Issue 896773002: [svg2] Make 'x' and 'y' presentation attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: cleanup 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
« Source/core/svg/SVGUseElement.h ('K') | « Source/core/svg/SVGUseElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGUseElement.cpp
diff --git a/Source/core/svg/SVGUseElement.cpp b/Source/core/svg/SVGUseElement.cpp
index 4fdcc9f7ff1c8b0928366d3a70940ed2cf2e80a4..508c6b2331891b8e346472b7f3428c0cd8bda5f5 100644
--- a/Source/core/svg/SVGUseElement.cpp
+++ b/Source/core/svg/SVGUseElement.cpp
@@ -182,6 +182,24 @@ void transferUseWidthAndHeightIfNeeded(const SVGUseElement& use, SVGElement* sha
}
}
+bool SVGUseElement::isPresentationAttribute(const QualifiedName& attrName) const
+{
+ if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr)
+ return true;
+ return SVGGraphicsElement::isPresentationAttribute(attrName);
+}
+
+void SVGUseElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
+{
+ RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute(name);
+ 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 SVGUseElement::svgAttributeChanged(const QualifiedName& attrName)
{
if (!isSupportedAttribute(attrName)) {
@@ -191,6 +209,13 @@ void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName)
SVGElement::InvalidationGuard invalidationGuard(this);
+ if (attrName == SVGNames::xAttr
+ || attrName == SVGNames::yAttr) {
+ invalidateSVGPresentationAttributeStyle();
+ setNeedsStyleRecalc(LocalStyleChange,
+ StyleChangeReasonForTracing::fromAttribute(attrName));
+ }
+
RenderObject* renderer = this->renderer();
if (attrName == SVGNames::xAttr
|| attrName == SVGNames::yAttr
« Source/core/svg/SVGUseElement.h ('K') | « Source/core/svg/SVGUseElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698