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

Side by Side Diff: Source/core/svg/SVGLinearGradientElement.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 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2008 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 { 50 {
51 visitor->trace(m_x1); 51 visitor->trace(m_x1);
52 visitor->trace(m_y1); 52 visitor->trace(m_y1);
53 visitor->trace(m_x2); 53 visitor->trace(m_x2);
54 visitor->trace(m_y2); 54 visitor->trace(m_y2);
55 SVGGradientElement::trace(visitor); 55 SVGGradientElement::trace(visitor);
56 } 56 }
57 57
58 DEFINE_NODE_FACTORY(SVGLinearGradientElement) 58 DEFINE_NODE_FACTORY(SVGLinearGradientElement)
59 59
60 bool SVGLinearGradientElement::isSupportedAttribute(const QualifiedName& attrNam e)
61 {
62 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ());
63 if (supportedAttributes.isEmpty()) {
64 supportedAttributes.add(SVGNames::x1Attr);
65 supportedAttributes.add(SVGNames::x2Attr);
66 supportedAttributes.add(SVGNames::y1Attr);
67 supportedAttributes.add(SVGNames::y2Attr);
68 }
69 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName);
70 }
71
72 void SVGLinearGradientElement::svgAttributeChanged(const QualifiedName& attrName ) 60 void SVGLinearGradientElement::svgAttributeChanged(const QualifiedName& attrName )
73 { 61 {
74 if (!isSupportedAttribute(attrName)) { 62 if (attrName == SVGNames::x1Attr || attrName == SVGNames::x2Attr
75 SVGGradientElement::svgAttributeChanged(attrName); 63 || attrName == SVGNames::y1Attr || attrName == SVGNames::y2Attr) {
64 SVGElement::InvalidationGuard invalidationGuard(this);
65
66 updateRelativeLengthsInformation();
67
68 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this ->layoutObject());
69 if (renderer)
70 renderer->invalidateCacheAndMarkForLayout();
71
76 return; 72 return;
77 } 73 }
78 74
79 SVGElement::InvalidationGuard invalidationGuard(this); 75 SVGGradientElement::svgAttributeChanged(attrName);
80
81 updateRelativeLengthsInformation();
82
83 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->la youtObject());
84 if (renderer)
85 renderer->invalidateCacheAndMarkForLayout();
86 } 76 }
87 77
88 LayoutObject* SVGLinearGradientElement::createLayoutObject(const ComputedStyle&) 78 LayoutObject* SVGLinearGradientElement::createLayoutObject(const ComputedStyle&)
89 { 79 {
90 return new LayoutSVGResourceLinearGradient(this); 80 return new LayoutSVGResourceLinearGradient(this);
91 } 81 }
92 82
93 static void setGradientAttributes(SVGGradientElement* element, LinearGradientAtt ributes& attributes, bool isLinear = true) 83 static void setGradientAttributes(SVGGradientElement* element, LinearGradientAtt ributes& attributes, bool isLinear = true)
94 { 84 {
95 if (!attributes.hasSpreadMethod() && element->spreadMethod()->isSpecified()) 85 if (!attributes.hasSpreadMethod() && element->spreadMethod()->isSpecified())
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 154
165 bool SVGLinearGradientElement::selfHasRelativeLengths() const 155 bool SVGLinearGradientElement::selfHasRelativeLengths() const
166 { 156 {
167 return m_x1->currentValue()->isRelative() 157 return m_x1->currentValue()->isRelative()
168 || m_y1->currentValue()->isRelative() 158 || m_y1->currentValue()->isRelative()
169 || m_x2->currentValue()->isRelative() 159 || m_x2->currentValue()->isRelative()
170 || m_y2->currentValue()->isRelative(); 160 || m_y2->currentValue()->isRelative();
171 } 161 }
172 162
173 } // namespace blink 163 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698