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

Side by Side 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: 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 unified diff | Download patch
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 supportedAttributes.add(SVGNames::ryAttr); 68 supportedAttributes.add(SVGNames::ryAttr);
69 } 69 }
70 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 70 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
71 } 71 }
72 72
73 void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value) 73 void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin g& value)
74 { 74 {
75 parseAttributeNew(name, value); 75 parseAttributeNew(name, value);
76 } 76 }
77 77
78 bool SVGRectElement::isPresentationAttribute(const QualifiedName& attrName) cons t
79 {
80 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr)
81 return true;
82 return SVGGeometryElement::isPresentationAttribute(attrName);
83 }
84
85 void SVGRectElement::collectStyleForPresentationAttribute(const QualifiedName& n ame, const AtomicString& value, MutableStylePropertySet* style)
86 {
87 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name);
88 if (property == m_x) {
89 addPropertyToPresentationAttributeStyle(style, CSSPropertyX, m_x->curren tValue()->valueInSpecifiedUnits(), m_x->currentValue()->cssUnitTypeQuirk());
90 } else if (property == m_y) {
91 addPropertyToPresentationAttributeStyle(style, CSSPropertyY, m_y->curren tValue()->valueInSpecifiedUnits(), m_y->currentValue()->cssUnitTypeQuirk());
92 } else if (!property) {
fs 2015/02/04 13:24:53 Why the condition here? (Also, could drop the {}'
Erik Dahlström (inactive) 2015/02/05 16:09:02 Just a remnant from early testing, shouldn't be ne
93 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, st yle);
94 }
95 }
96
78 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName) 97 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
79 { 98 {
80 if (!isSupportedAttribute(attrName)) { 99 if (!isSupportedAttribute(attrName)) {
81 SVGGeometryElement::svgAttributeChanged(attrName); 100 SVGGeometryElement::svgAttributeChanged(attrName);
82 return; 101 return;
83 } 102 }
84 103
85 SVGElement::InvalidationGuard invalidationGuard(this); 104 SVGElement::InvalidationGuard invalidationGuard(this);
86 105
87 bool isLengthAttribute = attrName == SVGNames::xAttr 106 bool isLengthAttributeXY =
88 || attrName == SVGNames::yAttr 107 attrName == SVGNames::xAttr
108 || attrName == SVGNames::yAttr;
109 if (isLengthAttributeXY) {
110 invalidateSVGPresentationAttributeStyle();
111 setNeedsStyleRecalc(LocalStyleChange,
112 StyleChangeReasonForTracing::fromAttribute(attrName));
113 }
114
115 bool isLengthAttribute = isLengthAttributeXY
89 || attrName == SVGNames::widthAttr 116 || attrName == SVGNames::widthAttr
90 || attrName == SVGNames::heightAttr 117 || attrName == SVGNames::heightAttr
91 || attrName == SVGNames::rxAttr 118 || attrName == SVGNames::rxAttr
92 || attrName == SVGNames::ryAttr; 119 || attrName == SVGNames::ryAttr;
93 120
94 if (isLengthAttribute) 121 if (isLengthAttribute)
95 updateRelativeLengthsInformation(); 122 updateRelativeLengthsInformation();
96 123
97 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); 124 RenderSVGShape* renderer = toRenderSVGShape(this->renderer());
98 if (!renderer) 125 if (!renderer)
(...skipping 17 matching lines...) Expand all
116 || m_rx->currentValue()->isRelative() 143 || m_rx->currentValue()->isRelative()
117 || m_ry->currentValue()->isRelative(); 144 || m_ry->currentValue()->isRelative();
118 } 145 }
119 146
120 RenderObject* SVGRectElement::createRenderer(RenderStyle*) 147 RenderObject* SVGRectElement::createRenderer(RenderStyle*)
121 { 148 {
122 return new RenderSVGRect(this); 149 return new RenderSVGRect(this);
123 } 150 }
124 151
125 } // namespace blink 152 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698