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#ifndef StyleRareNonInheritedData_h
26#define StyleRareNonInheritedData_h
27
28#include "BasicShapes.h"
29#include "ClipPathOperation.h"
30#include "CounterDirectives.h"
31#include "CursorData.h"
32#include "DataRef.h"
33#include "FillLayer.h"
34#include "LineClampValue.h"
35#include "NinePieceImage.h"
36#include "ShapeValue.h"
37#include <memory>
38#include <wtf/PassRefPtr.h>
39#include <wtf/Vector.h>
40
41namespace WebCore {
42
43class AnimationList;
44class ShadowData;
45class StyleDeprecatedFlexibleBoxData;
46#if ENABLE(CSS_FILTERS)
47class StyleFilterData;
48#endif
49class StyleFlexibleBoxData;
50#if ENABLE(CSS_GRID_LAYOUT)
51class StyleGridData;
52class StyleGridItemData;
53#endif
54class StyleMarqueeData;
55class StyleMultiColData;
56class StyleReflection;
57class StyleResolver;
58class StyleTransformData;
59
60class ContentData;
61struct LengthSize;
62
63#if ENABLE(DASHBOARD_SUPPORT)
64struct StyleDashboardRegion;
65#endif
66
67// Page size type.
68// StyleRareNonInheritedData::m_pageSize is meaningful only when
69// StyleRareNonInheritedData::m_pageSizeType is PAGE_SIZE_RESOLVED.
70enum PageSizeType {
71    PAGE_SIZE_AUTO, // size: auto
72    PAGE_SIZE_AUTO_LANDSCAPE, // size: landscape
73    PAGE_SIZE_AUTO_PORTRAIT, // size: portrait
74    PAGE_SIZE_RESOLVED // Size is fully resolved.
75};
76
77// This struct is for rarely used non-inherited CSS3, CSS2, and WebKit-specific properties.
78// By grouping them together, we save space, and only allocate this object when someone
79// actually uses one of these properties.
80class StyleRareNonInheritedData : public RefCounted<StyleRareNonInheritedData> {
81public:
82    static PassRef<StyleRareNonInheritedData> create() { return adoptRef(*new StyleRareNonInheritedData); }
83    PassRef<StyleRareNonInheritedData> copy() const;
84    ~StyleRareNonInheritedData();
85
86    bool operator==(const StyleRareNonInheritedData&) const;
87    bool operator!=(const StyleRareNonInheritedData& o) const { return !(*this == o); }
88
89    bool contentDataEquivalent(const StyleRareNonInheritedData&) const;
90    bool counterDataEquivalent(const StyleRareNonInheritedData&) const;
91    bool shadowDataEquivalent(const StyleRareNonInheritedData&) const;
92    bool reflectionDataEquivalent(const StyleRareNonInheritedData&) const;
93    bool animationDataEquivalent(const StyleRareNonInheritedData&) const;
94    bool transitionDataEquivalent(const StyleRareNonInheritedData&) const;
95    bool hasFilters() const;
96    bool hasOpacity() const { return opacity < 1; }
97
98    float opacity;
99
100    float m_aspectRatioDenominator;
101    float m_aspectRatioNumerator;
102
103    float m_perspective;
104    Length m_perspectiveOriginX;
105    Length m_perspectiveOriginY;
106
107    LineClampValue lineClamp; // An Apple extension.
108#if ENABLE(DASHBOARD_SUPPORT)
109    Vector<StyleDashboardRegion> m_dashboardRegions;
110#endif
111
112    DataRef<StyleDeprecatedFlexibleBoxData> m_deprecatedFlexibleBox; // Flexible box properties
113    DataRef<StyleFlexibleBoxData> m_flexibleBox;
114    DataRef<StyleMarqueeData> m_marquee; // Marquee properties
115    DataRef<StyleMultiColData> m_multiCol; //  CSS3 multicol properties
116    DataRef<StyleTransformData> m_transform; // Transform properties (rotate, scale, skew, etc.)
117
118#if ENABLE(CSS_FILTERS)
119    DataRef<StyleFilterData> m_filter; // Filter operations (url, sepia, blur, etc.)
120#endif
121
122#if ENABLE(CSS_GRID_LAYOUT)
123    DataRef<StyleGridData> m_grid;
124    DataRef<StyleGridItemData> m_gridItem;
125#endif
126
127    std::unique_ptr<ContentData> m_content;
128    std::unique_ptr<CounterDirectiveMap> m_counterDirectives;
129    String m_altText;
130
131    std::unique_ptr<ShadowData> m_boxShadow; // For box-shadow decorations.
132
133    RefPtr<StyleReflection> m_boxReflect;
134
135    std::unique_ptr<AnimationList> m_animations;
136    std::unique_ptr<AnimationList> m_transitions;
137
138    FillLayer m_mask;
139    NinePieceImage m_maskBoxImage;
140
141    LengthSize m_pageSize;
142
143#if ENABLE(CSS_SHAPES)
144    RefPtr<ShapeValue> m_shapeOutside;
145    Length m_shapeMargin;
146    float m_shapeImageThreshold;
147#endif
148
149    RefPtr<ClipPathOperation> m_clipPath;
150
151    Color m_textDecorationColor;
152    Color m_visitedLinkTextDecorationColor;
153    Color m_visitedLinkBackgroundColor;
154    Color m_visitedLinkOutlineColor;
155    Color m_visitedLinkBorderLeftColor;
156    Color m_visitedLinkBorderRightColor;
157    Color m_visitedLinkBorderTopColor;
158    Color m_visitedLinkBorderBottomColor;
159
160    int m_order;
161
162    AtomicString m_flowThread;
163    AtomicString m_regionThread;
164    unsigned m_regionFragment : 1; // RegionFragment
165
166    unsigned m_regionBreakAfter : 2; // EPageBreak
167    unsigned m_regionBreakBefore : 2; // EPageBreak
168    unsigned m_regionBreakInside : 2; // EPageBreak
169
170    unsigned m_pageSizeType : 2; // PageSizeType
171    unsigned m_transformStyle3D : 1; // ETransformStyle3D
172    unsigned m_backfaceVisibility : 1; // EBackfaceVisibility
173
174    unsigned m_alignContent : 3; // EAlignContent
175    unsigned m_alignItems : 3; // EAlignItems
176    unsigned m_alignSelf : 3; // EAlignItems
177    unsigned m_justifyContent : 3; // EJustifyContent
178
179    unsigned m_justifySelf : 4; // EJustifySelf
180    unsigned m_justifySelfOverflowAlignment : 2; // EJustifySelfOverflowAlignment
181
182    unsigned userDrag : 2; // EUserDrag
183    unsigned textOverflow : 1; // Whether or not lines that spill out should be truncated with "..."
184    unsigned marginBeforeCollapse : 2; // EMarginCollapse
185    unsigned marginAfterCollapse : 2; // EMarginCollapse
186    unsigned m_appearance : 6; // EAppearance
187    unsigned m_borderFit : 1; // EBorderFit
188    unsigned m_textCombine : 1; // CSS3 text-combine properties
189
190    unsigned m_textDecorationStyle : 3; // TextDecorationStyle
191
192    unsigned m_runningAcceleratedAnimation : 1;
193
194    unsigned m_aspectRatioType : 2;
195
196#if ENABLE(CSS_COMPOSITING)
197    unsigned m_effectiveBlendMode: 5; // EBlendMode
198    unsigned m_isolation : 1; // Isolation
199#endif
200
201    unsigned m_objectFit : 3; // ObjectFit
202
203private:
204    StyleRareNonInheritedData();
205    StyleRareNonInheritedData(const StyleRareNonInheritedData&);
206};
207
208} // namespace WebCore
209
210#endif // StyleRareNonInheritedData_h
211