OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU Library General Public License | 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 | 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, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
18 */ | 18 */ |
19 | 19 |
20 #ifndef RadialGradientAttributes_h | 20 #ifndef RadialGradientAttributes_h |
21 #define RadialGradientAttributes_h | 21 #define RadialGradientAttributes_h |
22 | 22 |
23 #include "core/svg/GradientAttributes.h" | 23 #include "core/svg/GradientAttributes.h" |
24 | 24 |
25 namespace blink { | 25 namespace blink { |
26 struct RadialGradientAttributes : GradientAttributes { | 26 struct RadialGradientAttributes final : GradientAttributes { |
| 27 DISALLOW_ALLOCATION(); |
| 28 public: |
27 RadialGradientAttributes() | 29 RadialGradientAttributes() |
28 : m_cx(SVGLength::create(LengthModeWidth)) | 30 : m_cx(SVGLength::create(LengthModeWidth)) |
29 , m_cy(SVGLength::create(LengthModeHeight)) | 31 , m_cy(SVGLength::create(LengthModeHeight)) |
30 , m_r(SVGLength::create(LengthModeOther)) | 32 , m_r(SVGLength::create(LengthModeOther)) |
31 , m_fx(SVGLength::create(LengthModeWidth)) | 33 , m_fx(SVGLength::create(LengthModeWidth)) |
32 , m_fy(SVGLength::create(LengthModeHeight)) | 34 , m_fy(SVGLength::create(LengthModeHeight)) |
33 , m_fr(SVGLength::create(LengthModeOther)) | 35 , m_fr(SVGLength::create(LengthModeOther)) |
34 , m_cxSet(false) | 36 , m_cxSet(false) |
35 , m_cySet(false) | 37 , m_cySet(false) |
36 , m_rSet(false) | 38 , m_rSet(false) |
37 , m_fxSet(false) | 39 , m_fxSet(false) |
38 , m_fySet(false) | 40 , m_fySet(false) |
39 , m_frSet(false) | 41 , m_frSet(false) |
40 { | 42 { |
41 m_cx->setValueAsString("50%", IGNORE_EXCEPTION); | 43 m_cx->setValueAsString("50%", IGNORE_EXCEPTION); |
42 m_cy->setValueAsString("50%", IGNORE_EXCEPTION); | 44 m_cy->setValueAsString("50%", IGNORE_EXCEPTION); |
43 m_r->setValueAsString("50%", IGNORE_EXCEPTION); | 45 m_r->setValueAsString("50%", IGNORE_EXCEPTION); |
44 } | 46 } |
45 | 47 |
46 SVGLength* cx() const { return m_cx.get(); } | 48 SVGLength* cx() const { return m_cx.get(); } |
47 SVGLength* cy() const { return m_cy.get(); } | 49 SVGLength* cy() const { return m_cy.get(); } |
48 SVGLength* r() const { return m_r.get(); } | 50 SVGLength* r() const { return m_r.get(); } |
49 SVGLength* fx() const { return m_fx.get(); } | 51 SVGLength* fx() const { return m_fx.get(); } |
50 SVGLength* fy() const { return m_fy.get(); } | 52 SVGLength* fy() const { return m_fy.get(); } |
51 SVGLength* fr() const { return m_fr.get(); } | 53 SVGLength* fr() const { return m_fr.get(); } |
52 | 54 |
53 void setCx(PassRefPtr<SVGLength> value) { m_cx = value; m_cxSet = true; } | 55 void setCx(PassRefPtrWillBeRawPtr<SVGLength> value) { m_cx = value; m_cxSet
= true; } |
54 void setCy(PassRefPtr<SVGLength> value) { m_cy = value; m_cySet = true; } | 56 void setCy(PassRefPtrWillBeRawPtr<SVGLength> value) { m_cy = value; m_cySet
= true; } |
55 void setR(PassRefPtr<SVGLength> value) { m_r = value; m_rSet = true; } | 57 void setR(PassRefPtrWillBeRawPtr<SVGLength> value) { m_r = value; m_rSet = t
rue; } |
56 void setFx(PassRefPtr<SVGLength> value) { m_fx = value; m_fxSet = true; } | 58 void setFx(PassRefPtrWillBeRawPtr<SVGLength> value) { m_fx = value; m_fxSet
= true; } |
57 void setFy(PassRefPtr<SVGLength> value) { m_fy = value; m_fySet = true; } | 59 void setFy(PassRefPtrWillBeRawPtr<SVGLength> value) { m_fy = value; m_fySet
= true; } |
58 void setFr(PassRefPtr<SVGLength> value) { m_fr = value; m_frSet = true; } | 60 void setFr(PassRefPtrWillBeRawPtr<SVGLength> value) { m_fr = value; m_frSet
= true; } |
59 | 61 |
60 bool hasCx() const { return m_cxSet; } | 62 bool hasCx() const { return m_cxSet; } |
61 bool hasCy() const { return m_cySet; } | 63 bool hasCy() const { return m_cySet; } |
62 bool hasR() const { return m_rSet; } | 64 bool hasR() const { return m_rSet; } |
63 bool hasFx() const { return m_fxSet; } | 65 bool hasFx() const { return m_fxSet; } |
64 bool hasFy() const { return m_fySet; } | 66 bool hasFy() const { return m_fySet; } |
65 bool hasFr() const { return m_frSet; } | 67 bool hasFr() const { return m_frSet; } |
66 | 68 |
| 69 void trace(Visitor* visitor) |
| 70 { |
| 71 visitor->trace(m_cx); |
| 72 visitor->trace(m_cy); |
| 73 visitor->trace(m_r); |
| 74 visitor->trace(m_fx); |
| 75 visitor->trace(m_fy); |
| 76 visitor->trace(m_fr); |
| 77 } |
| 78 |
67 private: | 79 private: |
68 // Properties | 80 // Properties |
69 RefPtr<SVGLength> m_cx; | 81 RefPtrWillBeMember<SVGLength> m_cx; |
70 RefPtr<SVGLength> m_cy; | 82 RefPtrWillBeMember<SVGLength> m_cy; |
71 RefPtr<SVGLength> m_r; | 83 RefPtrWillBeMember<SVGLength> m_r; |
72 RefPtr<SVGLength> m_fx; | 84 RefPtrWillBeMember<SVGLength> m_fx; |
73 RefPtr<SVGLength> m_fy; | 85 RefPtrWillBeMember<SVGLength> m_fy; |
74 RefPtr<SVGLength> m_fr; | 86 RefPtrWillBeMember<SVGLength> m_fr; |
75 | 87 |
76 // Property states | 88 // Property states |
77 bool m_cxSet : 1; | 89 bool m_cxSet : 1; |
78 bool m_cySet : 1; | 90 bool m_cySet : 1; |
79 bool m_rSet : 1; | 91 bool m_rSet : 1; |
80 bool m_fxSet : 1; | 92 bool m_fxSet : 1; |
81 bool m_fySet : 1; | 93 bool m_fySet : 1; |
82 bool m_frSet : 1; | 94 bool m_frSet : 1; |
83 }; | 95 }; |
84 | 96 |
85 } // namespace blink | 97 } // namespace blink |
86 | 98 |
87 #endif | 99 #endif |
OLD | NEW |