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 WebCore { | 25 namespace WebCore { |
26 struct RadialGradientAttributes : GradientAttributes { | 26 struct RadialGradientAttributes : GradientAttributes { |
27 RadialGradientAttributes() | 27 RadialGradientAttributes() |
28 : m_cx(LengthModeWidth, "50%") | 28 : m_cx(SVGLength::create(LengthModeWidth)) |
29 , m_cy(LengthModeWidth, "50%") | 29 , m_cy(SVGLength::create(LengthModeHeight)) |
30 , m_r(LengthModeWidth, "50%") | 30 , m_r(SVGLength::create(LengthModeOther)) |
| 31 , m_fx(SVGLength::create(LengthModeWidth)) |
| 32 , m_fy(SVGLength::create(LengthModeHeight)) |
| 33 , m_fr(SVGLength::create(LengthModeOther)) |
31 , m_cxSet(false) | 34 , m_cxSet(false) |
32 , m_cySet(false) | 35 , m_cySet(false) |
33 , m_rSet(false) | 36 , m_rSet(false) |
34 , m_fxSet(false) | 37 , m_fxSet(false) |
35 , m_fySet(false) | 38 , m_fySet(false) |
36 , m_frSet(false) | 39 , m_frSet(false) |
37 { | 40 { |
| 41 m_cx->setValueAsString("50%", IGNORE_EXCEPTION); |
| 42 m_cy->setValueAsString("50%", IGNORE_EXCEPTION); |
| 43 m_r->setValueAsString("50%", IGNORE_EXCEPTION); |
38 } | 44 } |
39 | 45 |
40 SVGLength cx() const { return m_cx; } | 46 SVGLength* cx() const { return m_cx.get(); } |
41 SVGLength cy() const { return m_cy; } | 47 SVGLength* cy() const { return m_cy.get(); } |
42 SVGLength r() const { return m_r; } | 48 SVGLength* r() const { return m_r.get(); } |
43 SVGLength fx() const { return m_fx; } | 49 SVGLength* fx() const { return m_fx.get(); } |
44 SVGLength fy() const { return m_fy; } | 50 SVGLength* fy() const { return m_fy.get(); } |
45 SVGLength fr() const { return m_fr; } | 51 SVGLength* fr() const { return m_fr.get(); } |
46 | 52 |
47 void setCx(const SVGLength& value) { m_cx = value; m_cxSet = true; } | 53 void setCx(PassRefPtr<SVGLength> value) { m_cx = value; m_cxSet = true; } |
48 void setCy(const SVGLength& value) { m_cy = value; m_cySet = true; } | 54 void setCy(PassRefPtr<SVGLength> value) { m_cy = value; m_cySet = true; } |
49 void setR(const SVGLength& value) { m_r = value; m_rSet = true; } | 55 void setR(PassRefPtr<SVGLength> value) { m_r = value; m_rSet = true; } |
50 void setFx(const SVGLength& value) { m_fx = value; m_fxSet = true; } | 56 void setFx(PassRefPtr<SVGLength> value) { m_fx = value; m_fxSet = true; } |
51 void setFy(const SVGLength& value) { m_fy = value; m_fySet = true; } | 57 void setFy(PassRefPtr<SVGLength> value) { m_fy = value; m_fySet = true; } |
52 void setFr(const SVGLength& value) { m_fr = value; m_frSet = true; } | 58 void setFr(PassRefPtr<SVGLength> value) { m_fr = value; m_frSet = true; } |
53 | 59 |
54 bool hasCx() const { return m_cxSet; } | 60 bool hasCx() const { return m_cxSet; } |
55 bool hasCy() const { return m_cySet; } | 61 bool hasCy() const { return m_cySet; } |
56 bool hasR() const { return m_rSet; } | 62 bool hasR() const { return m_rSet; } |
57 bool hasFx() const { return m_fxSet; } | 63 bool hasFx() const { return m_fxSet; } |
58 bool hasFy() const { return m_fySet; } | 64 bool hasFy() const { return m_fySet; } |
59 bool hasFr() const { return m_frSet; } | 65 bool hasFr() const { return m_frSet; } |
60 | 66 |
61 private: | 67 private: |
62 // Properties | 68 // Properties |
63 SVGLength m_cx; | 69 RefPtr<SVGLength> m_cx; |
64 SVGLength m_cy; | 70 RefPtr<SVGLength> m_cy; |
65 SVGLength m_r; | 71 RefPtr<SVGLength> m_r; |
66 SVGLength m_fx; | 72 RefPtr<SVGLength> m_fx; |
67 SVGLength m_fy; | 73 RefPtr<SVGLength> m_fy; |
68 SVGLength m_fr; | 74 RefPtr<SVGLength> m_fr; |
69 | 75 |
70 // Property states | 76 // Property states |
71 bool m_cxSet : 1; | 77 bool m_cxSet : 1; |
72 bool m_cySet : 1; | 78 bool m_cySet : 1; |
73 bool m_rSet : 1; | 79 bool m_rSet : 1; |
74 bool m_fxSet : 1; | 80 bool m_fxSet : 1; |
75 bool m_fySet : 1; | 81 bool m_fySet : 1; |
76 bool m_frSet : 1; | 82 bool m_frSet : 1; |
77 }; | 83 }; |
78 | 84 |
79 } // namespace WebCore | 85 } // namespace WebCore |
80 | 86 |
81 #endif | 87 #endif |
OLD | NEW |