Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / svg / RadialGradientAttributes.h
blob83a38568ff93e65506ba1f69a471fa96527e717e
1 /*
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #ifndef RadialGradientAttributes_h
21 #define RadialGradientAttributes_h
23 #include "core/svg/GradientAttributes.h"
24 #include "core/svg/SVGLength.h"
26 namespace blink {
27 struct RadialGradientAttributes final : GradientAttributes {
28 DISALLOW_ALLOCATION();
29 public:
30 RadialGradientAttributes()
31 : m_cx(SVGLength::create(SVGLengthMode::Width))
32 , m_cy(SVGLength::create(SVGLengthMode::Height))
33 , m_r(SVGLength::create(SVGLengthMode::Other))
34 , m_fx(SVGLength::create(SVGLengthMode::Width))
35 , m_fy(SVGLength::create(SVGLengthMode::Height))
36 , m_fr(SVGLength::create(SVGLengthMode::Other))
37 , m_cxSet(false)
38 , m_cySet(false)
39 , m_rSet(false)
40 , m_fxSet(false)
41 , m_fySet(false)
42 , m_frSet(false)
44 m_cx->setValueAsString("50%", IGNORE_EXCEPTION);
45 m_cy->setValueAsString("50%", IGNORE_EXCEPTION);
46 m_r->setValueAsString("50%", IGNORE_EXCEPTION);
49 SVGLength* cx() const { return m_cx.get(); }
50 SVGLength* cy() const { return m_cy.get(); }
51 SVGLength* r() const { return m_r.get(); }
52 SVGLength* fx() const { return m_fx.get(); }
53 SVGLength* fy() const { return m_fy.get(); }
54 SVGLength* fr() const { return m_fr.get(); }
56 void setCx(PassRefPtrWillBeRawPtr<SVGLength> value) { m_cx = value; m_cxSet = true; }
57 void setCy(PassRefPtrWillBeRawPtr<SVGLength> value) { m_cy = value; m_cySet = true; }
58 void setR(PassRefPtrWillBeRawPtr<SVGLength> value) { m_r = value; m_rSet = true; }
59 void setFx(PassRefPtrWillBeRawPtr<SVGLength> value) { m_fx = value; m_fxSet = true; }
60 void setFy(PassRefPtrWillBeRawPtr<SVGLength> value) { m_fy = value; m_fySet = true; }
61 void setFr(PassRefPtrWillBeRawPtr<SVGLength> value) { m_fr = value; m_frSet = true; }
63 bool hasCx() const { return m_cxSet; }
64 bool hasCy() const { return m_cySet; }
65 bool hasR() const { return m_rSet; }
66 bool hasFx() const { return m_fxSet; }
67 bool hasFy() const { return m_fySet; }
68 bool hasFr() const { return m_frSet; }
70 DEFINE_INLINE_TRACE()
72 visitor->trace(m_cx);
73 visitor->trace(m_cy);
74 visitor->trace(m_r);
75 visitor->trace(m_fx);
76 visitor->trace(m_fy);
77 visitor->trace(m_fr);
80 private:
81 // Properties
82 RefPtrWillBeMember<SVGLength> m_cx;
83 RefPtrWillBeMember<SVGLength> m_cy;
84 RefPtrWillBeMember<SVGLength> m_r;
85 RefPtrWillBeMember<SVGLength> m_fx;
86 RefPtrWillBeMember<SVGLength> m_fy;
87 RefPtrWillBeMember<SVGLength> m_fr;
89 // Property states
90 bool m_cxSet : 1;
91 bool m_cySet : 1;
92 bool m_rSet : 1;
93 bool m_fxSet : 1;
94 bool m_fySet : 1;
95 bool m_frSet : 1;
98 #if ENABLE(OILPAN)
99 // Wrapper object for the RadialGradientAttributes part object.
100 class RadialGradientAttributesWrapper : public GarbageCollectedFinalized<RadialGradientAttributesWrapper> {
101 public:
102 static RadialGradientAttributesWrapper* create()
104 return new RadialGradientAttributesWrapper;
107 RadialGradientAttributes& attributes() { return m_attributes; }
108 void set(const RadialGradientAttributes& attributes) { m_attributes = attributes; }
109 DEFINE_INLINE_TRACE() { visitor->trace(m_attributes); }
111 private:
112 RadialGradientAttributesWrapper()
116 RadialGradientAttributes m_attributes;
118 #endif
120 } // namespace blink
122 #endif