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-2017 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 "CSSPropertyNames.h"
28#include "ClipPathOperation.h"
29#include "CounterDirectives.h"
30#include "DataRef.h"
31#include "FillLayer.h"
32#include "GapLength.h"
33#include "LengthPoint.h"
34#include "LineClampValue.h"
35#include "NinePieceImage.h"
36#include "ShapeValue.h"
37#include "StyleContentAlignmentData.h"
38#include "StyleSelfAlignmentData.h"
39#include "WillChangeData.h"
40#include <memory>
41#include <wtf/Vector.h>
42
43namespace WebCore {
44
45class AnimationList;
46class ContentData;
47class ShadowData;
48class StyleCustomPropertyData;
49class StyleDeprecatedFlexibleBoxData;
50class StyleFilterData;
51class StyleFlexibleBoxData;
52class StyleGridData;
53class StyleGridItemData;
54class StyleMarqueeData;
55class StyleMultiColData;
56class StyleReflection;
57class StyleResolver;
58class StyleScrollSnapArea;
59class StyleScrollSnapPort;
60class StyleTransformData;
61
62struct LengthSize;
63struct StyleDashboardRegion;
64
65// Page size type.
66// StyleRareNonInheritedData::pageSize is meaningful only when
67// StyleRareNonInheritedData::pageSizeType is PAGE_SIZE_RESOLVED.
68enum PageSizeType {
69 PAGE_SIZE_AUTO, // size: auto
70 PAGE_SIZE_AUTO_LANDSCAPE, // size: landscape
71 PAGE_SIZE_AUTO_PORTRAIT, // size: portrait
72 PAGE_SIZE_RESOLVED // Size is fully resolved.
73};
74
75// This struct is for rarely used non-inherited CSS3, CSS2, and WebKit-specific properties.
76// By grouping them together, we save space, and only allocate this object when someone
77// actually uses one of these properties.
78class StyleRareNonInheritedData : public RefCounted<StyleRareNonInheritedData> {
79public:
80 static Ref<StyleRareNonInheritedData> create() { return adoptRef(*new StyleRareNonInheritedData); }
81 Ref<StyleRareNonInheritedData> copy() const;
82 ~StyleRareNonInheritedData();
83
84 bool operator==(const StyleRareNonInheritedData&) const;
85 bool operator!=(const StyleRareNonInheritedData& other) const { return !(*this == other); }
86
87 bool contentDataEquivalent(const StyleRareNonInheritedData&) const;
88
89 bool hasFilters() const;
90
91#if ENABLE(FILTERS_LEVEL_2)
92 bool hasBackdropFilters() const;
93#endif
94
95 bool hasOpacity() const { return opacity < 1; }
96
97 float opacity;
98
99 float aspectRatioDenominator;
100 float aspectRatioNumerator;
101
102 float perspective;
103 Length perspectiveOriginX;
104 Length perspectiveOriginY;
105
106 LineClampValue lineClamp; // An Apple extension.
107
108 IntSize initialLetter;
109
110#if ENABLE(DASHBOARD_SUPPORT)
111 Vector<StyleDashboardRegion> dashboardRegions;
112#endif
113
114 DataRef<StyleDeprecatedFlexibleBoxData> deprecatedFlexibleBox; // Flexible box properties
115 DataRef<StyleFlexibleBoxData> flexibleBox;
116 DataRef<StyleMarqueeData> marquee; // Marquee properties
117 DataRef<StyleMultiColData> multiCol; // CSS3 multicol properties
118 DataRef<StyleTransformData> transform; // Transform properties (rotate, scale, skew, etc.)
119 DataRef<StyleFilterData> filter; // Filter operations (url, sepia, blur, etc.)
120
121#if ENABLE(FILTERS_LEVEL_2)
122 DataRef<StyleFilterData> backdropFilter; // Filter operations (url, sepia, blur, etc.)
123#endif
124
125 DataRef<StyleGridData> grid;
126 DataRef<StyleGridItemData> gridItem;
127
128#if ENABLE(CSS_SCROLL_SNAP)
129 DataRef<StyleScrollSnapPort> scrollSnapPort;
130 DataRef<StyleScrollSnapArea> scrollSnapArea;
131#endif
132
133 std::unique_ptr<ContentData> content;
134 std::unique_ptr<CounterDirectiveMap> counterDirectives;
135 String altText;
136
137 std::unique_ptr<ShadowData> boxShadow; // For box-shadow decorations.
138
139 RefPtr<WillChangeData> willChange; // Null indicates 'auto'.
140
141 RefPtr<StyleReflection> boxReflect;
142
143 std::unique_ptr<AnimationList> animations;
144 std::unique_ptr<AnimationList> transitions;
145
146 FillLayer mask;
147 NinePieceImage maskBoxImage;
148
149 LengthSize pageSize;
150 LengthPoint objectPosition;
151
152 RefPtr<ShapeValue> shapeOutside;
153 Length shapeMargin;
154 float shapeImageThreshold;
155
156 RefPtr<ClipPathOperation> clipPath;
157
158 Color textDecorationColor;
159 Color visitedLinkTextDecorationColor;
160 Color visitedLinkBackgroundColor;
161 Color visitedLinkOutlineColor;
162 Color visitedLinkBorderLeftColor;
163 Color visitedLinkBorderRightColor;
164 Color visitedLinkBorderTopColor;
165 Color visitedLinkBorderBottomColor;
166
167 int order;
168
169 StyleContentAlignmentData alignContent;
170 StyleSelfAlignmentData alignItems;
171 StyleSelfAlignmentData alignSelf;
172 StyleContentAlignmentData justifyContent;
173 StyleSelfAlignmentData justifyItems;
174 StyleSelfAlignmentData justifySelf;
175
176 DataRef<StyleCustomPropertyData> customProperties;
177 std::unique_ptr<HashSet<String>> customPaintWatchedProperties;
178
179#if ENABLE(POINTER_EVENTS)
180 unsigned touchActions : 6; // TouchAction
181#endif
182
183 unsigned pageSizeType : 2; // PageSizeType
184 unsigned transformStyle3D : 1; // TransformStyle3D
185 unsigned backfaceVisibility : 1; // BackfaceVisibility
186
187 unsigned userDrag : 2; // UserDrag
188 unsigned textOverflow : 1; // Whether or not lines that spill out should be truncated with "..."
189 unsigned marginBeforeCollapse : 2; // MarginCollapse
190 unsigned marginAfterCollapse : 2; // MarginCollapse
191 unsigned appearance : 6; // EAppearance
192 unsigned borderFit : 1; // BorderFit
193 unsigned textCombine : 1; // CSS3 text-combine properties
194
195 unsigned textDecorationStyle : 3; // TextDecorationStyle
196
197 unsigned aspectRatioType : 2;
198
199#if ENABLE(CSS_COMPOSITING)
200 unsigned effectiveBlendMode: 5; // EBlendMode
201 unsigned isolation : 1; // Isolation
202#endif
203
204#if ENABLE(APPLE_PAY)
205 unsigned applePayButtonStyle : 2;
206 unsigned applePayButtonType : 3;
207#endif
208
209 unsigned objectFit : 3; // ObjectFit
210
211 unsigned breakBefore : 4; // BreakBetween
212 unsigned breakAfter : 4;
213 unsigned breakInside : 3; // BreakInside
214 unsigned resize : 2; // Resize
215
216 unsigned hasAttrContent : 1;
217
218 unsigned isNotFinal : 1;
219
220 GapLength columnGap;
221 GapLength rowGap;
222
223private:
224 StyleRareNonInheritedData();
225 StyleRareNonInheritedData(const StyleRareNonInheritedData&);
226};
227
228} // namespace WebCore
229