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

Side by Side Diff: Source/core/svg/SVGEllipseElement.cpp

Issue 955033002: [svg2] Make 'rx' and 'ry' presentation attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: review fixes 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 unified diff | Download patch
« no previous file with comments | « Source/core/svg/SVGEllipseElement.h ('k') | Source/core/svg/SVGRectElement.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 supportedAttributes.add(SVGNames::ryAttr); 60 supportedAttributes.add(SVGNames::ryAttr);
61 } 61 }
62 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 62 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
63 } 63 }
64 64
65 void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) 65 void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value)
66 { 66 {
67 parseAttributeNew(name, value); 67 parseAttributeNew(name, value);
68 } 68 }
69 69
70 bool SVGEllipseElement::isPresentationAttribute(const QualifiedName& attrName) c onst
71 {
72 if (attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr)
73 return true;
74 return SVGGeometryElement::isPresentationAttribute(attrName);
75 }
76
77 bool SVGEllipseElement::isPresentationAttributeWithSVGDOM(const QualifiedName& a ttrName) const
78 {
79 if (attrName == SVGNames::rxAttr || attrName == SVGNames::ryAttr)
80 return true;
81 return SVGGeometryElement::isPresentationAttributeWithSVGDOM(attrName);
82 }
83
84 void SVGEllipseElement::collectStyleForPresentationAttribute(const QualifiedName & name, const AtomicString& value, MutableStylePropertySet* style)
85 {
86 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name);
87 if (property == m_rx)
88 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRx, * m_rx->currentValue());
89 else if (property == m_ry)
90 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyRy, * m_ry->currentValue());
91 else
92 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, st yle);
93 }
94
95
70 void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) 96 void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName)
71 { 97 {
72 if (!isSupportedAttribute(attrName)) { 98 if (!isSupportedAttribute(attrName)) {
73 SVGGeometryElement::svgAttributeChanged(attrName); 99 SVGGeometryElement::svgAttributeChanged(attrName);
74 return; 100 return;
75 } 101 }
76 102
77 SVGElement::InvalidationGuard invalidationGuard(this); 103 SVGElement::InvalidationGuard invalidationGuard(this);
78 104
105 bool isPresentationLengthAttribute =
106 attrName == SVGNames::rxAttr
107 || attrName == SVGNames::ryAttr;
108 if (isPresentationLengthAttribute) {
109 invalidateSVGPresentationAttributeStyle();
110 setNeedsStyleRecalc(LocalStyleChange,
111 StyleChangeReasonForTracing::fromAttribute(attrName));
112 }
113
79 bool isLengthAttribute = attrName == SVGNames::cxAttr 114 bool isLengthAttribute = attrName == SVGNames::cxAttr
80 || attrName == SVGNames::cyAttr 115 || attrName == SVGNames::cyAttr
81 || attrName == SVGNames::rxAttr 116 || isPresentationLengthAttribute;
82 || attrName == SVGNames::ryAttr;
83 117
84 if (isLengthAttribute) 118 if (isLengthAttribute)
85 updateRelativeLengthsInformation(); 119 updateRelativeLengthsInformation();
86 120
87 LayoutSVGShape* renderer = toLayoutSVGShape(this->renderer()); 121 LayoutSVGShape* renderer = toLayoutSVGShape(this->renderer());
88 if (!renderer) 122 if (!renderer)
89 return; 123 return;
90 124
91 if (isLengthAttribute) { 125 if (isLengthAttribute) {
92 renderer->setNeedsShapeUpdate(); 126 renderer->setNeedsShapeUpdate();
(...skipping 11 matching lines...) Expand all
104 || m_rx->currentValue()->isRelative() 138 || m_rx->currentValue()->isRelative()
105 || m_ry->currentValue()->isRelative(); 139 || m_ry->currentValue()->isRelative();
106 } 140 }
107 141
108 LayoutObject* SVGEllipseElement::createRenderer(const LayoutStyle&) 142 LayoutObject* SVGEllipseElement::createRenderer(const LayoutStyle&)
109 { 143 {
110 return new LayoutSVGEllipse(this); 144 return new LayoutSVGEllipse(this);
111 } 145 }
112 146
113 } // namespace blink 147 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/svg/SVGEllipseElement.h ('k') | Source/core/svg/SVGRectElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698