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

Side by Side Diff: Source/core/svg/SVGFilterElement.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 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 4 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 void SVGFilterElement::setFilterRes(unsigned x, unsigned y) 80 void SVGFilterElement::setFilterRes(unsigned x, unsigned y)
81 { 81 {
82 filterResX()->baseValue()->setValue(x); 82 filterResX()->baseValue()->setValue(x);
83 filterResY()->baseValue()->setValue(y); 83 filterResY()->baseValue()->setValue(y);
84 84
85 invalidateSVGAttributes(); 85 invalidateSVGAttributes();
86 svgAttributeChanged(SVGNames::filterResAttr); 86 svgAttributeChanged(SVGNames::filterResAttr);
87 } 87 }
88 88
89 bool SVGFilterElement::isSupportedAttribute(const QualifiedName& attrName)
90 {
91 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
92 if (supportedAttributes.isEmpty()) {
93 SVGURIReference::addSupportedAttributes(supportedAttributes);
94 supportedAttributes.add(SVGNames::filterUnitsAttr);
95 supportedAttributes.add(SVGNames::primitiveUnitsAttr);
96 supportedAttributes.add(SVGNames::xAttr);
97 supportedAttributes.add(SVGNames::yAttr);
98 supportedAttributes.add(SVGNames::widthAttr);
99 supportedAttributes.add(SVGNames::heightAttr);
100 supportedAttributes.add(SVGNames::filterResAttr);
101 }
102 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
103 }
104
105 void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName) 89 void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName)
106 { 90 {
107 if (!isSupportedAttribute(attrName)) {
108 SVGElement::svgAttributeChanged(attrName);
109 return;
110 }
111
112 SVGElement::InvalidationGuard invalidationGuard(this);
113
114 bool isXYWH = attrName == SVGNames::xAttr 91 bool isXYWH = attrName == SVGNames::xAttr
115 || attrName == SVGNames::yAttr 92 || attrName == SVGNames::yAttr
116 || attrName == SVGNames::widthAttr 93 || attrName == SVGNames::widthAttr
117 || attrName == SVGNames::heightAttr; 94 || attrName == SVGNames::heightAttr;
118 if (isXYWH) 95 if (isXYWH)
119 updateRelativeLengthsInformation(); 96 updateRelativeLengthsInformation();
120 else if (attrName == SVGNames::filterResAttr) 97 else if (attrName == SVGNames::filterResAttr)
121 UseCounter::count(document(), UseCounter::SVGFilterRes); 98 UseCounter::count(document(), UseCounter::SVGFilterRes);
122 99
123 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->la youtObject()); 100 if (isXYWH
124 if (renderer) 101 || attrName == SVGNames::filterResAttr
125 renderer->invalidateCacheAndMarkForLayout(); 102 || attrName == SVGNames::filterUnitsAttr
103 || attrName == SVGNames::primitiveUnitsAttr) {
104 SVGElement::InvalidationGuard invalidationGuard(this);
105 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this ->layoutObject());
106 if (renderer)
107 renderer->invalidateCacheAndMarkForLayout();
108
109 return;
110 }
111
112 SVGElement::svgAttributeChanged(attrName);
126 } 113 }
127 114
128 void SVGFilterElement::childrenChanged(const ChildrenChange& change) 115 void SVGFilterElement::childrenChanged(const ChildrenChange& change)
129 { 116 {
130 SVGElement::childrenChanged(change); 117 SVGElement::childrenChanged(change);
131 118
132 if (change.byParser) 119 if (change.byParser)
133 return; 120 return;
134 121
135 if (LayoutObject* object = layoutObject()) 122 if (LayoutObject* object = layoutObject())
(...skipping 25 matching lines...) Expand all
161 m_clientsToAdd.add(client); 148 m_clientsToAdd.add(client);
162 } 149 }
163 150
164 void SVGFilterElement::removeClient(Node* client) 151 void SVGFilterElement::removeClient(Node* client)
165 { 152 {
166 ASSERT(client); 153 ASSERT(client);
167 m_clientsToAdd.remove(client); 154 m_clientsToAdd.remove(client);
168 } 155 }
169 156
170 } // namespace blink 157 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698