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

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

Issue 1006493002: [svg2] Exclude <pattern> from having x and y presentation attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fix nit 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
« no previous file with comments | « Source/core/svg/SVGPatternElement.h ('k') | no next file » | 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, 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
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();
142 110
143 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->la youtObject()); 111 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->la youtObject());
144 if (renderer) 112 if (renderer)
145 renderer->invalidateCacheAndMarkForLayout(); 113 renderer->invalidateCacheAndMarkForLayout();
146 } 114 }
147 115
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 199
232 bool SVGPatternElement::selfHasRelativeLengths() const 200 bool SVGPatternElement::selfHasRelativeLengths() const
233 { 201 {
234 return m_x->currentValue()->isRelative() 202 return m_x->currentValue()->isRelative()
235 || m_y->currentValue()->isRelative() 203 || m_y->currentValue()->isRelative()
236 || m_width->currentValue()->isRelative() 204 || m_width->currentValue()->isRelative()
237 || m_height->currentValue()->isRelative(); 205 || m_height->currentValue()->isRelative();
238 } 206 }
239 207
240 } // namespace blink 208 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/svg/SVGPatternElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698