]>
git.saurik.com Git - iphone-api.git/blob - WebCore/FillLayer.h
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Antti Koivisto (koivisto@kde.org)
4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
28 #include "GraphicsTypes.h"
30 #include "LengthSize.h"
31 #include "RenderStyleConstants.h"
32 #include "StyleImage.h"
33 #include <wtf/RefPtr.h>
39 FillLayer(EFillLayerType
);
42 StyleImage
* image() const { return m_image
.get(); }
43 Length
xPosition() const { return m_xPosition
; }
44 Length
yPosition() const { return m_yPosition
; }
45 bool attachment() const { return m_attachment
; }
46 EFillBox
clip() const { return static_cast<EFillBox
>(m_clip
); }
47 EFillBox
origin() const { return static_cast<EFillBox
>(m_origin
); }
48 EFillRepeat
repeat() const { return static_cast<EFillRepeat
>(m_repeat
); }
49 CompositeOperator
composite() const { return static_cast<CompositeOperator
>(m_composite
); }
50 LengthSize
size() const { return m_size
; }
52 const FillLayer
* next() const { return m_next
; }
53 FillLayer
* next() { return m_next
; }
55 bool isImageSet() const { return m_imageSet
; }
56 bool isXPositionSet() const { return m_xPosSet
; }
57 bool isYPositionSet() const { return m_yPosSet
; }
58 bool isAttachmentSet() const { return m_attachmentSet
; }
59 bool isClipSet() const { return m_clipSet
; }
60 bool isOriginSet() const { return m_originSet
; }
61 bool isRepeatSet() const { return m_repeatSet
; }
62 bool isCompositeSet() const { return m_compositeSet
; }
63 bool isSizeSet() const { return m_sizeSet
; }
65 void setImage(StyleImage
* i
) { m_image
= i
; m_imageSet
= true; }
66 void setXPosition(const Length
& l
) { m_xPosition
= l
; m_xPosSet
= true; }
67 void setYPosition(const Length
& l
) { m_yPosition
= l
; m_yPosSet
= true; }
68 void setAttachment(bool b
) { m_attachment
= b
; m_attachmentSet
= true; }
69 void setClip(EFillBox b
) { m_clip
= b
; m_clipSet
= true; }
70 void setOrigin(EFillBox b
) { m_origin
= b
; m_originSet
= true; }
71 void setRepeat(EFillRepeat r
) { m_repeat
= r
; m_repeatSet
= true; }
72 void setComposite(CompositeOperator c
) { m_composite
= c
; m_compositeSet
= true; }
73 void setSize(const LengthSize
& b
) { m_size
= b
; m_sizeSet
= true; }
75 void clearImage() { m_imageSet
= false; }
76 void clearXPosition() { m_xPosSet
= false; }
77 void clearYPosition() { m_yPosSet
= false; }
78 void clearAttachment() { m_attachmentSet
= false; }
79 void clearClip() { m_clipSet
= false; }
80 void clearOrigin() { m_originSet
= false; }
81 void clearRepeat() { m_repeatSet
= false; }
82 void clearComposite() { m_compositeSet
= false; }
83 void clearSize() { m_sizeSet
= false; }
85 void setNext(FillLayer
* n
) { if (m_next
!= n
) { delete m_next
; m_next
= n
; } }
87 FillLayer
& operator=(const FillLayer
& o
);
88 FillLayer(const FillLayer
& o
);
90 bool operator==(const FillLayer
& o
) const;
91 bool operator!=(const FillLayer
& o
) const
96 bool containsImage(StyleImage
*) const;
102 return m_next
? m_next
->hasImage() : false;
105 bool hasFixedImage() const
107 if (m_image
&& !m_attachment
)
109 return m_next
? m_next
->hasFixedImage() : false;
112 EFillLayerType
type() const { return static_cast<EFillLayerType
>(m_type
); }
114 void fillUnsetProperties();
115 void cullEmptyLayers();
117 static bool initialFillAttachment(EFillLayerType
) { return true; }
118 static EFillBox
initialFillClip(EFillLayerType
) { return BorderFillBox
; }
119 static EFillBox
initialFillOrigin(EFillLayerType type
) { return type
== BackgroundFillLayer
? PaddingFillBox
: BorderFillBox
; }
120 static EFillRepeat
initialFillRepeat(EFillLayerType
) { return RepeatFill
; }
121 static CompositeOperator
initialFillComposite(EFillLayerType
) { return CompositeSourceOver
; }
122 static LengthSize
initialFillSize(EFillLayerType
) { return LengthSize(); }
123 static Length
initialFillXPosition(EFillLayerType
) { return Length(0.0, Percent
); }
124 static Length
initialFillYPosition(EFillLayerType
) { return Length(0.0, Percent
); }
125 static StyleImage
* initialFillImage(EFillLayerType
) { return 0; }
131 RefPtr
<StyleImage
> m_image
;
136 bool m_attachment
: 1;
137 unsigned m_clip
: 2; // EFillBox
138 unsigned m_origin
: 2; // EFillBox
139 unsigned m_repeat
: 2; // EFillRepeat
140 unsigned m_composite
: 4; // CompositeOperator
145 bool m_attachmentSet
: 1;
147 bool m_originSet
: 1;
148 bool m_repeatSet
: 1;
151 bool m_compositeSet
: 1;
154 unsigned m_type
: 1; // EFillLayerType
159 } // namespace WebCore
161 #endif // FillLayer_h