1/*
2 * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3 *
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.
8 *
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.
13 *
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.
18 */
19
20#pragma once
21
22#include "GradientAttributes.h"
23
24namespace WebCore {
25struct LinearGradientAttributes : GradientAttributes {
26 LinearGradientAttributes()
27 : m_x1()
28 , m_y1()
29 , m_x2(LengthModeWidth, "100%")
30 , m_y2()
31 , m_x1Set(false)
32 , m_y1Set(false)
33 , m_x2Set(false)
34 , m_y2Set(false)
35 {
36 }
37
38 SVGLengthValue x1() const { return m_x1; }
39 SVGLengthValue y1() const { return m_y1; }
40 SVGLengthValue x2() const { return m_x2; }
41 SVGLengthValue y2() const { return m_y2; }
42
43 void setX1(SVGLengthValue value) { m_x1 = value; m_x1Set = true; }
44 void setY1(SVGLengthValue value) { m_y1 = value; m_y1Set = true; }
45 void setX2(SVGLengthValue value) { m_x2 = value; m_x2Set = true; }
46 void setY2(SVGLengthValue value) { m_y2 = value; m_y2Set = true; }
47
48 bool hasX1() const { return m_x1Set; }
49 bool hasY1() const { return m_y1Set; }
50 bool hasX2() const { return m_x2Set; }
51 bool hasY2() const { return m_y2Set; }
52
53private:
54 // Properties
55 SVGLengthValue m_x1;
56 SVGLengthValue m_y1;
57 SVGLengthValue m_x2;
58 SVGLengthValue m_y2;
59
60 // Property states
61 bool m_x1Set : 1;
62 bool m_y1Set : 1;
63 bool m_x2Set : 1;
64 bool m_y2Set : 1;
65};
66
67} // namespace WebCore
68