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