| 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 LinearGradientAttributes_h | 20 #ifndef LinearGradientAttributes_h |
| 21 #define LinearGradientAttributes_h | 21 #define LinearGradientAttributes_h |
| 22 | 22 |
| 23 #include "core/svg/GradientAttributes.h" | 23 #include "core/svg/GradientAttributes.h" |
| 24 #include "platform/heap/Handle.h" |
| 24 | 25 |
| 25 namespace blink { | 26 namespace blink { |
| 27 |
| 26 struct LinearGradientAttributes : GradientAttributes { | 28 struct LinearGradientAttributes : GradientAttributes { |
| 29 DISALLOW_ALLOCATION(); |
| 30 public: |
| 27 LinearGradientAttributes() | 31 LinearGradientAttributes() |
| 28 : m_x1(SVGLength::create(LengthModeWidth)) | 32 : m_x1(SVGLength::create(LengthModeWidth)) |
| 29 , m_y1(SVGLength::create(LengthModeWidth)) | 33 , m_y1(SVGLength::create(LengthModeWidth)) |
| 30 , m_x2(SVGLength::create(LengthModeWidth)) | 34 , m_x2(SVGLength::create(LengthModeWidth)) |
| 31 , m_y2(SVGLength::create(LengthModeWidth)) | 35 , m_y2(SVGLength::create(LengthModeWidth)) |
| 32 , m_x1Set(false) | 36 , m_x1Set(false) |
| 33 , m_y1Set(false) | 37 , m_y1Set(false) |
| 34 , m_x2Set(false) | 38 , m_x2Set(false) |
| 35 , m_y2Set(false) | 39 , m_y2Set(false) |
| 36 { | 40 { |
| 37 m_x2->setValueAsString("100%", ASSERT_NO_EXCEPTION); | 41 m_x2->setValueAsString("100%", ASSERT_NO_EXCEPTION); |
| 38 } | 42 } |
| 39 | 43 |
| 40 SVGLength* x1() const { return m_x1.get(); } | 44 SVGLength* x1() const { return m_x1.get(); } |
| 41 SVGLength* y1() const { return m_y1.get(); } | 45 SVGLength* y1() const { return m_y1.get(); } |
| 42 SVGLength* x2() const { return m_x2.get(); } | 46 SVGLength* x2() const { return m_x2.get(); } |
| 43 SVGLength* y2() const { return m_y2.get(); } | 47 SVGLength* y2() const { return m_y2.get(); } |
| 44 | 48 |
| 45 void setX1(PassRefPtr<SVGLength> value) { m_x1 = value; m_x1Set = true; } | 49 void setX1(PassRefPtrWillBeRawPtr<SVGLength> value) { m_x1 = value; m_x1Set
= true; } |
| 46 void setY1(PassRefPtr<SVGLength> value) { m_y1 = value; m_y1Set = true; } | 50 void setY1(PassRefPtrWillBeRawPtr<SVGLength> value) { m_y1 = value; m_y1Set
= true; } |
| 47 void setX2(PassRefPtr<SVGLength> value) { m_x2 = value; m_x2Set = true; } | 51 void setX2(PassRefPtrWillBeRawPtr<SVGLength> value) { m_x2 = value; m_x2Set
= true; } |
| 48 void setY2(PassRefPtr<SVGLength> value) { m_y2 = value; m_y2Set = true; } | 52 void setY2(PassRefPtrWillBeRawPtr<SVGLength> value) { m_y2 = value; m_y2Set
= true; } |
| 49 | 53 |
| 50 bool hasX1() const { return m_x1Set; } | 54 bool hasX1() const { return m_x1Set; } |
| 51 bool hasY1() const { return m_y1Set; } | 55 bool hasY1() const { return m_y1Set; } |
| 52 bool hasX2() const { return m_x2Set; } | 56 bool hasX2() const { return m_x2Set; } |
| 53 bool hasY2() const { return m_y2Set; } | 57 bool hasY2() const { return m_y2Set; } |
| 54 | 58 |
| 59 void trace(Visitor* visitor) |
| 60 { |
| 61 visitor->trace(m_x1); |
| 62 visitor->trace(m_y1); |
| 63 visitor->trace(m_x2); |
| 64 visitor->trace(m_y2); |
| 65 } |
| 66 |
| 55 private: | 67 private: |
| 56 // Properties | 68 // Properties |
| 57 RefPtr<SVGLength> m_x1; | 69 RefPtrWillBeMember<SVGLength> m_x1; |
| 58 RefPtr<SVGLength> m_y1; | 70 RefPtrWillBeMember<SVGLength> m_y1; |
| 59 RefPtr<SVGLength> m_x2; | 71 RefPtrWillBeMember<SVGLength> m_x2; |
| 60 RefPtr<SVGLength> m_y2; | 72 RefPtrWillBeMember<SVGLength> m_y2; |
| 61 | 73 |
| 62 // Property states | 74 // Property states |
| 63 bool m_x1Set : 1; | 75 bool m_x1Set : 1; |
| 64 bool m_y1Set : 1; | 76 bool m_y1Set : 1; |
| 65 bool m_x2Set : 1; | 77 bool m_x2Set : 1; |
| 66 bool m_y2Set : 1; | 78 bool m_y2Set : 1; |
| 67 }; | 79 }; |
| 68 | 80 |
| 69 } // namespace blink | 81 } // namespace blink |
| 70 | 82 |
| 71 #endif | 83 #endif |
| 72 | 84 |
| 73 // vim:ts=4:noet | 85 // vim:ts=4:noet |
| OLD | NEW |