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

Side by Side Diff: Source/core/svg/SVGTextPathElement.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) 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2010 Rob Buis <rwlbuis@gmail.com> 3 * Copyright (C) 2010 Rob Buis <rwlbuis@gmail.com>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 visitor->trace(m_spacing); 75 visitor->trace(m_spacing);
76 SVGTextContentElement::trace(visitor); 76 SVGTextContentElement::trace(visitor);
77 SVGURIReference::trace(visitor); 77 SVGURIReference::trace(visitor);
78 } 78 }
79 79
80 void SVGTextPathElement::clearResourceReferences() 80 void SVGTextPathElement::clearResourceReferences()
81 { 81 {
82 removeAllOutgoingReferences(); 82 removeAllOutgoingReferences();
83 } 83 }
84 84
85 bool SVGTextPathElement::isSupportedAttribute(const QualifiedName& attrName)
86 {
87 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
88 if (supportedAttributes.isEmpty()) {
89 SVGURIReference::addSupportedAttributes(supportedAttributes);
90 supportedAttributes.add(SVGNames::startOffsetAttr);
91 supportedAttributes.add(SVGNames::methodAttr);
92 supportedAttributes.add(SVGNames::spacingAttr);
93 }
94 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
95 }
96
97 void SVGTextPathElement::svgAttributeChanged(const QualifiedName& attrName) 85 void SVGTextPathElement::svgAttributeChanged(const QualifiedName& attrName)
98 { 86 {
99 if (!isSupportedAttribute(attrName)) {
100 SVGTextContentElement::svgAttributeChanged(attrName);
101 return;
102 }
103
104 SVGElement::InvalidationGuard invalidationGuard(this);
105
106 if (SVGURIReference::isKnownAttribute(attrName)) { 87 if (SVGURIReference::isKnownAttribute(attrName)) {
88 SVGElement::InvalidationGuard invalidationGuard(this);
107 buildPendingResource(); 89 buildPendingResource();
108 return; 90 return;
109 } 91 }
110 92
111 if (attrName == SVGNames::startOffsetAttr) 93 if (attrName == SVGNames::startOffsetAttr)
112 updateRelativeLengthsInformation(); 94 updateRelativeLengthsInformation();
113 95
114 if (LayoutObject* object = layoutObject()) 96 if (attrName == SVGNames::startOffsetAttr
115 markForLayoutAndParentResourceInvalidation(object); 97 || attrName == SVGNames::methodAttr
98 || attrName == SVGNames::spacingAttr) {
99 SVGElement::InvalidationGuard invalidationGuard(this);
100 if (LayoutObject* object = layoutObject())
101 markForLayoutAndParentResourceInvalidation(object);
102
103 return;
104 }
105
106 SVGTextContentElement::svgAttributeChanged(attrName);
116 } 107 }
117 108
118 LayoutObject* SVGTextPathElement::createLayoutObject(const ComputedStyle&) 109 LayoutObject* SVGTextPathElement::createLayoutObject(const ComputedStyle&)
119 { 110 {
120 return new LayoutSVGTextPath(this); 111 return new LayoutSVGTextPath(this);
121 } 112 }
122 113
123 bool SVGTextPathElement::layoutObjectIsNeeded(const ComputedStyle& style) 114 bool SVGTextPathElement::layoutObjectIsNeeded(const ComputedStyle& style)
124 { 115 {
125 if (parentNode() && (isSVGAElement(*parentNode()) || isSVGTextElement(*paren tNode()))) 116 if (parentNode() && (isSVGAElement(*parentNode()) || isSVGTextElement(*paren tNode())))
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 clearResourceReferences(); 157 clearResourceReferences();
167 } 158 }
168 159
169 bool SVGTextPathElement::selfHasRelativeLengths() const 160 bool SVGTextPathElement::selfHasRelativeLengths() const
170 { 161 {
171 return m_startOffset->currentValue()->isRelative() 162 return m_startOffset->currentValue()->isRelative()
172 || SVGTextContentElement::selfHasRelativeLengths(); 163 || SVGTextContentElement::selfHasRelativeLengths();
173 } 164 }
174 165
175 } // namespace blink 166 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698