1/*
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)
7 *
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.
12 *
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.
17 *
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.
22 *
23 */
24
25#pragma once
26
27#include "Color.h"
28#include "DataRef.h"
29#include "Length.h"
30#include "StyleCustomPropertyData.h"
31#include "TextDecorationThickness.h"
32#include "TextUnderlineOffset.h"
33#include <wtf/RefCounted.h>
34#include <wtf/text/AtomicString.h>
35
36#if ENABLE(TEXT_AUTOSIZING)
37#include "TextSizeAdjustment.h"
38#endif
39
40#if ENABLE(DARK_MODE_CSS)
41#include "StyleColorScheme.h"
42#endif
43
44namespace WebCore {
45
46class CursorList;
47class QuotesData;
48class ShadowData;
49class StyleFilterData;
50class StyleImage;
51
52// This struct is for rarely used inherited CSS3, CSS2, and WebKit-specific properties.
53// By grouping them together, we save space, and only allocate this object when someone
54// actually uses one of these properties.
55class StyleRareInheritedData : public RefCounted<StyleRareInheritedData> {
56public:
57 static Ref<StyleRareInheritedData> create() { return adoptRef(*new StyleRareInheritedData); }
58 Ref<StyleRareInheritedData> copy() const;
59 ~StyleRareInheritedData();
60
61 bool operator==(const StyleRareInheritedData& o) const;
62 bool operator!=(const StyleRareInheritedData& o) const
63 {
64 return !(*this == o);
65 }
66
67 bool hasColorFilters() const;
68
69 RefPtr<StyleImage> listStyleImage;
70
71 Color textStrokeColor;
72 float textStrokeWidth;
73 Color textFillColor;
74 Color textEmphasisColor;
75
76 Color visitedLinkTextStrokeColor;
77 Color visitedLinkTextFillColor;
78 Color visitedLinkTextEmphasisColor;
79
80 Color caretColor;
81 Color visitedLinkCaretColor;
82
83 std::unique_ptr<ShadowData> textShadow; // Our text shadow information for shadowed text drawing.
84
85 RefPtr<CursorList> cursorData;
86 Length indent;
87 float effectiveZoom;
88
89 TextUnderlineOffset textUnderlineOffset;
90 TextDecorationThickness textDecorationThickness;
91
92 Length wordSpacing;
93
94 DataRef<StyleCustomPropertyData> customProperties;
95
96 // Paged media properties.
97 short widows;
98 short orphans;
99 unsigned hasAutoWidows : 1;
100 unsigned hasAutoOrphans : 1;
101
102 unsigned textSecurity : 2; // TextSecurity
103 unsigned userModify : 2; // UserModify (editing)
104 unsigned wordBreak : 2; // WordBreak
105 unsigned overflowWrap : 1; // OverflowWrap
106 unsigned nbspMode : 1; // NBSPMode
107 unsigned lineBreak : 3; // LineBreak
108 unsigned userSelect : 2; // UserSelect
109 unsigned colorSpace : 1; // ColorSpace
110 unsigned speakAs : 4; // ESpeakAs
111 unsigned hyphens : 2; // Hyphens
112 unsigned textEmphasisFill : 1; // TextEmphasisFill
113 unsigned textEmphasisMark : 3; // TextEmphasisMark
114 unsigned textEmphasisPosition : 4; // TextEmphasisPosition
115 unsigned textOrientation : 2; // TextOrientation
116#if ENABLE(CSS3_TEXT)
117 unsigned textIndentLine : 1; // TextIndentLine
118 unsigned textIndentType : 1; // TextIndentType
119#endif
120 unsigned lineBoxContain: 7; // LineBoxContain
121 // CSS Image Values Level 3
122#if ENABLE(CSS_IMAGE_ORIENTATION)
123 unsigned imageOrientation : 4; // ImageOrientationEnum
124#endif
125 unsigned imageRendering : 3; // ImageRendering
126 unsigned lineSnap : 2; // LineSnap
127 unsigned lineAlign : 1; // LineAlign
128#if ENABLE(OVERFLOW_SCROLLING_TOUCH)
129 unsigned useTouchOverflowScrolling: 1;
130#endif
131#if ENABLE(CSS_IMAGE_RESOLUTION)
132 unsigned imageResolutionSource : 1; // ImageResolutionSource
133 unsigned imageResolutionSnap : 1; // ImageResolutionSnap
134#endif
135#if ENABLE(CSS3_TEXT)
136 unsigned textAlignLast : 3; // TextAlignLast
137 unsigned textJustify : 2; // TextJustify
138#endif
139 unsigned textDecorationSkip : 5; // TextDecorationSkip
140 unsigned textUnderlinePosition : 2; // TextUnderlinePosition
141 unsigned rubyPosition : 2; // RubyPosition
142 unsigned textZoom: 1; // TextZoom
143
144#if PLATFORM(IOS_FAMILY)
145 unsigned touchCalloutEnabled : 1;
146#endif
147
148 unsigned hangingPunctuation : 4;
149
150 unsigned paintOrder : 3; // PaintOrder
151 unsigned capStyle : 2; // LineCap
152 unsigned joinStyle : 2; // LineJoin
153 unsigned hasSetStrokeWidth : 1;
154 unsigned hasSetStrokeColor : 1;
155
156#if ENABLE(POINTER_EVENTS)
157 unsigned effectiveTouchActions : 6; // OptionSet<TouchAction>
158#endif
159
160 Length strokeWidth;
161 Color strokeColor;
162 Color visitedLinkStrokeColor;
163 float miterLimit;
164
165 AtomicString hyphenationString;
166 short hyphenationLimitBefore;
167 short hyphenationLimitAfter;
168 short hyphenationLimitLines;
169
170 AtomicString textEmphasisCustomMark;
171 RefPtr<QuotesData> quotes;
172 DataRef<StyleFilterData> appleColorFilter;
173
174 AtomicString lineGrid;
175 unsigned tabSize;
176
177#if ENABLE(TEXT_AUTOSIZING)
178 TextSizeAdjustment textSizeAdjust;
179#endif
180
181#if ENABLE(CSS_IMAGE_RESOLUTION)
182 float imageResolution;
183#endif
184
185#if ENABLE(TOUCH_EVENTS)
186 Color tapHighlightColor;
187#endif
188
189#if ENABLE(DARK_MODE_CSS)
190 StyleColorScheme colorScheme;
191#endif
192
193private:
194 StyleRareInheritedData();
195 StyleRareInheritedData(const StyleRareInheritedData&);
196};
197
198} // namespace WebCore
199