Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / rendering / style / StyleRareNonInheritedData.h
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 "core/css/StyleColor.h"
29 #include "core/rendering/ClipPathOperation.h"
30 #include "core/rendering/style/BasicShapes.h"
31 #include "core/rendering/style/CounterDirectives.h"
32 #include "core/rendering/style/CursorData.h"
33 #include "core/rendering/style/DataRef.h"
34 #include "core/rendering/style/FillLayer.h"
35 #include "core/rendering/style/LineClampValue.h"
36 #include "core/rendering/style/NinePieceImage.h"
37 #include "core/rendering/style/RenderStyleConstants.h"
38 #include "core/rendering/style/ShapeValue.h"
39 #include "platform/LengthPoint.h"
40 #include "wtf/OwnPtr.h"
41 #include "wtf/PassRefPtr.h"
42 #include "wtf/Vector.h"
43
44 namespace blink {
45
46 class ContentData;
47 class CSSAnimationData;
48 class CSSTransitionData;
49 class LengthSize;
50 class ShadowList;
51 class StyleDeprecatedFlexibleBoxData;
52 class StyleFilterData;
53 class StyleFlexibleBoxData;
54 class StyleGridData;
55 class StyleGridItemData;
56 class StyleMarqueeData;
57 class StyleMultiColData;
58 class StyleReflection;
59 class StyleTransformData;
60 class StyleWillChangeData;
61
62 // Page size type.
63 // StyleRareNonInheritedData::m_pageSize is meaningful only when
64 // StyleRareNonInheritedData::m_pageSizeType is PAGE_SIZE_RESOLVED.
65 enum PageSizeType {
66     PAGE_SIZE_AUTO, // size: auto
67     PAGE_SIZE_AUTO_LANDSCAPE, // size: landscape
68     PAGE_SIZE_AUTO_PORTRAIT, // size: portrait
69     PAGE_SIZE_RESOLVED // Size is fully resolved.
70 };
71
72 // This struct is for rarely used non-inherited CSS3, CSS2, and WebKit-specific properties.
73 // By grouping them together, we save space, and only allocate this object when someone
74 // actually uses one of these properties.
75 class StyleRareNonInheritedData : public RefCounted<StyleRareNonInheritedData> {
76 public:
77     static PassRefPtr<StyleRareNonInheritedData> create() { return adoptRef(new StyleRareNonInheritedData); }
78     PassRefPtr<StyleRareNonInheritedData> copy() const { return adoptRef(new StyleRareNonInheritedData(*this)); }
79     ~StyleRareNonInheritedData();
80
81     bool operator==(const StyleRareNonInheritedData&) const;
82     bool operator!=(const StyleRareNonInheritedData& o) const { return !(*this == o); }
83
84     bool contentDataEquivalent(const StyleRareNonInheritedData&) const;
85     bool counterDataEquivalent(const StyleRareNonInheritedData&) const;
86     bool shadowDataEquivalent(const StyleRareNonInheritedData&) const;
87     bool reflectionDataEquivalent(const StyleRareNonInheritedData&) const;
88     bool animationDataEquivalent(const StyleRareNonInheritedData&) const;
89     bool transitionDataEquivalent(const StyleRareNonInheritedData&) const;
90     bool hasFilters() const;
91     bool hasOpacity() const { return opacity < 1; }
92
93     float opacity; // Whether or not we're transparent.
94
95     float m_aspectRatioDenominator;
96     float m_aspectRatioNumerator;
97
98     float m_perspective;
99     Length m_perspectiveOriginX;
100     Length m_perspectiveOriginY;
101
102     LineClampValue lineClamp; // An Apple extension.
103     DraggableRegionMode m_draggableRegionMode;
104
105     DataRef<StyleDeprecatedFlexibleBoxData> m_deprecatedFlexibleBox; // Flexible box properties
106     DataRef<StyleFlexibleBoxData> m_flexibleBox;
107     DataRef<StyleMarqueeData> m_marquee; // Marquee properties
108     DataRef<StyleMultiColData> m_multiCol; //  CSS3 multicol properties
109     DataRef<StyleTransformData> m_transform; // Transform properties (rotate, scale, skew, etc.)
110     DataRef<StyleWillChangeData> m_willChange; // CSS Will Change
111
112     DataRef<StyleFilterData> m_filter; // Filter operations (url, sepia, blur, etc.)
113
114     DataRef<StyleGridData> m_grid;
115     DataRef<StyleGridItemData> m_gridItem;
116
117     OwnPtr<ContentData> m_content;
118     OwnPtr<CounterDirectiveMap> m_counterDirectives;
119
120     RefPtr<ShadowList> m_boxShadow;
121
122     RefPtr<StyleReflection> m_boxReflect;
123
124     OwnPtrWillBePersistent<CSSAnimationData> m_animations;
125     OwnPtrWillBePersistent<CSSTransitionData> m_transitions;
126
127     FillLayer m_mask;
128     NinePieceImage m_maskBoxImage;
129
130     LengthSize m_pageSize;
131
132     RefPtr<ShapeValue> m_shapeOutside;
133     Length m_shapeMargin;
134     float m_shapeImageThreshold;
135
136     RefPtr<ClipPathOperation> m_clipPath;
137
138     StyleColor m_textDecorationColor;
139     StyleColor m_visitedLinkTextDecorationColor;
140     StyleColor m_visitedLinkBackgroundColor;
141     StyleColor m_visitedLinkOutlineColor;
142     StyleColor m_visitedLinkBorderLeftColor;
143     StyleColor m_visitedLinkBorderRightColor;
144     StyleColor m_visitedLinkBorderTopColor;
145     StyleColor m_visitedLinkBorderBottomColor;
146
147     int m_order;
148
149     LengthPoint m_objectPosition;
150
151     Vector<String> m_callbackSelectors;
152
153     unsigned m_pageSizeType : 2; // PageSizeType
154     unsigned m_transformStyle3D : 1; // ETransformStyle3D
155     unsigned m_backfaceVisibility : 1; // EBackfaceVisibility
156
157     unsigned m_alignContent : 3; // EAlignContent
158     unsigned m_alignItems : 4; // ItemPosition
159     unsigned m_alignItemsOverflowAlignment : 2; // OverflowAlignment
160     unsigned m_alignSelf : 4; // ItemPosition
161     unsigned m_alignSelfOverflowAlignment : 2; // OverflowAlignment
162     unsigned m_justifyContent : 3; // EJustifyContent
163
164     unsigned userDrag : 2; // EUserDrag
165     unsigned textOverflow : 1; // Whether or not lines that spill out should be truncated with "..."
166     unsigned marginBeforeCollapse : 2; // EMarginCollapse
167     unsigned marginAfterCollapse : 2; // EMarginCollapse
168     unsigned m_appearance : 6; // EAppearance
169     unsigned m_borderFit : 1; // EBorderFit
170     unsigned m_textCombine : 1; // CSS3 text-combine properties
171
172     unsigned m_textDecorationStyle : 3; // TextDecorationStyle
173     unsigned m_wrapFlow: 3; // WrapFlow
174     unsigned m_wrapThrough: 1; // WrapThrough
175
176     unsigned m_hasCurrentOpacityAnimation : 1;
177     unsigned m_hasCurrentTransformAnimation : 1;
178     unsigned m_hasCurrentFilterAnimation : 1;
179     unsigned m_runningOpacityAnimationOnCompositor : 1;
180     unsigned m_runningTransformAnimationOnCompositor : 1;
181     unsigned m_runningFilterAnimationOnCompositor : 1;
182
183     unsigned m_hasAspectRatio : 1; // Whether or not an aspect ratio has been specified.
184
185     unsigned m_effectiveBlendMode: 5; // EBlendMode
186
187     unsigned m_touchAction : TouchActionBits; // TouchAction
188
189     unsigned m_objectFit : 3; // ObjectFit
190
191     unsigned m_isolation : 1; // Isolation
192
193     unsigned m_justifyItems : 4; // ItemPosition
194     unsigned m_justifyItemsOverflowAlignment : 2; // OverflowAlignment
195     unsigned m_justifyItemsPositionType: 1; // Whether or not alignment uses the 'legacy' keyword.
196
197     unsigned m_justifySelf : 4; // ItemPosition
198     unsigned m_justifySelfOverflowAlignment : 2; // OverflowAlignment
199
200     // ScrollBehavior. 'scroll-behavior' has 2 accepted values, but ScrollBehavior has a third
201     // value (that can only be specified using CSSOM scroll APIs) so 2 bits are needed.
202     unsigned m_scrollBehavior: 2;
203
204     // Plugins require accelerated compositing for reasons external to blink.
205     // In which case, we need to update the RenderStyle on the RenderEmbeddedObject,
206     // so store this bit so that the style actually changes when the plugin
207     // becomes composited.
208     unsigned m_requiresAcceleratedCompositingForExternalReasons: 1;
209
210     // Whether the transform (if it exists) is stored in the element's inline style.
211     unsigned m_hasInlineTransform : 1;
212
213 private:
214     StyleRareNonInheritedData();
215     StyleRareNonInheritedData(const StyleRareNonInheritedData&);
216 };
217
218 } // namespace blink
219
220 #endif // StyleRareNonInheritedData_h