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

Unified Diff: Source/core/svg/SVGTextContentElement.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 side-by-side diff with in-line comments
Download patch
Index: Source/core/svg/SVGTextContentElement.cpp
diff --git a/Source/core/svg/SVGTextContentElement.cpp b/Source/core/svg/SVGTextContentElement.cpp
index 9674d921c1004d8ea61f2b77e43ef7d26ea9073c..feeda7f9af4927361a487652239e88b2540c7c2e 100644
--- a/Source/core/svg/SVGTextContentElement.cpp
+++ b/Source/core/svg/SVGTextContentElement.cpp
@@ -200,17 +200,6 @@ void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, E
document().frame()->selection().setSelection(VisibleSelection(start, end));
}
-bool SVGTextContentElement::isSupportedAttribute(const QualifiedName& attrName)
-{
- DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
- if (supportedAttributes.isEmpty()) {
- supportedAttributes.add(SVGNames::lengthAdjustAttr);
- supportedAttributes.add(SVGNames::textLengthAttr);
- supportedAttributes.add(XMLNames::spaceAttr);
- }
- return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
-}
-
bool SVGTextContentElement::isPresentationAttribute(const QualifiedName& name) const
{
if (name.matches(XMLNames::spaceAttr))
@@ -220,9 +209,7 @@ bool SVGTextContentElement::isPresentationAttribute(const QualifiedName& name) c
void SVGTextContentElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
{
- if (!isSupportedAttribute(name))
- SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, style);
- else if (name.matches(XMLNames::spaceAttr)) {
+ if (name.matches(XMLNames::spaceAttr)) {
DEFINE_STATIC_LOCAL(const AtomicString, preserveString, ("preserve", AtomicString::ConstructFromLiteral));
if (value == preserveString) {
@@ -232,23 +219,28 @@ void SVGTextContentElement::collectStyleForPresentationAttribute(const Qualified
UseCounter::count(document(), UseCounter::WhiteSpaceNowrapFromXMLSpace);
addPropertyToPresentationAttributeStyle(style, CSSPropertyWhiteSpace, CSSValueNowrap);
}
+ } else {
+ SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, style);
}
}
void SVGTextContentElement::svgAttributeChanged(const QualifiedName& attrName)
{
- if (!isSupportedAttribute(attrName)) {
- SVGGraphicsElement::svgAttributeChanged(attrName);
- return;
- }
-
if (attrName == SVGNames::textLengthAttr)
m_textLengthIsSpecifiedByUser = true;
- SVGElement::InvalidationGuard invalidationGuard(this);
+ if (attrName == SVGNames::textLengthAttr
+ || attrName == SVGNames::lengthAdjustAttr
+ || attrName == XMLNames::spaceAttr) {
+ SVGElement::InvalidationGuard invalidationGuard(this);
+
+ if (LayoutObject* renderer = this->layoutObject())
+ markForLayoutAndParentResourceInvalidation(renderer);
+
+ return;
+ }
- if (LayoutObject* renderer = this->layoutObject())
- markForLayoutAndParentResourceInvalidation(renderer);
+ SVGGraphicsElement::svgAttributeChanged(attrName);
}
bool SVGTextContentElement::selfHasRelativeLengths() const

Powered by Google App Engine
This is Rietveld 408576698