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

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

Issue 1074813002: Remove isSupportedAttribute in svg (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: invalidation guard tweaks 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 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 visitor->trace(m_patternUnits); 62 visitor->trace(m_patternUnits);
63 visitor->trace(m_patternContentUnits); 63 visitor->trace(m_patternContentUnits);
64 SVGElement::trace(visitor); 64 SVGElement::trace(visitor);
65 SVGURIReference::trace(visitor); 65 SVGURIReference::trace(visitor);
66 SVGTests::trace(visitor); 66 SVGTests::trace(visitor);
67 SVGFitToViewBox::trace(visitor); 67 SVGFitToViewBox::trace(visitor);
68 } 68 }
69 69
70 DEFINE_NODE_FACTORY(SVGPatternElement) 70 DEFINE_NODE_FACTORY(SVGPatternElement)
71 71
72 bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName)
73 {
74 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
75 if (supportedAttributes.isEmpty()) {
76 SVGURIReference::addSupportedAttributes(supportedAttributes);
77 SVGTests::addSupportedAttributes(supportedAttributes);
78 SVGFitToViewBox::addSupportedAttributes(supportedAttributes);
79 supportedAttributes.add(SVGNames::patternUnitsAttr);
80 supportedAttributes.add(SVGNames::patternContentUnitsAttr);
81 supportedAttributes.add(SVGNames::patternTransformAttr);
82 supportedAttributes.add(SVGNames::xAttr);
83 supportedAttributes.add(SVGNames::yAttr);
84 supportedAttributes.add(SVGNames::widthAttr);
85 supportedAttributes.add(SVGNames::heightAttr);
86 }
87 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
88 }
89
90 void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) 72 void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName)
91 { 73 {
92 if (!isSupportedAttribute(attrName)) { 74 bool isLengthAttr = attrName == SVGNames::xAttr
93 SVGElement::svgAttributeChanged(attrName); 75 || attrName == SVGNames::yAttr
76 || attrName == SVGNames::widthAttr
77 || attrName == SVGNames::heightAttr;
78
79 if (isLengthAttr
80 || attrName == SVGNames::patternUnitsAttr
81 || attrName == SVGNames::patternContentUnitsAttr
82 || attrName == SVGNames::patternTransformAttr
83 || SVGFitToViewBox::isKnownAttribute(attrName)
84 || SVGURIReference::isKnownAttribute(attrName)
85 || SVGTests::isKnownAttribute(attrName)) {
86 SVGElement::InvalidationGuard invalidationGuard(this);
87
88 if (isLengthAttr)
89 updateRelativeLengthsInformation();
90
91 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this ->layoutObject());
92 if (renderer)
93 renderer->invalidateCacheAndMarkForLayout();
94
94 return; 95 return;
95 } 96 }
96 97
97 SVGElement::InvalidationGuard invalidationGuard(this); 98 SVGElement::svgAttributeChanged(attrName);
98
99 if (attrName == SVGNames::xAttr
100 || attrName == SVGNames::yAttr
101 || attrName == SVGNames::widthAttr
102 || attrName == SVGNames::heightAttr)
103 updateRelativeLengthsInformation();
104
105 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->la youtObject());
106 if (renderer)
107 renderer->invalidateCacheAndMarkForLayout();
108 } 99 }
109 100
110 void SVGPatternElement::childrenChanged(const ChildrenChange& change) 101 void SVGPatternElement::childrenChanged(const ChildrenChange& change)
111 { 102 {
112 SVGElement::childrenChanged(change); 103 SVGElement::childrenChanged(change);
113 104
114 if (change.byParser) 105 if (change.byParser)
115 return; 106 return;
116 107
117 if (LayoutObject* object = layoutObject()) 108 if (LayoutObject* object = layoutObject())
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 183
193 bool SVGPatternElement::selfHasRelativeLengths() const 184 bool SVGPatternElement::selfHasRelativeLengths() const
194 { 185 {
195 return m_x->currentValue()->isRelative() 186 return m_x->currentValue()->isRelative()
196 || m_y->currentValue()->isRelative() 187 || m_y->currentValue()->isRelative()
197 || m_width->currentValue()->isRelative() 188 || m_width->currentValue()->isRelative()
198 || m_height->currentValue()->isRelative(); 189 || m_height->currentValue()->isRelative();
199 } 190 }
200 191
201 } // namespace blink 192 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698