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 StyleRareInheritedData_h
26#define StyleRareInheritedData_h
27
28#include "Color.h"
29#include "Length.h"
30#include <wtf/RefCounted.h>
31#include <wtf/PassRefPtr.h>
32#include <wtf/text/AtomicString.h>
33
34#if ENABLE(IOS_TEXT_AUTOSIZING)
35#include "TextSizeAdjustment.h"
36#endif
37
38namespace WebCore {
39
40class CursorList;
41class QuotesData;
42class ShadowData;
43class StyleImage;
44
45// This struct is for rarely used inherited CSS3, CSS2, and WebKit-specific properties.
46// By grouping them together, we save space, and only allocate this object when someone
47// actually uses one of these properties.
48class StyleRareInheritedData : public RefCounted<StyleRareInheritedData> {
49public:
50    static PassRef<StyleRareInheritedData> create() { return adoptRef(*new StyleRareInheritedData); }
51    PassRef<StyleRareInheritedData> copy() const;
52    ~StyleRareInheritedData();
53
54    bool operator==(const StyleRareInheritedData& o) const;
55    bool operator!=(const StyleRareInheritedData& o) const
56    {
57        return !(*this == o);
58    }
59    bool shadowDataEquivalent(const StyleRareInheritedData&) const;
60
61    RefPtr<StyleImage> listStyleImage;
62
63    Color textStrokeColor;
64    float textStrokeWidth;
65    Color textFillColor;
66    Color textEmphasisColor;
67
68    Color visitedLinkTextStrokeColor;
69    Color visitedLinkTextFillColor;
70    Color visitedLinkTextEmphasisColor;
71
72    std::unique_ptr<ShadowData> textShadow; // Our text shadow information for shadowed text drawing.
73
74    RefPtr<CursorList> cursorData;
75    Length indent;
76    float m_effectiveZoom;
77
78    Length wordSpacing;
79
80    // Paged media properties.
81    short widows;
82    short orphans;
83    unsigned m_hasAutoWidows : 1;
84    unsigned m_hasAutoOrphans : 1;
85
86    unsigned textSecurity : 2; // ETextSecurity
87    unsigned userModify : 2; // EUserModify (editing)
88    unsigned wordBreak : 2; // EWordBreak
89    unsigned overflowWrap : 1; // EOverflowWrap
90    unsigned nbspMode : 1; // ENBSPMode
91    unsigned lineBreak : 3; // LineBreak
92    unsigned resize : 2; // EResize
93    unsigned userSelect : 2; // EUserSelect
94    unsigned colorSpace : 1; // ColorSpace
95    unsigned speak : 3; // ESpeak
96    unsigned hyphens : 2; // Hyphens
97    unsigned textEmphasisFill : 1; // TextEmphasisFill
98    unsigned textEmphasisMark : 3; // TextEmphasisMark
99    unsigned textEmphasisPosition : 4; // TextEmphasisPosition
100    unsigned m_textOrientation : 2; // TextOrientation
101#if ENABLE(CSS3_TEXT)
102    unsigned m_textIndentLine : 1; // TextIndentLine
103    unsigned m_textIndentType : 1; // TextIndentType
104#endif
105    unsigned m_lineBoxContain: 7; // LineBoxContain
106    // CSS Image Values Level 3
107#if ENABLE(CSS_IMAGE_ORIENTATION)
108    unsigned m_imageOrientation : 4; // ImageOrientationEnum
109#endif
110    unsigned m_imageRendering : 2; // EImageRendering
111    unsigned m_lineSnap : 2; // LineSnap
112    unsigned m_lineAlign : 1; // LineAlign
113#if ENABLE(ACCELERATED_OVERFLOW_SCROLLING)
114    unsigned useTouchOverflowScrolling: 1;
115#endif
116#if ENABLE(CSS_IMAGE_RESOLUTION)
117    unsigned m_imageResolutionSource : 1; // ImageResolutionSource
118    unsigned m_imageResolutionSnap : 1; // ImageResolutionSnap
119#endif
120#if ENABLE(CSS3_TEXT)
121    unsigned m_textAlignLast : 3; // TextAlignLast
122    unsigned m_textJustify : 3; // TextJustify
123#endif // CSS3_TEXT
124    unsigned m_textDecorationSkip : 5; // TextDecorationSkip
125    unsigned m_textUnderlinePosition : 3; // TextUnderlinePosition
126    unsigned m_rubyPosition : 1; // RubyPosition
127
128#if PLATFORM(IOS)
129    unsigned touchCalloutEnabled : 1;
130#endif
131
132    AtomicString hyphenationString;
133    short hyphenationLimitBefore;
134    short hyphenationLimitAfter;
135    short hyphenationLimitLines;
136
137    AtomicString locale;
138
139    AtomicString textEmphasisCustomMark;
140    RefPtr<QuotesData> quotes;
141
142    AtomicString m_lineGrid;
143    unsigned m_tabSize;
144
145#if PLATFORM(IOS)
146    Color compositionFillColor;
147#endif
148#if ENABLE(IOS_TEXT_AUTOSIZING)
149    TextSizeAdjustment textSizeAdjust;
150#endif
151
152#if ENABLE(CSS_IMAGE_RESOLUTION)
153    float m_imageResolution;
154#endif
155
156#if ENABLE(TOUCH_EVENTS)
157    Color tapHighlightColor;
158#endif
159
160private:
161    StyleRareInheritedData();
162    StyleRareInheritedData(const StyleRareInheritedData&);
163};
164
165} // namespace WebCore
166
167#endif // StyleRareInheritedData_h
168