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

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

Issue 963733002: [svg2] Make 'width' and 'height' presentation attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: test fixes 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde .org> 2 * Copyright (C) 2004, 2005, 2006, 2007, 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 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 supportedAttributes.add(SVGNames::patternContentUnitsAttr); 81 supportedAttributes.add(SVGNames::patternContentUnitsAttr);
82 supportedAttributes.add(SVGNames::patternTransformAttr); 82 supportedAttributes.add(SVGNames::patternTransformAttr);
83 supportedAttributes.add(SVGNames::xAttr); 83 supportedAttributes.add(SVGNames::xAttr);
84 supportedAttributes.add(SVGNames::yAttr); 84 supportedAttributes.add(SVGNames::yAttr);
85 supportedAttributes.add(SVGNames::widthAttr); 85 supportedAttributes.add(SVGNames::widthAttr);
86 supportedAttributes.add(SVGNames::heightAttr); 86 supportedAttributes.add(SVGNames::heightAttr);
87 } 87 }
88 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 88 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
89 } 89 }
90 90
91 bool SVGPatternElement::isPresentationAttribute(const QualifiedName& attrName) c onst
fs 2015/03/12 14:28:48 Could you do this "revert" in a separate CL?
Erik Dahlström (inactive) 2015/03/12 16:14:56 Sure, now https://codereview.chromium.org/10064930
92 {
93 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr)
94 return true;
95 return SVGElement::isPresentationAttribute(attrName);
96 }
97
98 bool SVGPatternElement::isPresentationAttributeWithSVGDOM(const QualifiedName& a ttrName) const
99 {
100 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr)
101 return true;
102 return SVGElement::isPresentationAttributeWithSVGDOM(attrName);
103 }
104
105 void SVGPatternElement::collectStyleForPresentationAttribute(const QualifiedName & name, const AtomicString& value, MutableStylePropertySet* style)
106 {
107 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name);
108 if (property == m_x)
109 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m _x->currentValue());
110 else if (property == m_y)
111 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m _y->currentValue());
112 else
113 SVGElement::collectStyleForPresentationAttribute(name, value, style);
114 }
115
116 void SVGPatternElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) 91 void SVGPatternElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value)
117 { 92 {
118 parseAttributeNew(name, value); 93 parseAttributeNew(name, value);
119 } 94 }
120 95
121 void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) 96 void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName)
122 { 97 {
123 if (!isSupportedAttribute(attrName)) { 98 if (!isSupportedAttribute(attrName)) {
124 SVGElement::svgAttributeChanged(attrName); 99 SVGElement::svgAttributeChanged(attrName);
125 return; 100 return;
126 } 101 }
127 102
128 SVGElement::InvalidationGuard invalidationGuard(this); 103 SVGElement::InvalidationGuard invalidationGuard(this);
129 104
130 if (attrName == SVGNames::xAttr 105 if (attrName == SVGNames::xAttr
131 || attrName == SVGNames::yAttr) {
132 invalidateSVGPresentationAttributeStyle();
133 setNeedsStyleRecalc(LocalStyleChange,
134 StyleChangeReasonForTracing::fromAttribute(attrName));
135 }
136
137 if (attrName == SVGNames::xAttr
138 || attrName == SVGNames::yAttr 106 || attrName == SVGNames::yAttr
139 || attrName == SVGNames::widthAttr 107 || attrName == SVGNames::widthAttr
140 || attrName == SVGNames::heightAttr) 108 || attrName == SVGNames::heightAttr) {
141 updateRelativeLengthsInformation(); 109 updateRelativeLengthsInformation();
110 }
142 111
143 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->la youtObject()); 112 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->la youtObject());
144 if (renderer) 113 if (renderer)
145 renderer->invalidateCacheAndMarkForLayout(); 114 renderer->invalidateCacheAndMarkForLayout();
146 } 115 }
147 116
148 void SVGPatternElement::childrenChanged(const ChildrenChange& change) 117 void SVGPatternElement::childrenChanged(const ChildrenChange& change)
149 { 118 {
150 SVGElement::childrenChanged(change); 119 SVGElement::childrenChanged(change);
151 120
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 200
232 bool SVGPatternElement::selfHasRelativeLengths() const 201 bool SVGPatternElement::selfHasRelativeLengths() const
233 { 202 {
234 return m_x->currentValue()->isRelative() 203 return m_x->currentValue()->isRelative()
235 || m_y->currentValue()->isRelative() 204 || m_y->currentValue()->isRelative()
236 || m_width->currentValue()->isRelative() 205 || m_width->currentValue()->isRelative()
237 || m_height->currentValue()->isRelative(); 206 || m_height->currentValue()->isRelative();
238 } 207 }
239 208
240 } // namespace blink 209 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698