Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / Source / core / layout / svg / LayoutSVGResourceLinearGradient.h
blob81cb59a65c271d9409b678cc5a748397fe9de439
1 /*
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #ifndef LayoutSVGResourceLinearGradient_h
22 #define LayoutSVGResourceLinearGradient_h
24 #include "core/layout/svg/LayoutSVGResourceGradient.h"
25 #include "core/svg/LinearGradientAttributes.h"
27 namespace blink {
29 class SVGLinearGradientElement;
31 class LayoutSVGResourceLinearGradient final : public LayoutSVGResourceGradient {
32 public:
33 explicit LayoutSVGResourceLinearGradient(SVGLinearGradientElement*);
34 ~LayoutSVGResourceLinearGradient() override;
36 const char* name() const override { return "LayoutSVGResourceLinearGradient"; }
38 static const LayoutSVGResourceType s_resourceType = LinearGradientResourceType;
39 LayoutSVGResourceType resourceType() const override { return s_resourceType; }
41 SVGUnitTypes::SVGUnitType gradientUnits() const override { return attributes().gradientUnits(); }
42 void calculateGradientTransform(AffineTransform& transform) override { transform = attributes().gradientTransform(); }
43 bool collectGradientAttributes(SVGGradientElement*) override;
44 void buildGradient(GradientData*) const override;
46 FloatPoint startPoint(const LinearGradientAttributes&) const;
47 FloatPoint endPoint(const LinearGradientAttributes&) const;
49 private:
50 #if ENABLE(OILPAN)
51 Persistent<LinearGradientAttributesWrapper> m_attributesWrapper;
53 LinearGradientAttributes& mutableAttributes() { return m_attributesWrapper->attributes(); }
54 const LinearGradientAttributes& attributes() const { return m_attributesWrapper->attributes(); }
55 #else
56 LinearGradientAttributes m_attributes;
58 LinearGradientAttributes& mutableAttributes() { return m_attributes; }
59 const LinearGradientAttributes& attributes() const { return m_attributes; }
60 #endif
63 } // namespace blink
65 #endif // LayoutSVGResourceLinearGradient_h