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

Side by Side Diff: Source/core/svg/SVGLinearGradientElement.cpp

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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
« no previous file with comments | « Source/core/svg/SVGLineElement.cpp ('k') | Source/core/svg/SVGMarkerElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 { 78 {
79 if (!isSupportedAttribute(attrName)) { 79 if (!isSupportedAttribute(attrName)) {
80 SVGGradientElement::svgAttributeChanged(attrName); 80 SVGGradientElement::svgAttributeChanged(attrName);
81 return; 81 return;
82 } 82 }
83 83
84 SVGElement::InvalidationGuard invalidationGuard(this); 84 SVGElement::InvalidationGuard invalidationGuard(this);
85 85
86 updateRelativeLengthsInformation(); 86 updateRelativeLengthsInformation();
87 87
88 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->re nderer()); 88 LayoutSVGResourceContainer* renderer = toLayoutSVGResourceContainer(this->la youtObject());
89 if (renderer) 89 if (renderer)
90 renderer->invalidateCacheAndMarkForLayout(); 90 renderer->invalidateCacheAndMarkForLayout();
91 } 91 }
92 92
93 LayoutObject* SVGLinearGradientElement::createLayoutObject(const LayoutStyle&) 93 LayoutObject* SVGLinearGradientElement::createLayoutObject(const LayoutStyle&)
94 { 94 {
95 return new LayoutSVGResourceLinearGradient(this); 95 return new LayoutSVGResourceLinearGradient(this);
96 } 96 }
97 97
98 static void setGradientAttributes(SVGGradientElement* element, LinearGradientAtt ributes& attributes, bool isLinear = true) 98 static void setGradientAttributes(SVGGradientElement* element, LinearGradientAtt ributes& attributes, bool isLinear = true)
(...skipping 28 matching lines...) Expand all
127 if (!attributes.hasX2() && linear->x2()->isSpecified()) 127 if (!attributes.hasX2() && linear->x2()->isSpecified())
128 attributes.setX2(linear->x2()->currentValue()); 128 attributes.setX2(linear->x2()->currentValue());
129 129
130 if (!attributes.hasY2() && linear->y2()->isSpecified()) 130 if (!attributes.hasY2() && linear->y2()->isSpecified())
131 attributes.setY2(linear->y2()->currentValue()); 131 attributes.setY2(linear->y2()->currentValue());
132 } 132 }
133 } 133 }
134 134
135 bool SVGLinearGradientElement::collectGradientAttributes(LinearGradientAttribute s& attributes) 135 bool SVGLinearGradientElement::collectGradientAttributes(LinearGradientAttribute s& attributes)
136 { 136 {
137 if (!renderer()) 137 if (!layoutObject())
138 return false; 138 return false;
139 139
140 WillBeHeapHashSet<RawPtrWillBeMember<SVGGradientElement>> processedGradients ; 140 WillBeHeapHashSet<RawPtrWillBeMember<SVGGradientElement>> processedGradients ;
141 SVGGradientElement* current = this; 141 SVGGradientElement* current = this;
142 142
143 setGradientAttributes(current, attributes); 143 setGradientAttributes(current, attributes);
144 processedGradients.add(current); 144 processedGradients.add(current);
145 145
146 while (true) { 146 while (true) {
147 // Respect xlink:href, take attributes from referenced element 147 // Respect xlink:href, take attributes from referenced element
148 Node* refNode = SVGURIReference::targetElementFromIRIString(current->hre f()->currentValue()->value(), treeScope()); 148 Node* refNode = SVGURIReference::targetElementFromIRIString(current->hre f()->currentValue()->value(), treeScope());
149 if (refNode && isSVGGradientElement(*refNode)) { 149 if (refNode && isSVGGradientElement(*refNode)) {
150 current = toSVGGradientElement(refNode); 150 current = toSVGGradientElement(refNode);
151 151
152 // Cycle detection 152 // Cycle detection
153 if (processedGradients.contains(current)) 153 if (processedGradients.contains(current))
154 return true; 154 return true;
155 155
156 if (!current->renderer()) 156 if (!current->layoutObject())
157 return false; 157 return false;
158 158
159 setGradientAttributes(current, attributes, isSVGLinearGradientElemen t(*current)); 159 setGradientAttributes(current, attributes, isSVGLinearGradientElemen t(*current));
160 processedGradients.add(current); 160 processedGradients.add(current);
161 } else { 161 } else {
162 return true; 162 return true;
163 } 163 }
164 } 164 }
165 165
166 ASSERT_NOT_REACHED(); 166 ASSERT_NOT_REACHED();
167 return false; 167 return false;
168 } 168 }
169 169
170 bool SVGLinearGradientElement::selfHasRelativeLengths() const 170 bool SVGLinearGradientElement::selfHasRelativeLengths() const
171 { 171 {
172 return m_x1->currentValue()->isRelative() 172 return m_x1->currentValue()->isRelative()
173 || m_y1->currentValue()->isRelative() 173 || m_y1->currentValue()->isRelative()
174 || m_x2->currentValue()->isRelative() 174 || m_x2->currentValue()->isRelative()
175 || m_y2->currentValue()->isRelative(); 175 || m_y2->currentValue()->isRelative();
176 } 176 }
177 177
178 } // namespace blink 178 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/svg/SVGLineElement.cpp ('k') | Source/core/svg/SVGMarkerElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698