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

Unified Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.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/layout/svg/LayoutSVGResourceGradient.cpp
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.cpp
index ab14fac7336b273184380120771f47f2d3cf773e..2f56243e5b2d2e4451c2164c49a0ad9388cfdd61 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceGradient.cpp
@@ -76,7 +76,7 @@ SVGPaintServer LayoutSVGResourceGradient::preparePaintServer(const LayoutObject&
// Create gradient object
if (!gradientData->gradient) {
- buildGradient(gradientData.get());
+ gradientData->gradient = buildGradient();
// We want the text bounding box applied to the gradient space transform now, so the gradient shader can use it.
if (gradientUnits() == SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX && !objectBoundingBox.isEmpty()) {
@@ -84,9 +84,7 @@ SVGPaintServer LayoutSVGResourceGradient::preparePaintServer(const LayoutObject&
gradientData->userspaceTransform.scaleNonUniform(objectBoundingBox.width(), objectBoundingBox.height());
}
- AffineTransform gradientTransform;
- calculateGradientTransform(gradientTransform);
-
+ AffineTransform gradientTransform = calculateGradientTransform();
gradientData->userspaceTransform *= gradientTransform;
}
@@ -107,15 +105,13 @@ bool LayoutSVGResourceGradient::isChildAllowed(LayoutObject* child, const Comput
return toLayoutSVGResourceContainer(child)->isSVGPaintServer();
}
-void LayoutSVGResourceGradient::addStops(GradientData* gradientData, const Vector<Gradient::ColorStop>& stops) const
+void LayoutSVGResourceGradient::addStops(Gradient& gradient, const Vector<Gradient::ColorStop>& stops) const
{
- ASSERT(gradientData->gradient);
-
for (const auto& stop : stops)
- gradientData->gradient->addColorStop(stop);
+ gradient.addColorStop(stop);
}
-GradientSpreadMethod LayoutSVGResourceGradient::platformSpreadMethodFromSVGType(SVGSpreadMethodType method) const
+GradientSpreadMethod LayoutSVGResourceGradient::platformSpreadMethodFromSVGType(SVGSpreadMethodType method)
{
switch (method) {
case SVGSpreadMethodUnknown:

Powered by Google App Engine
This is Rietveld 408576698