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

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

Issue 1074813002: Remove isSupportedAttribute in svg (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixups Created 5 years, 8 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 | Annotate | Revision Log
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 2009-2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2009-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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 SVGFitToViewBox::trace(visitor); 74 SVGFitToViewBox::trace(visitor);
75 } 75 }
76 76
77 DEFINE_NODE_FACTORY(SVGMarkerElement) 77 DEFINE_NODE_FACTORY(SVGMarkerElement)
78 78
79 AffineTransform SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const 79 AffineTransform SVGMarkerElement::viewBoxToViewTransform(float viewWidth, float viewHeight) const
80 { 80 {
81 return SVGFitToViewBox::viewBoxToViewTransform(viewBox()->currentValue()->va lue(), preserveAspectRatio()->currentValue(), viewWidth, viewHeight); 81 return SVGFitToViewBox::viewBoxToViewTransform(viewBox()->currentValue()->va lue(), preserveAspectRatio()->currentValue(), viewWidth, viewHeight);
82 } 82 }
83 83
84 bool SVGMarkerElement::isSupportedAttribute(const QualifiedName& attrName)
85 {
86 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
87 if (supportedAttributes.isEmpty()) {
88 SVGFitToViewBox::addSupportedAttributes(supportedAttributes);
89 supportedAttributes.add(SVGNames::markerUnitsAttr);
90 supportedAttributes.add(SVGNames::refXAttr);
91 supportedAttributes.add(SVGNames::refYAttr);
92 supportedAttributes.add(SVGNames::markerWidthAttr);
93 supportedAttributes.add(SVGNames::markerHeightAttr);
94 supportedAttributes.add(SVGNames::orientAttr);
95 }
96 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
97 }
98
99 void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName) 84 void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName)
100 { 85 {
101 if (!isSupportedAttribute(attrName)) { 86 bool isLengthAttr = attrName == SVGNames::refXAttr
102 SVGElement::svgAttributeChanged(attrName); 87 || attrName == SVGNames::refYAttr
88 || attrName == SVGNames::markerWidthAttr
89 || attrName == SVGNames::markerHeightAttr;
90
91 if (isLengthAttr)
92 updateRelativeLengthsInformation();
93
94 if (isLengthAttr || attrName == SVGNames::markerUnitsAttr
95 || attrName == SVGNames::orientAttr
96 || SVGFitToViewBox::isKnownAttribute(attrName)) {
97 SVGElement::InvalidationGuard invalidationGuard(this);
98 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this ->layoutObject());
99 if (renderer)
100 renderer->invalidateCacheAndMarkForLayout();
101
103 return; 102 return;
104 } 103 }
105 104
106 SVGElement::InvalidationGuard invalidationGuard(this); 105 SVGElement::svgAttributeChanged(attrName);
107
108 if (attrName == SVGNames::refXAttr
109 || attrName == SVGNames::refYAttr
110 || attrName == SVGNames::markerWidthAttr
111 || attrName == SVGNames::markerHeightAttr)
112 updateRelativeLengthsInformation();
113
114 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->la youtObject());
115 if (renderer)
116 renderer->invalidateCacheAndMarkForLayout();
117 } 106 }
118 107
119 void SVGMarkerElement::childrenChanged(const ChildrenChange& change) 108 void SVGMarkerElement::childrenChanged(const ChildrenChange& change)
120 { 109 {
121 SVGElement::childrenChanged(change); 110 SVGElement::childrenChanged(change);
122 111
123 if (change.byParser) 112 if (change.byParser)
124 return; 113 return;
125 114
126 if (LayoutObject* object = layoutObject()) 115 if (LayoutObject* object = layoutObject())
(...skipping 23 matching lines...) Expand all
150 139
151 bool SVGMarkerElement::selfHasRelativeLengths() const 140 bool SVGMarkerElement::selfHasRelativeLengths() const
152 { 141 {
153 return m_refX->currentValue()->isRelative() 142 return m_refX->currentValue()->isRelative()
154 || m_refY->currentValue()->isRelative() 143 || m_refY->currentValue()->isRelative()
155 || m_markerWidth->currentValue()->isRelative() 144 || m_markerWidth->currentValue()->isRelative()
156 || m_markerHeight->currentValue()->isRelative(); 145 || m_markerHeight->currentValue()->isRelative();
157 } 146 }
158 147
159 } // namespace blink 148 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698