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

Side by Side Diff: Source/core/svg/SVGPatternElement.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, 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 void SVGPatternElement::collectStyleForPresentationAttribute(const QualifiedName & name, const AtomicString& value, MutableStylePropertySet* style)
99 {
100 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name);
101 if (property == m_x)
102 addPropertyToPresentationAttributeStyle(style, CSSPropertyX, m_x->curren tValue()->valueInSpecifiedUnits(), m_x->currentValue()->cssUnitTypeQuirk());
103 else if (property == m_y)
104 addPropertyToPresentationAttributeStyle(style, CSSPropertyY, m_y->curren tValue()->valueInSpecifiedUnits(), m_y->currentValue()->cssUnitTypeQuirk());
105 else
106 SVGElement::collectStyleForPresentationAttribute(name, value, style);
107 }
108
91 void SVGPatternElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value) 109 void SVGPatternElement::parseAttribute(const QualifiedName& name, const AtomicSt ring& value)
92 { 110 {
93 parseAttributeNew(name, value); 111 parseAttributeNew(name, value);
94 } 112 }
95 113
96 void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) 114 void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName)
97 { 115 {
98 if (!isSupportedAttribute(attrName)) { 116 if (!isSupportedAttribute(attrName)) {
99 SVGElement::svgAttributeChanged(attrName); 117 SVGElement::svgAttributeChanged(attrName);
100 return; 118 return;
101 } 119 }
102 120
103 SVGElement::InvalidationGuard invalidationGuard(this); 121 SVGElement::InvalidationGuard invalidationGuard(this);
104 122
105 if (attrName == SVGNames::xAttr 123 if (attrName == SVGNames::xAttr
124 || attrName == SVGNames::yAttr) {
125 invalidateSVGPresentationAttributeStyle();
126 setNeedsStyleRecalc(LocalStyleChange,
127 StyleChangeReasonForTracing::fromAttribute(attrName));
128 }
129
130 if (attrName == SVGNames::xAttr
106 || attrName == SVGNames::yAttr 131 || attrName == SVGNames::yAttr
107 || attrName == SVGNames::widthAttr 132 || attrName == SVGNames::widthAttr
108 || attrName == SVGNames::heightAttr) 133 || attrName == SVGNames::heightAttr)
109 updateRelativeLengthsInformation(); 134 updateRelativeLengthsInformation();
110 135
111 RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->re nderer()); 136 RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->re nderer());
112 if (renderer) 137 if (renderer)
113 renderer->invalidateCacheAndMarkForLayout(); 138 renderer->invalidateCacheAndMarkForLayout();
114 } 139 }
115 140
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 224
200 bool SVGPatternElement::selfHasRelativeLengths() const 225 bool SVGPatternElement::selfHasRelativeLengths() const
201 { 226 {
202 return m_x->currentValue()->isRelative() 227 return m_x->currentValue()->isRelative()
203 || m_y->currentValue()->isRelative() 228 || m_y->currentValue()->isRelative()
204 || m_width->currentValue()->isRelative() 229 || m_width->currentValue()->isRelative()
205 || m_height->currentValue()->isRelative(); 230 || m_height->currentValue()->isRelative();
206 } 231 }
207 232
208 } // namespace blink 233 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698