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 LinearGradientAttributes_h
21 #define LinearGradientAttributes_h
23 #include "core/svg/GradientAttributes.h"
24 #include "core/svg/SVGLength.h"
25 #include "platform/heap/Handle.h"
29 struct LinearGradientAttributes
: GradientAttributes
{
30 DISALLOW_ALLOCATION();
32 LinearGradientAttributes()
33 : m_x1(SVGLength::create(SVGLengthMode::Width
))
34 , m_y1(SVGLength::create(SVGLengthMode::Height
))
35 , m_x2(SVGLength::create(SVGLengthMode::Width
))
36 , m_y2(SVGLength::create(SVGLengthMode::Height
))
42 m_x2
->setValueAsString("100%", ASSERT_NO_EXCEPTION
);
45 SVGLength
* x1() const { return m_x1
.get(); }
46 SVGLength
* y1() const { return m_y1
.get(); }
47 SVGLength
* x2() const { return m_x2
.get(); }
48 SVGLength
* y2() const { return m_y2
.get(); }
50 void setX1(PassRefPtrWillBeRawPtr
<SVGLength
> value
) { m_x1
= value
; m_x1Set
= true; }
51 void setY1(PassRefPtrWillBeRawPtr
<SVGLength
> value
) { m_y1
= value
; m_y1Set
= true; }
52 void setX2(PassRefPtrWillBeRawPtr
<SVGLength
> value
) { m_x2
= value
; m_x2Set
= true; }
53 void setY2(PassRefPtrWillBeRawPtr
<SVGLength
> value
) { m_y2
= value
; m_y2Set
= true; }
55 bool hasX1() const { return m_x1Set
; }
56 bool hasY1() const { return m_y1Set
; }
57 bool hasX2() const { return m_x2Set
; }
58 bool hasY2() const { return m_y2Set
; }
70 RefPtrWillBeMember
<SVGLength
> m_x1
;
71 RefPtrWillBeMember
<SVGLength
> m_y1
;
72 RefPtrWillBeMember
<SVGLength
> m_x2
;
73 RefPtrWillBeMember
<SVGLength
> m_y2
;
83 // Wrapper object for the LinearGradientAttributes part object.
84 class LinearGradientAttributesWrapper
: public GarbageCollectedFinalized
<LinearGradientAttributesWrapper
> {
86 static LinearGradientAttributesWrapper
* create()
88 return new LinearGradientAttributesWrapper
;
91 LinearGradientAttributes
& attributes() { return m_attributes
; }
92 void set(const LinearGradientAttributes
& attributes
) { m_attributes
= attributes
; }
93 DEFINE_INLINE_TRACE() { visitor
->trace(m_attributes
); }
96 LinearGradientAttributesWrapper()
100 LinearGradientAttributes m_attributes
;