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

Side by Side Diff: Source/core/svg/SVGTextPositioningElement.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, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Rob Buis <buis@kde.org>
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 DEFINE_TRACE(SVGTextPositioningElement) 47 DEFINE_TRACE(SVGTextPositioningElement)
48 { 48 {
49 visitor->trace(m_x); 49 visitor->trace(m_x);
50 visitor->trace(m_y); 50 visitor->trace(m_y);
51 visitor->trace(m_dx); 51 visitor->trace(m_dx);
52 visitor->trace(m_dy); 52 visitor->trace(m_dy);
53 visitor->trace(m_rotate); 53 visitor->trace(m_rotate);
54 SVGTextContentElement::trace(visitor); 54 SVGTextContentElement::trace(visitor);
55 } 55 }
56 56
57 bool SVGTextPositioningElement::isSupportedAttribute(const QualifiedName& attrNa me)
58 {
59 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
60 if (supportedAttributes.isEmpty()) {
61 supportedAttributes.add(SVGNames::xAttr);
62 supportedAttributes.add(SVGNames::yAttr);
63 supportedAttributes.add(SVGNames::dxAttr);
64 supportedAttributes.add(SVGNames::dyAttr);
65 supportedAttributes.add(SVGNames::rotateAttr);
66 }
67 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
68 }
69
70 void SVGTextPositioningElement::svgAttributeChanged(const QualifiedName& attrNam e) 57 void SVGTextPositioningElement::svgAttributeChanged(const QualifiedName& attrNam e)
71 { 58 {
72 if (!isSupportedAttribute(attrName)) {
73 SVGTextContentElement::svgAttributeChanged(attrName);
74 return;
75 }
76
77 SVGElement::InvalidationGuard invalidationGuard(this);
78
79 bool updateRelativeLengths = attrName == SVGNames::xAttr 59 bool updateRelativeLengths = attrName == SVGNames::xAttr
80 || attrName == SVGNames::yAttr 60 || attrName == SVGNames::yAttr
81 || attrName == SVGNames::dxAttr 61 || attrName == SVGNames::dxAttr
82 || attrName == SVGNames::dyAttr; 62 || attrName == SVGNames::dyAttr;
83 63
84 if (updateRelativeLengths) 64 if (updateRelativeLengths)
85 updateRelativeLengthsInformation(); 65 updateRelativeLengthsInformation();
86 66
87 LayoutObject* renderer = this->layoutObject(); 67 if (updateRelativeLengths || attrName == SVGNames::rotateAttr) {
88 if (!renderer) 68 SVGElement::InvalidationGuard invalidationGuard(this);
69
70 LayoutObject* renderer = this->layoutObject();
71 if (!renderer)
72 return;
73
74 if (LayoutSVGText* textRenderer = LayoutSVGText::locateLayoutSVGTextAnce stor(renderer))
75 textRenderer->setNeedsPositioningValuesUpdate();
76 markForLayoutAndParentResourceInvalidation(renderer);
77
fs 2015/04/10 14:25:24 Drop.
Erik Dahlström (inactive) 2015/04/10 15:33:44 Done.
89 return; 78 return;
79 }
90 80
91 ASSERT(updateRelativeLengths || attrName == SVGNames::rotateAttr); 81 SVGTextContentElement::svgAttributeChanged(attrName);
92
93 if (LayoutSVGText* textRenderer = LayoutSVGText::locateLayoutSVGTextAncestor (renderer))
94 textRenderer->setNeedsPositioningValuesUpdate();
95 markForLayoutAndParentResourceInvalidation(renderer);
96 } 82 }
97 83
98 SVGTextPositioningElement* SVGTextPositioningElement::elementFromRenderer(Layout Object& renderer) 84 SVGTextPositioningElement* SVGTextPositioningElement::elementFromRenderer(Layout Object& renderer)
99 { 85 {
100 if (!renderer.isSVGText() && !renderer.isSVGInline()) 86 if (!renderer.isSVGText() && !renderer.isSVGInline())
101 return 0; 87 return 0;
102 88
103 Node* node = renderer.node(); 89 Node* node = renderer.node();
104 ASSERT(node); 90 ASSERT(node);
105 ASSERT(node->isSVGElement()); 91 ASSERT(node->isSVGElement());
106 92
107 return isSVGTextPositioningElement(*node) ? toSVGTextPositioningElement(node ) : 0; 93 return isSVGTextPositioningElement(*node) ? toSVGTextPositioningElement(node ) : 0;
108 } 94 }
109 95
110 } 96 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698