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

Unified Diff: Source/core/svg/SVGRectElement.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/SVGRectElement.h ('k') | Source/core/svg/SVGSVGElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGRectElement.cpp
diff --git a/Source/core/svg/SVGRectElement.cpp b/Source/core/svg/SVGRectElement.cpp
index 6954804ef0cd18f632e7d22542172e02abc3b11a..77cb7a35846d871cfd1396c569288e6d9739baee 100644
--- a/Source/core/svg/SVGRectElement.cpp
+++ b/Source/core/svg/SVGRectElement.cpp
@@ -75,6 +75,31 @@ void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin
parseAttributeNew(name, value);
}
+bool SVGRectElement::isPresentationAttribute(const QualifiedName& attrName) const
+{
+ if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr)
+ return true;
+ return SVGGeometryElement::isPresentationAttribute(attrName);
+}
+
+bool SVGRectElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attrName) const
+{
+ if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr)
+ return true;
+ return SVGGeometryElement::isPresentationAttributeWithSVGDOM(attrName);
+}
+
+void SVGRectElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
+{
+ RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute(name);
+ if (property == m_x)
+ addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m_x->currentValue());
+ else if (property == m_y)
+ addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m_y->currentValue());
+ else
+ SVGGeometryElement::collectStyleForPresentationAttribute(name, value, style);
+}
+
void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
{
if (!isSupportedAttribute(attrName)) {
@@ -84,8 +109,16 @@ void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
SVGElement::InvalidationGuard invalidationGuard(this);
- bool isLengthAttribute = attrName == SVGNames::xAttr
- || attrName == SVGNames::yAttr
+ bool isLengthAttributeXY =
+ attrName == SVGNames::xAttr
+ || attrName == SVGNames::yAttr;
+ if (isLengthAttributeXY) {
+ invalidateSVGPresentationAttributeStyle();
+ setNeedsStyleRecalc(LocalStyleChange,
+ StyleChangeReasonForTracing::fromAttribute(attrName));
+ }
+
+ bool isLengthAttribute = isLengthAttributeXY
|| attrName == SVGNames::widthAttr
|| attrName == SVGNames::heightAttr
|| attrName == SVGNames::rxAttr
« no previous file with comments | « Source/core/svg/SVGRectElement.h ('k') | Source/core/svg/SVGSVGElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698