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

Unified Diff: third_party/WebKit/Source/core/svg/SVGGradientElement.cpp

Issue 2031053004: Reduce LayoutSVGResource*Gradient building dependency on GradientData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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: third_party/WebKit/Source/core/svg/SVGGradientElement.cpp
diff --git a/third_party/WebKit/Source/core/svg/SVGGradientElement.cpp b/third_party/WebKit/Source/core/svg/SVGGradientElement.cpp
index c91eac607f58feb062cc4fd0c08b3f66b3f08afb..30eaaaa17ce3fb3d6585d30007a7955527a63414 100644
--- a/third_party/WebKit/Source/core/svg/SVGGradientElement.cpp
+++ b/third_party/WebKit/Source/core/svg/SVGGradientElement.cpp
@@ -96,15 +96,14 @@ Vector<Gradient::ColorStop> SVGGradientElement::buildStops()
Vector<Gradient::ColorStop> stops;
float previousOffset = 0.0f;
- for (SVGStopElement* stop = Traversal<SVGStopElement>::firstChild(*this); stop; stop = Traversal<SVGStopElement>::nextSibling(*stop)) {
- // Figure out right monotonic offset
- float offset = stop->offset()->currentValue()->value();
+ for (const SVGStopElement& stop : Traversal<SVGStopElement>::childrenOf(*this)) {
+ // Figure out right monotonic offset.
+ float offset = stop.offset()->currentValue()->value();
offset = std::min(std::max(previousOffset, offset), 1.0f);
previousOffset = offset;
- stops.append(Gradient::ColorStop(offset, stop->stopColorIncludingOpacity()));
+ stops.append(Gradient::ColorStop(offset, stop.stopColorIncludingOpacity()));
}
-
return stops;
}

Powered by Google App Engine
This is Rietveld 408576698