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

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

Issue 980233002: [svg2] Make 'cx', 'cy' and 'r' presentation attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 9 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/SVGCircleElement.h ('k') | Source/core/svg/SVGEllipseElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/svg/SVGCircleElement.cpp
diff --git a/Source/core/svg/SVGCircleElement.cpp b/Source/core/svg/SVGCircleElement.cpp
index dd223dd14e08ca481df59cf4d26260d027a9f418..8c088ef6ef91321aa83b4ef0ea354af931b53c11 100644
--- a/Source/core/svg/SVGCircleElement.cpp
+++ b/Source/core/svg/SVGCircleElement.cpp
@@ -63,6 +63,35 @@ void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicStr
parseAttributeNew(name, value);
}
+bool SVGCircleElement::isPresentationAttribute(const QualifiedName& attrName) const
+{
+ if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr
+ || attrName == SVGNames::rAttr)
+ return true;
+ return SVGGeometryElement::isPresentationAttribute(attrName);
+}
+
+bool SVGCircleElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attrName) const
+{
+ if (attrName == SVGNames::cxAttr || attrName == SVGNames::cyAttr
+ || attrName == SVGNames::rAttr)
+ return true;
+ return SVGGeometryElement::isPresentationAttributeWithSVGDOM(attrName);
+}
+
+void SVGCircleElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
+{
+ RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute(name);
+ if (property == m_cx)
+ addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyCx, *m_cx->currentValue());
+ else if (property == m_cy)
+ addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyCy, *m_cy->currentValue());
+ else if (property == m_r)
+ addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyR, *m_r->currentValue());
+ else
+ SVGGeometryElement::collectStyleForPresentationAttribute(name, value, style);
+}
+
void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName)
{
if (!isSupportedAttribute(attrName)) {
@@ -72,24 +101,17 @@ void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName)
SVGElement::InvalidationGuard invalidationGuard(this);
- bool isLengthAttribute = attrName == SVGNames::cxAttr
- || attrName == SVGNames::cyAttr
- || attrName == SVGNames::rAttr;
-
- if (isLengthAttribute)
- updateRelativeLengthsInformation();
+ invalidateSVGPresentationAttributeStyle();
+ setNeedsStyleRecalc(LocalStyleChange,
+ StyleChangeReasonForTracing::fromAttribute(attrName));
+ updateRelativeLengthsInformation();
LayoutSVGShape* renderer = toLayoutSVGShape(this->layoutObject());
if (!renderer)
return;
- if (isLengthAttribute) {
- renderer->setNeedsShapeUpdate();
- markForLayoutAndParentResourceInvalidation(renderer);
- return;
- }
-
- ASSERT_NOT_REACHED();
+ renderer->setNeedsShapeUpdate();
+ markForLayoutAndParentResourceInvalidation(renderer);
}
bool SVGCircleElement::selfHasRelativeLengths() const
« no previous file with comments | « Source/core/svg/SVGCircleElement.h ('k') | Source/core/svg/SVGEllipseElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698