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

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: 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 unified diff | Download patch
« no previous file with comments | « Source/core/svg/SVGRectElement.h ('k') | Source/core/svg/SVGSVGElement.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 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 bool SVGRectElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attr Name) const
86 {
87 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr)
88 return true;
89 return SVGGeometryElement::isPresentationAttributeWithSVGDOM(attrName);
90 }
91
92 void SVGRectElement::collectStyleForPresentationAttribute(const QualifiedName& n ame, const AtomicString& value, MutableStylePropertySet* style)
93 {
94 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name);
95 if (property == m_x)
96 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m _x->currentValue());
97 else if (property == m_y)
98 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m _y->currentValue());
99 else
100 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, st yle);
101 }
102
78 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName) 103 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
79 { 104 {
80 if (!isSupportedAttribute(attrName)) { 105 if (!isSupportedAttribute(attrName)) {
81 SVGGeometryElement::svgAttributeChanged(attrName); 106 SVGGeometryElement::svgAttributeChanged(attrName);
82 return; 107 return;
83 } 108 }
84 109
85 SVGElement::InvalidationGuard invalidationGuard(this); 110 SVGElement::InvalidationGuard invalidationGuard(this);
86 111
87 bool isLengthAttribute = attrName == SVGNames::xAttr 112 bool isLengthAttributeXY =
88 || attrName == SVGNames::yAttr 113 attrName == SVGNames::xAttr
114 || attrName == SVGNames::yAttr;
115 if (isLengthAttributeXY) {
116 invalidateSVGPresentationAttributeStyle();
117 setNeedsStyleRecalc(LocalStyleChange,
118 StyleChangeReasonForTracing::fromAttribute(attrName));
119 }
120
121 bool isLengthAttribute = isLengthAttributeXY
89 || attrName == SVGNames::widthAttr 122 || attrName == SVGNames::widthAttr
90 || attrName == SVGNames::heightAttr 123 || attrName == SVGNames::heightAttr
91 || attrName == SVGNames::rxAttr 124 || attrName == SVGNames::rxAttr
92 || attrName == SVGNames::ryAttr; 125 || attrName == SVGNames::ryAttr;
93 126
94 if (isLengthAttribute) 127 if (isLengthAttribute)
95 updateRelativeLengthsInformation(); 128 updateRelativeLengthsInformation();
96 129
97 LayoutSVGShape* renderer = toLayoutSVGShape(this->renderer()); 130 LayoutSVGShape* renderer = toLayoutSVGShape(this->renderer());
98 if (!renderer) 131 if (!renderer)
(...skipping 17 matching lines...) Expand all
116 || m_rx->currentValue()->isRelative() 149 || m_rx->currentValue()->isRelative()
117 || m_ry->currentValue()->isRelative(); 150 || m_ry->currentValue()->isRelative();
118 } 151 }
119 152
120 LayoutObject* SVGRectElement::createRenderer(const LayoutStyle&) 153 LayoutObject* SVGRectElement::createRenderer(const LayoutStyle&)
121 { 154 {
122 return new LayoutSVGRect(this); 155 return new LayoutSVGRect(this);
123 } 156 }
124 157
125 } // namespace blink 158 } // namespace blink
OLDNEW
« 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