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