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.
25 #ifndef StyleRareInheritedData_h
26 #define StyleRareInheritedData_h
28 #include "core/CoreExport.h"
29 #include "core/css/StyleColor.h"
30 #include "core/style/DataRef.h"
31 #include "platform/Length.h"
32 #include "platform/graphics/Color.h"
33 #include "platform/heap/Handle.h"
34 #include "platform/text/TabSize.h"
35 #include "wtf/PassRefPtr.h"
36 #include "wtf/RefCounted.h"
37 #include "wtf/RefVector.h"
38 #include "wtf/text/AtomicString.h"
42 class AppliedTextDecoration
;
48 typedef RefVector
<AppliedTextDecoration
> AppliedTextDecorationList
;
50 typedef HeapVector
<CursorData
> CursorList
;
52 typedef RefVector
<CursorData
> CursorList
;
55 // This struct is for rarely used inherited CSS3, CSS2, and WebKit-specific properties.
56 // By grouping them together, we save space, and only allocate this object when someone
57 // actually uses one of these properties.
58 class CORE_EXPORT StyleRareInheritedData
: public RefCounted
<StyleRareInheritedData
> {
60 static PassRefPtr
<StyleRareInheritedData
> create() { return adoptRef(new StyleRareInheritedData
); }
61 PassRefPtr
<StyleRareInheritedData
> copy() const { return adoptRef(new StyleRareInheritedData(*this)); }
62 ~StyleRareInheritedData();
64 bool operator==(const StyleRareInheritedData
&) const;
65 bool operator!=(const StyleRareInheritedData
& o
) const
69 bool shadowDataEquivalent(const StyleRareInheritedData
&) const;
70 bool quotesDataEquivalent(const StyleRareInheritedData
&) const;
72 RefPtrWillBePersistent
<StyleImage
> listStyleImage
;
74 StyleColor
textStrokeColor() const { return m_textStrokeColorIsCurrentColor
? StyleColor::currentColor() : StyleColor(m_textStrokeColor
); }
75 StyleColor
textFillColor() const { return m_textFillColorIsCurrentColor
? StyleColor::currentColor() : StyleColor(m_textFillColor
); }
76 StyleColor
textEmphasisColor() const { return m_textEmphasisColorIsCurrentColor
? StyleColor::currentColor() : StyleColor(m_textEmphasisColor
); }
77 StyleColor
visitedLinkTextStrokeColor() const { return m_visitedLinkTextStrokeColorIsCurrentColor
? StyleColor::currentColor() : StyleColor(m_visitedLinkTextStrokeColor
); }
78 StyleColor
visitedLinkTextFillColor() const { return m_visitedLinkTextFillColorIsCurrentColor
? StyleColor::currentColor() : StyleColor(m_visitedLinkTextFillColor
); }
79 StyleColor
visitedLinkTextEmphasisColor() const { return m_visitedLinkTextEmphasisColorIsCurrentColor
? StyleColor::currentColor() : StyleColor(m_visitedLinkTextEmphasisColor
); }
81 void setTextStrokeColor(const StyleColor
& color
) { m_textStrokeColor
= color
.resolve(Color()); m_textStrokeColorIsCurrentColor
= color
.isCurrentColor(); }
82 void setTextFillColor(const StyleColor
& color
) { m_textFillColor
= color
.resolve(Color()); m_textFillColorIsCurrentColor
= color
.isCurrentColor(); }
83 void setTextEmphasisColor(const StyleColor
& color
) { m_textEmphasisColor
= color
.resolve(Color()); m_textEmphasisColorIsCurrentColor
= color
.isCurrentColor(); }
84 void setVisitedLinkTextStrokeColor(const StyleColor
& color
) { m_visitedLinkTextStrokeColor
= color
.resolve(Color()); m_visitedLinkTextStrokeColorIsCurrentColor
= color
.isCurrentColor(); }
85 void setVisitedLinkTextFillColor(const StyleColor
& color
) { m_visitedLinkTextFillColor
= color
.resolve(Color()); m_visitedLinkTextFillColorIsCurrentColor
= color
.isCurrentColor(); }
86 void setVisitedLinkTextEmphasisColor(const StyleColor
& color
) { m_visitedLinkTextEmphasisColor
= color
.resolve(Color()); m_visitedLinkTextEmphasisColorIsCurrentColor
= color
.isCurrentColor(); }
88 Color m_textStrokeColor
;
89 float textStrokeWidth
;
90 Color m_textFillColor
;
91 Color m_textEmphasisColor
;
93 Color m_visitedLinkTextStrokeColor
;
94 Color m_visitedLinkTextFillColor
;
95 Color m_visitedLinkTextEmphasisColor
;
97 RefPtr
<ShadowList
> textShadow
; // Our text shadow information for shadowed text drawing.
98 AtomicString highlight
; // Apple-specific extension for custom highlight rendering.
100 RefPtrWillBePersistent
<CursorList
> cursorData
;
103 float m_effectiveZoom
;
105 // Paged media properties.
108 unsigned m_hasAutoOrphans
: 1;
110 unsigned m_textStrokeColorIsCurrentColor
: 1;
111 unsigned m_textFillColorIsCurrentColor
: 1;
112 unsigned m_textEmphasisColorIsCurrentColor
: 1;
113 unsigned m_visitedLinkTextStrokeColorIsCurrentColor
: 1;
114 unsigned m_visitedLinkTextFillColorIsCurrentColor
: 1;
115 unsigned m_visitedLinkTextEmphasisColorIsCurrentColor
: 1;
117 unsigned textSecurity
: 2; // ETextSecurity
118 unsigned userModify
: 2; // EUserModify (editing)
119 unsigned wordBreak
: 2; // EWordBreak
120 unsigned overflowWrap
: 1; // EOverflowWrap
121 unsigned lineBreak
: 3; // LineBreak
122 unsigned userSelect
: 2; // EUserSelect
123 unsigned speak
: 3; // ESpeak
124 unsigned hyphens
: 2; // Hyphens
125 unsigned textEmphasisFill
: 1; // TextEmphasisFill
126 unsigned textEmphasisMark
: 3; // TextEmphasisMark
127 unsigned textEmphasisPosition
: 1; // TextEmphasisPosition
128 unsigned m_textAlignLast
: 3; // TextAlignLast
129 unsigned m_textJustify
: 2; // TextJustify
130 unsigned m_textOrientation
: 2; // TextOrientation
131 unsigned m_textCombine
: 1; // CSS3 text-combine properties
132 unsigned m_textIndentLine
: 1; // TextIndentEachLine
133 unsigned m_textIndentType
: 1; // TextIndentHanging
134 // CSS Image Values Level 3
135 unsigned m_imageRendering
: 3; // EImageRendering
136 unsigned m_textUnderlinePosition
: 1; // TextUnderlinePosition
137 unsigned m_rubyPosition
: 1; // RubyPosition
139 // Though will-change is not itself an inherited property, the intent
140 // expressed by 'will-change: contents' includes descendants.
141 unsigned m_subtreeWillChangeContents
: 1;
143 unsigned m_selfOrAncestorHasDirAutoAttribute
: 1;
145 unsigned m_respectImageOrientation
: 1;
147 AtomicString hyphenationString
;
148 short hyphenationLimitBefore
;
149 short hyphenationLimitAfter
;
150 short hyphenationLimitLines
;
154 AtomicString textEmphasisCustomMark
;
155 RefPtr
<QuotesData
> quotes
;
157 Color tapHighlightColor
;
159 RefPtr
<AppliedTextDecorationList
> appliedTextDecorations
;
163 StyleRareInheritedData();
164 StyleRareInheritedData(const StyleRareInheritedData
&);
169 #endif // StyleRareInheritedData_h