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

Side by Side Diff: Source/core/svg/SVGLineElement.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, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 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 * 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 { 43 {
44 visitor->trace(m_x1); 44 visitor->trace(m_x1);
45 visitor->trace(m_y1); 45 visitor->trace(m_y1);
46 visitor->trace(m_x2); 46 visitor->trace(m_x2);
47 visitor->trace(m_y2); 47 visitor->trace(m_y2);
48 SVGGeometryElement::trace(visitor); 48 SVGGeometryElement::trace(visitor);
49 } 49 }
50 50
51 DEFINE_NODE_FACTORY(SVGLineElement) 51 DEFINE_NODE_FACTORY(SVGLineElement)
52 52
53 bool SVGLineElement::isSupportedAttribute(const QualifiedName& attrName)
54 {
55 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
56 if (supportedAttributes.isEmpty()) {
57 supportedAttributes.add(SVGNames::x1Attr);
58 supportedAttributes.add(SVGNames::x2Attr);
59 supportedAttributes.add(SVGNames::y1Attr);
60 supportedAttributes.add(SVGNames::y2Attr);
61 }
62 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
63 }
64
65 void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName) 53 void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName)
66 { 54 {
67 if (!isSupportedAttribute(attrName)) { 55 if (attrName == SVGNames::x1Attr
68 SVGGeometryElement::svgAttributeChanged(attrName); 56 || attrName == SVGNames::y1Attr
69 return; 57 || attrName == SVGNames::x2Attr
70 } 58 || attrName == SVGNames::y2Attr) {
71
72 SVGElement::InvalidationGuard invalidationGuard(this);
73
74 bool isLengthAttribute = attrName == SVGNames::x1Attr
75 || attrName == SVGNames::y1Attr
76 || attrName == SVGNames::x2Attr
77 || attrName == SVGNames::y2Attr;
78
79 if (isLengthAttribute)
80 updateRelativeLengthsInformation(); 59 updateRelativeLengthsInformation();
81 60
82 LayoutSVGShape* renderer = toLayoutSVGShape(this->layoutObject()); 61 LayoutSVGShape* renderer = toLayoutSVGShape(this->layoutObject());
83 if (!renderer) 62 if (!renderer)
84 return; 63 return;
85 64
86 if (isLengthAttribute) { 65 SVGElement::InvalidationGuard invalidationGuard(this);
87 renderer->setNeedsShapeUpdate(); 66 renderer->setNeedsShapeUpdate();
88 markForLayoutAndParentResourceInvalidation(renderer); 67 markForLayoutAndParentResourceInvalidation(renderer);
89 return; 68 return;
90 } 69 }
91 70
92 ASSERT_NOT_REACHED(); 71 SVGGeometryElement::svgAttributeChanged(attrName);
93 } 72 }
94 73
95 bool SVGLineElement::selfHasRelativeLengths() const 74 bool SVGLineElement::selfHasRelativeLengths() const
96 { 75 {
97 return m_x1->currentValue()->isRelative() 76 return m_x1->currentValue()->isRelative()
98 || m_y1->currentValue()->isRelative() 77 || m_y1->currentValue()->isRelative()
99 || m_x2->currentValue()->isRelative() 78 || m_x2->currentValue()->isRelative()
100 || m_y2->currentValue()->isRelative(); 79 || m_y2->currentValue()->isRelative();
101 } 80 }
102 81
103 } // namespace blink 82 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698