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

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

Issue 423093014: [SVG2] Make transform, gradientTransform and patternTransform presentation attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: transform attr syntax should match property, with minor quirks Created 6 years, 4 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 * 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 , SVGURIReference(this) 50 , SVGURIReference(this)
51 , m_gradientTransform(SVGAnimatedTransformList::create(this, SVGNames::gradi entTransformAttr, SVGTransformList::create())) 51 , m_gradientTransform(SVGAnimatedTransformList::create(this, SVGNames::gradi entTransformAttr, SVGTransformList::create()))
52 , m_spreadMethod(SVGAnimatedEnumeration<SVGSpreadMethodType>::create(this, S VGNames::spreadMethodAttr, SVGSpreadMethodPad)) 52 , m_spreadMethod(SVGAnimatedEnumeration<SVGSpreadMethodType>::create(this, S VGNames::spreadMethodAttr, SVGSpreadMethodPad))
53 , m_gradientUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create( this, SVGNames::gradientUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX )) 53 , m_gradientUnits(SVGAnimatedEnumeration<SVGUnitTypes::SVGUnitType>::create( this, SVGNames::gradientUnitsAttr, SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX ))
54 { 54 {
55 addToPropertyMap(m_gradientTransform); 55 addToPropertyMap(m_gradientTransform);
56 addToPropertyMap(m_spreadMethod); 56 addToPropertyMap(m_spreadMethod);
57 addToPropertyMap(m_gradientUnits); 57 addToPropertyMap(m_gradientUnits);
58 } 58 }
59 59
60 bool SVGGradientElement::isPresentationAttribute(const QualifiedName& name) cons t
61 {
62 if (name == SVGNames::gradientTransformAttr)
63 return true;
64 return SVGElement::isPresentationAttribute(name);
65 }
66
67 void SVGGradientElement::collectStyleForPresentationAttribute(const QualifiedNam e& name, const AtomicString& value, MutableStylePropertySet* style)
68 {
69 if (name == SVGNames::gradientTransformAttr)
70 addPropertyToPresentationAttributeStyle(style, CSSPropertyTransform, val ue);
71 else
72 SVGElement::collectStyleForPresentationAttribute(name, value, style);
73 }
74
60 bool SVGGradientElement::isSupportedAttribute(const QualifiedName& attrName) 75 bool SVGGradientElement::isSupportedAttribute(const QualifiedName& attrName)
61 { 76 {
62 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); 77 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
63 if (supportedAttributes.isEmpty()) { 78 if (supportedAttributes.isEmpty()) {
64 SVGURIReference::addSupportedAttributes(supportedAttributes); 79 SVGURIReference::addSupportedAttributes(supportedAttributes);
65 supportedAttributes.add(SVGNames::gradientUnitsAttr); 80 supportedAttributes.add(SVGNames::gradientUnitsAttr);
66 supportedAttributes.add(SVGNames::gradientTransformAttr); 81 supportedAttributes.add(SVGNames::gradientTransformAttr);
67 supportedAttributes.add(SVGNames::spreadMethodAttr); 82 supportedAttributes.add(SVGNames::spreadMethodAttr);
68 } 83 }
69 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); 84 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 offset = std::min(std::max(previousOffset, offset), 1.0f); 142 offset = std::min(std::max(previousOffset, offset), 1.0f);
128 previousOffset = offset; 143 previousOffset = offset;
129 144
130 stops.append(Gradient::ColorStop(offset, stop->stopColorIncludingOpacity ())); 145 stops.append(Gradient::ColorStop(offset, stop->stopColorIncludingOpacity ()));
131 } 146 }
132 147
133 return stops; 148 return stops;
134 } 149 }
135 150
136 } 151 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698