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

Side by Side Diff: third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceLinearGradient.cpp

Issue 2749593002: Remove argument to LayoutSVGResourceGradient::collectGradientAttributes (Closed)
Patch Set: Rebase Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 3 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
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 13 matching lines...) Expand all
24 24
25 namespace blink { 25 namespace blink {
26 26
27 LayoutSVGResourceLinearGradient::LayoutSVGResourceLinearGradient( 27 LayoutSVGResourceLinearGradient::LayoutSVGResourceLinearGradient(
28 SVGLinearGradientElement* node) 28 SVGLinearGradientElement* node)
29 : LayoutSVGResourceGradient(node), 29 : LayoutSVGResourceGradient(node),
30 m_attributesWrapper(LinearGradientAttributesWrapper::create()) {} 30 m_attributesWrapper(LinearGradientAttributesWrapper::create()) {}
31 31
32 LayoutSVGResourceLinearGradient::~LayoutSVGResourceLinearGradient() {} 32 LayoutSVGResourceLinearGradient::~LayoutSVGResourceLinearGradient() {}
33 33
34 bool LayoutSVGResourceLinearGradient::collectGradientAttributes( 34 bool LayoutSVGResourceLinearGradient::collectGradientAttributes() {
35 SVGGradientElement* gradientElement) { 35 DCHECK(element());
36 m_attributesWrapper->set(LinearGradientAttributes()); 36 m_attributesWrapper->set(LinearGradientAttributes());
37 return toSVGLinearGradientElement(gradientElement) 37 return toSVGLinearGradientElement(element())->collectGradientAttributes(
38 ->collectGradientAttributes(mutableAttributes()); 38 mutableAttributes());
39 } 39 }
40 40
41 FloatPoint LayoutSVGResourceLinearGradient::startPoint( 41 FloatPoint LayoutSVGResourceLinearGradient::startPoint(
42 const LinearGradientAttributes& attributes) const { 42 const LinearGradientAttributes& attributes) const {
43 return SVGLengthContext::resolvePoint(element(), attributes.gradientUnits(), 43 return SVGLengthContext::resolvePoint(element(), attributes.gradientUnits(),
44 *attributes.x1(), *attributes.y1()); 44 *attributes.x1(), *attributes.y1());
45 } 45 }
46 46
47 FloatPoint LayoutSVGResourceLinearGradient::endPoint( 47 FloatPoint LayoutSVGResourceLinearGradient::endPoint(
48 const LinearGradientAttributes& attributes) const { 48 const LinearGradientAttributes& attributes) const {
49 return SVGLengthContext::resolvePoint(element(), attributes.gradientUnits(), 49 return SVGLengthContext::resolvePoint(element(), attributes.gradientUnits(),
50 *attributes.x2(), *attributes.y2()); 50 *attributes.x2(), *attributes.y2());
51 } 51 }
52 52
53 PassRefPtr<Gradient> LayoutSVGResourceLinearGradient::buildGradient() const { 53 PassRefPtr<Gradient> LayoutSVGResourceLinearGradient::buildGradient() const {
54 const LinearGradientAttributes& attributes = this->attributes(); 54 const LinearGradientAttributes& attributes = this->attributes();
55 RefPtr<Gradient> gradient = 55 RefPtr<Gradient> gradient =
56 Gradient::create(startPoint(attributes), endPoint(attributes)); 56 Gradient::create(startPoint(attributes), endPoint(attributes));
57 gradient->setSpreadMethod( 57 gradient->setSpreadMethod(
58 platformSpreadMethodFromSVGType(attributes.spreadMethod())); 58 platformSpreadMethodFromSVGType(attributes.spreadMethod()));
59 gradient->addColorStops(attributes.stops()); 59 gradient->addColorStops(attributes.stops());
60 return gradient.release(); 60 return gradient.release();
61 } 61 }
62 62
63 } // namespace blink 63 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698