Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / style / StyleRareInheritedData.cpp
blobd12593a9956a1c60757ca018adcd4ad5fc644c92
1 /*
2 * Copyright (C) 1999 Antti Koivisto (koivisto@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
22 #include "config.h"
23 #include "core/style/StyleRareInheritedData.h"
25 #include "core/style/AppliedTextDecoration.h"
26 #include "core/style/CursorData.h"
27 #include "core/style/DataEquivalency.h"
28 #include "core/style/ComputedStyle.h"
29 #include "core/style/ComputedStyleConstants.h"
30 #include "core/style/QuotesData.h"
31 #include "core/style/ShadowList.h"
32 #include "core/style/StyleImage.h"
34 namespace blink {
36 struct SameSizeAsStyleRareInheritedData : public RefCounted<SameSizeAsStyleRareInheritedData> {
37 void* styleImage;
38 Color firstColor;
39 float firstFloat;
40 Color colors[5];
41 void* ownPtrs[1];
42 AtomicString atomicStrings[4];
43 #if ENABLE(OILPAN)
44 void* refPtrs[1];
45 Persistent<void*> persistentHandles[2];
46 #else
47 void* refPtrs[3];
48 #endif
49 Length lengths[1];
50 float secondFloat;
51 unsigned m_bitfields[2];
52 short pagedMediaShorts[2];
53 short hyphenationShorts[3];
55 Color touchColors;
56 TabSize tabSize;
59 static_assert(sizeof(StyleRareInheritedData) <= sizeof(SameSizeAsStyleRareInheritedData), "StyleRareInheritedData should stay small");
61 StyleRareInheritedData::StyleRareInheritedData()
62 : listStyleImage(ComputedStyle::initialListStyleImage())
63 , textStrokeWidth(ComputedStyle::initialTextStrokeWidth())
64 , indent(ComputedStyle::initialTextIndent())
65 , m_effectiveZoom(ComputedStyle::initialZoom())
66 , widows(ComputedStyle::initialWidows())
67 , orphans(ComputedStyle::initialOrphans())
68 , m_hasAutoOrphans(true)
69 , m_textStrokeColorIsCurrentColor(true)
70 , m_textFillColorIsCurrentColor(true)
71 , m_textEmphasisColorIsCurrentColor(true)
72 , m_visitedLinkTextStrokeColorIsCurrentColor(true)
73 , m_visitedLinkTextFillColorIsCurrentColor(true)
74 , m_visitedLinkTextEmphasisColorIsCurrentColor(true)
75 , textSecurity(ComputedStyle::initialTextSecurity())
76 , userModify(READ_ONLY)
77 , wordBreak(ComputedStyle::initialWordBreak())
78 , overflowWrap(ComputedStyle::initialOverflowWrap())
79 , lineBreak(LineBreakAuto)
80 , userSelect(ComputedStyle::initialUserSelect())
81 , speak(SpeakNormal)
82 , hyphens(HyphensManual)
83 , textEmphasisFill(TextEmphasisFillFilled)
84 , textEmphasisMark(TextEmphasisMarkNone)
85 , textEmphasisPosition(TextEmphasisPositionOver)
86 , m_textAlignLast(ComputedStyle::initialTextAlignLast())
87 , m_textJustify(ComputedStyle::initialTextJustify())
88 , m_textOrientation(TextOrientationVerticalRight)
89 , m_textCombine(ComputedStyle::initialTextCombine())
90 , m_textIndentLine(ComputedStyle::initialTextIndentLine())
91 , m_textIndentType(ComputedStyle::initialTextIndentLine())
92 , m_imageRendering(ComputedStyle::initialImageRendering())
93 , m_textUnderlinePosition(ComputedStyle::initialTextUnderlinePosition())
94 , m_rubyPosition(ComputedStyle::initialRubyPosition())
95 , m_subtreeWillChangeContents(false)
96 , m_selfOrAncestorHasDirAutoAttribute(false)
97 , m_respectImageOrientation(false)
98 , hyphenationLimitBefore(-1)
99 , hyphenationLimitAfter(-1)
100 , hyphenationLimitLines(-1)
101 , tapHighlightColor(ComputedStyle::initialTapHighlightColor())
102 , m_tabSize(ComputedStyle::initialTabSize())
106 StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o)
107 : RefCounted<StyleRareInheritedData>()
108 , listStyleImage(o.listStyleImage)
109 , m_textStrokeColor(o.m_textStrokeColor)
110 , textStrokeWidth(o.textStrokeWidth)
111 , m_textFillColor(o.m_textFillColor)
112 , m_textEmphasisColor(o.m_textEmphasisColor)
113 , m_visitedLinkTextStrokeColor(o.m_visitedLinkTextStrokeColor)
114 , m_visitedLinkTextFillColor(o.m_visitedLinkTextFillColor)
115 , m_visitedLinkTextEmphasisColor(o.m_visitedLinkTextEmphasisColor)
116 , textShadow(o.textShadow)
117 , highlight(o.highlight)
118 , cursorData(o.cursorData)
119 , indent(o.indent)
120 , m_effectiveZoom(o.m_effectiveZoom)
121 , widows(o.widows)
122 , orphans(o.orphans)
123 , m_hasAutoOrphans(o.m_hasAutoOrphans)
124 , m_textStrokeColorIsCurrentColor(o.m_textStrokeColorIsCurrentColor)
125 , m_textFillColorIsCurrentColor(o.m_textFillColorIsCurrentColor)
126 , m_textEmphasisColorIsCurrentColor(o.m_textEmphasisColorIsCurrentColor)
127 , m_visitedLinkTextStrokeColorIsCurrentColor(o.m_visitedLinkTextStrokeColorIsCurrentColor)
128 , m_visitedLinkTextFillColorIsCurrentColor(o.m_visitedLinkTextFillColorIsCurrentColor)
129 , m_visitedLinkTextEmphasisColorIsCurrentColor(o.m_visitedLinkTextEmphasisColorIsCurrentColor)
130 , textSecurity(o.textSecurity)
131 , userModify(o.userModify)
132 , wordBreak(o.wordBreak)
133 , overflowWrap(o.overflowWrap)
134 , lineBreak(o.lineBreak)
135 , userSelect(o.userSelect)
136 , speak(o.speak)
137 , hyphens(o.hyphens)
138 , textEmphasisFill(o.textEmphasisFill)
139 , textEmphasisMark(o.textEmphasisMark)
140 , textEmphasisPosition(o.textEmphasisPosition)
141 , m_textAlignLast(o.m_textAlignLast)
142 , m_textJustify(o.m_textJustify)
143 , m_textOrientation(o.m_textOrientation)
144 , m_textCombine(o.m_textCombine)
145 , m_textIndentLine(o.m_textIndentLine)
146 , m_textIndentType(o.m_textIndentType)
147 , m_imageRendering(o.m_imageRendering)
148 , m_textUnderlinePosition(o.m_textUnderlinePosition)
149 , m_rubyPosition(o.m_rubyPosition)
150 , m_subtreeWillChangeContents(o.m_subtreeWillChangeContents)
151 , m_selfOrAncestorHasDirAutoAttribute(o.m_selfOrAncestorHasDirAutoAttribute)
152 , m_respectImageOrientation(o.m_respectImageOrientation)
153 , hyphenationString(o.hyphenationString)
154 , hyphenationLimitBefore(o.hyphenationLimitBefore)
155 , hyphenationLimitAfter(o.hyphenationLimitAfter)
156 , hyphenationLimitLines(o.hyphenationLimitLines)
157 , locale(o.locale)
158 , textEmphasisCustomMark(o.textEmphasisCustomMark)
159 , tapHighlightColor(o.tapHighlightColor)
160 , appliedTextDecorations(o.appliedTextDecorations)
161 , m_tabSize(o.m_tabSize)
165 StyleRareInheritedData::~StyleRareInheritedData()
169 bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
171 return m_textStrokeColor == o.m_textStrokeColor
172 && textStrokeWidth == o.textStrokeWidth
173 && m_textFillColor == o.m_textFillColor
174 && m_textEmphasisColor == o.m_textEmphasisColor
175 && m_visitedLinkTextStrokeColor == o.m_visitedLinkTextStrokeColor
176 && m_visitedLinkTextFillColor == o.m_visitedLinkTextFillColor
177 && m_visitedLinkTextEmphasisColor == o.m_visitedLinkTextEmphasisColor
178 && tapHighlightColor == o.tapHighlightColor
179 && shadowDataEquivalent(o)
180 && highlight == o.highlight
181 && dataEquivalent(cursorData.get(), o.cursorData.get())
182 && indent == o.indent
183 && m_effectiveZoom == o.m_effectiveZoom
184 && widows == o.widows
185 && orphans == o.orphans
186 && m_hasAutoOrphans == o.m_hasAutoOrphans
187 && m_textStrokeColorIsCurrentColor == o.m_textStrokeColorIsCurrentColor
188 && m_textFillColorIsCurrentColor == o.m_textFillColorIsCurrentColor
189 && m_textEmphasisColorIsCurrentColor == o.m_textEmphasisColorIsCurrentColor
190 && m_visitedLinkTextStrokeColorIsCurrentColor == o.m_visitedLinkTextStrokeColorIsCurrentColor
191 && m_visitedLinkTextFillColorIsCurrentColor == o.m_visitedLinkTextFillColorIsCurrentColor
192 && m_visitedLinkTextEmphasisColorIsCurrentColor == o.m_visitedLinkTextEmphasisColorIsCurrentColor
193 && textSecurity == o.textSecurity
194 && userModify == o.userModify
195 && wordBreak == o.wordBreak
196 && overflowWrap == o.overflowWrap
197 && lineBreak == o.lineBreak
198 && userSelect == o.userSelect
199 && speak == o.speak
200 && hyphens == o.hyphens
201 && hyphenationLimitBefore == o.hyphenationLimitBefore
202 && hyphenationLimitAfter == o.hyphenationLimitAfter
203 && hyphenationLimitLines == o.hyphenationLimitLines
204 && textEmphasisFill == o.textEmphasisFill
205 && textEmphasisMark == o.textEmphasisMark
206 && textEmphasisPosition == o.textEmphasisPosition
207 && m_textAlignLast == o.m_textAlignLast
208 && m_textJustify == o.m_textJustify
209 && m_textOrientation == o.m_textOrientation
210 && m_textCombine == o.m_textCombine
211 && m_textIndentLine == o.m_textIndentLine
212 && m_textIndentType == o.m_textIndentType
213 && m_subtreeWillChangeContents == o.m_subtreeWillChangeContents
214 && m_selfOrAncestorHasDirAutoAttribute == o.m_selfOrAncestorHasDirAutoAttribute
215 && m_respectImageOrientation == o.m_respectImageOrientation
216 && hyphenationString == o.hyphenationString
217 && locale == o.locale
218 && textEmphasisCustomMark == o.textEmphasisCustomMark
219 && quotesDataEquivalent(o)
220 && m_tabSize == o.m_tabSize
221 && m_imageRendering == o.m_imageRendering
222 && m_textUnderlinePosition == o.m_textUnderlinePosition
223 && m_rubyPosition == o.m_rubyPosition
224 && dataEquivalent(listStyleImage.get(), o.listStyleImage.get())
225 && dataEquivalent(appliedTextDecorations, o.appliedTextDecorations);
228 bool StyleRareInheritedData::shadowDataEquivalent(const StyleRareInheritedData& o) const
230 return dataEquivalent(textShadow.get(), o.textShadow.get());
233 bool StyleRareInheritedData::quotesDataEquivalent(const StyleRareInheritedData& o) const
235 return dataEquivalent(quotes, o.quotes);
238 } // namespace blink