OLD | NEW |
| (Empty) |
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. | |
4 * | |
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. | |
9 * | |
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. | |
14 * | |
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. | |
19 * | |
20 */ | |
21 | |
22 #include "config.h" | |
23 #include "core/layout/style/StyleRareInheritedData.h" | |
24 | |
25 #include "core/layout/style/AppliedTextDecoration.h" | |
26 #include "core/layout/style/CursorData.h" | |
27 #include "core/layout/style/DataEquivalency.h" | |
28 #include "core/layout/style/ComputedStyle.h" | |
29 #include "core/layout/style/ComputedStyleConstants.h" | |
30 #include "core/layout/style/QuotesData.h" | |
31 #include "core/layout/style/ShadowList.h" | |
32 #include "core/layout/style/StyleImage.h" | |
33 | |
34 namespace blink { | |
35 | |
36 struct SameSizeAsStyleRareInheritedData : public RefCounted<SameSizeAsStyleRareI
nheritedData> { | |
37 void* styleImage; | |
38 Color firstColor; | |
39 float firstFloat; | |
40 Color colors[5]; | |
41 void* ownPtrs[1]; | |
42 AtomicString atomicStrings[4]; | |
43 void* refPtrs[3]; | |
44 Length lengths[1]; | |
45 float secondFloat; | |
46 unsigned m_bitfields[2]; | |
47 short pagedMediaShorts[2]; | |
48 short hyphenationShorts[3]; | |
49 | |
50 Color touchColors; | |
51 TabSize tabSize; | |
52 }; | |
53 | |
54 static_assert(sizeof(StyleRareInheritedData) == sizeof(SameSizeAsStyleRareInheri
tedData), "StyleRareInheritedData should stay small"); | |
55 | |
56 StyleRareInheritedData::StyleRareInheritedData() | |
57 : listStyleImage(ComputedStyle::initialListStyleImage()) | |
58 , textStrokeWidth(ComputedStyle::initialTextStrokeWidth()) | |
59 , indent(ComputedStyle::initialTextIndent()) | |
60 , m_effectiveZoom(ComputedStyle::initialZoom()) | |
61 , widows(ComputedStyle::initialWidows()) | |
62 , orphans(ComputedStyle::initialOrphans()) | |
63 , m_hasAutoOrphans(true) | |
64 , m_textStrokeColorIsCurrentColor(true) | |
65 , m_textFillColorIsCurrentColor(true) | |
66 , m_textEmphasisColorIsCurrentColor(true) | |
67 , m_visitedLinkTextStrokeColorIsCurrentColor(true) | |
68 , m_visitedLinkTextFillColorIsCurrentColor(true) | |
69 , m_visitedLinkTextEmphasisColorIsCurrentColor(true) | |
70 , textSecurity(ComputedStyle::initialTextSecurity()) | |
71 , userModify(READ_ONLY) | |
72 , wordBreak(ComputedStyle::initialWordBreak()) | |
73 , overflowWrap(ComputedStyle::initialOverflowWrap()) | |
74 , lineBreak(LineBreakAuto) | |
75 , userSelect(ComputedStyle::initialUserSelect()) | |
76 , speak(SpeakNormal) | |
77 , hyphens(HyphensManual) | |
78 , textEmphasisFill(TextEmphasisFillFilled) | |
79 , textEmphasisMark(TextEmphasisMarkNone) | |
80 , textEmphasisPosition(TextEmphasisPositionOver) | |
81 , m_textAlignLast(ComputedStyle::initialTextAlignLast()) | |
82 , m_textJustify(ComputedStyle::initialTextJustify()) | |
83 , m_textOrientation(TextOrientationVerticalRight) | |
84 , m_textIndentLine(ComputedStyle::initialTextIndentLine()) | |
85 , m_textIndentType(ComputedStyle::initialTextIndentLine()) | |
86 , m_lineBoxContain(ComputedStyle::initialLineBoxContain()) | |
87 , m_imageRendering(ComputedStyle::initialImageRendering()) | |
88 , m_textUnderlinePosition(ComputedStyle::initialTextUnderlinePosition()) | |
89 , m_rubyPosition(ComputedStyle::initialRubyPosition()) | |
90 , m_subtreeWillChangeContents(false) | |
91 , m_selfOrAncestorHasDirAutoAttribute(false) | |
92 , hyphenationLimitBefore(-1) | |
93 , hyphenationLimitAfter(-1) | |
94 , hyphenationLimitLines(-1) | |
95 , tapHighlightColor(ComputedStyle::initialTapHighlightColor()) | |
96 , m_tabSize(ComputedStyle::initialTabSize()) | |
97 { | |
98 } | |
99 | |
100 StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o) | |
101 : RefCounted<StyleRareInheritedData>() | |
102 , listStyleImage(o.listStyleImage) | |
103 , m_textStrokeColor(o.m_textStrokeColor) | |
104 , textStrokeWidth(o.textStrokeWidth) | |
105 , m_textFillColor(o.m_textFillColor) | |
106 , m_textEmphasisColor(o.m_textEmphasisColor) | |
107 , m_visitedLinkTextStrokeColor(o.m_visitedLinkTextStrokeColor) | |
108 , m_visitedLinkTextFillColor(o.m_visitedLinkTextFillColor) | |
109 , m_visitedLinkTextEmphasisColor(o.m_visitedLinkTextEmphasisColor) | |
110 , textShadow(o.textShadow) | |
111 , highlight(o.highlight) | |
112 , cursorData(o.cursorData) | |
113 , indent(o.indent) | |
114 , m_effectiveZoom(o.m_effectiveZoom) | |
115 , widows(o.widows) | |
116 , orphans(o.orphans) | |
117 , m_hasAutoOrphans(o.m_hasAutoOrphans) | |
118 , m_textStrokeColorIsCurrentColor(o.m_textStrokeColorIsCurrentColor) | |
119 , m_textFillColorIsCurrentColor(o.m_textFillColorIsCurrentColor) | |
120 , m_textEmphasisColorIsCurrentColor(o.m_textEmphasisColorIsCurrentColor) | |
121 , m_visitedLinkTextStrokeColorIsCurrentColor(o.m_visitedLinkTextStrokeColorI
sCurrentColor) | |
122 , m_visitedLinkTextFillColorIsCurrentColor(o.m_visitedLinkTextFillColorIsCur
rentColor) | |
123 , m_visitedLinkTextEmphasisColorIsCurrentColor(o.m_visitedLinkTextEmphasisCo
lorIsCurrentColor) | |
124 , textSecurity(o.textSecurity) | |
125 , userModify(o.userModify) | |
126 , wordBreak(o.wordBreak) | |
127 , overflowWrap(o.overflowWrap) | |
128 , lineBreak(o.lineBreak) | |
129 , userSelect(o.userSelect) | |
130 , speak(o.speak) | |
131 , hyphens(o.hyphens) | |
132 , textEmphasisFill(o.textEmphasisFill) | |
133 , textEmphasisMark(o.textEmphasisMark) | |
134 , textEmphasisPosition(o.textEmphasisPosition) | |
135 , m_textAlignLast(o.m_textAlignLast) | |
136 , m_textJustify(o.m_textJustify) | |
137 , m_textOrientation(o.m_textOrientation) | |
138 , m_textIndentLine(o.m_textIndentLine) | |
139 , m_textIndentType(o.m_textIndentType) | |
140 , m_lineBoxContain(o.m_lineBoxContain) | |
141 , m_imageRendering(o.m_imageRendering) | |
142 , m_textUnderlinePosition(o.m_textUnderlinePosition) | |
143 , m_rubyPosition(o.m_rubyPosition) | |
144 , m_subtreeWillChangeContents(o.m_subtreeWillChangeContents) | |
145 , m_selfOrAncestorHasDirAutoAttribute(o.m_selfOrAncestorHasDirAutoAttribute) | |
146 , hyphenationString(o.hyphenationString) | |
147 , hyphenationLimitBefore(o.hyphenationLimitBefore) | |
148 , hyphenationLimitAfter(o.hyphenationLimitAfter) | |
149 , hyphenationLimitLines(o.hyphenationLimitLines) | |
150 , locale(o.locale) | |
151 , textEmphasisCustomMark(o.textEmphasisCustomMark) | |
152 , tapHighlightColor(o.tapHighlightColor) | |
153 , appliedTextDecorations(o.appliedTextDecorations) | |
154 , m_tabSize(o.m_tabSize) | |
155 { | |
156 } | |
157 | |
158 StyleRareInheritedData::~StyleRareInheritedData() | |
159 { | |
160 } | |
161 | |
162 bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const | |
163 { | |
164 return m_textStrokeColor == o.m_textStrokeColor | |
165 && textStrokeWidth == o.textStrokeWidth | |
166 && m_textFillColor == o.m_textFillColor | |
167 && m_textEmphasisColor == o.m_textEmphasisColor | |
168 && m_visitedLinkTextStrokeColor == o.m_visitedLinkTextStrokeColor | |
169 && m_visitedLinkTextFillColor == o.m_visitedLinkTextFillColor | |
170 && m_visitedLinkTextEmphasisColor == o.m_visitedLinkTextEmphasisColor | |
171 && tapHighlightColor == o.tapHighlightColor | |
172 && shadowDataEquivalent(o) | |
173 && highlight == o.highlight | |
174 && dataEquivalent(cursorData.get(), o.cursorData.get()) | |
175 && indent == o.indent | |
176 && m_effectiveZoom == o.m_effectiveZoom | |
177 && widows == o.widows | |
178 && orphans == o.orphans | |
179 && m_hasAutoOrphans == o.m_hasAutoOrphans | |
180 && m_textStrokeColorIsCurrentColor == o.m_textStrokeColorIsCurrentColor | |
181 && m_textFillColorIsCurrentColor == o.m_textFillColorIsCurrentColor | |
182 && m_textEmphasisColorIsCurrentColor == o.m_textEmphasisColorIsCurrentCo
lor | |
183 && m_visitedLinkTextStrokeColorIsCurrentColor == o.m_visitedLinkTextStro
keColorIsCurrentColor | |
184 && m_visitedLinkTextFillColorIsCurrentColor == o.m_visitedLinkTextFillCo
lorIsCurrentColor | |
185 && m_visitedLinkTextEmphasisColorIsCurrentColor == o.m_visitedLinkTextEm
phasisColorIsCurrentColor | |
186 && textSecurity == o.textSecurity | |
187 && userModify == o.userModify | |
188 && wordBreak == o.wordBreak | |
189 && overflowWrap == o.overflowWrap | |
190 && lineBreak == o.lineBreak | |
191 && userSelect == o.userSelect | |
192 && speak == o.speak | |
193 && hyphens == o.hyphens | |
194 && hyphenationLimitBefore == o.hyphenationLimitBefore | |
195 && hyphenationLimitAfter == o.hyphenationLimitAfter | |
196 && hyphenationLimitLines == o.hyphenationLimitLines | |
197 && textEmphasisFill == o.textEmphasisFill | |
198 && textEmphasisMark == o.textEmphasisMark | |
199 && textEmphasisPosition == o.textEmphasisPosition | |
200 && m_textAlignLast == o.m_textAlignLast | |
201 && m_textJustify == o.m_textJustify | |
202 && m_textOrientation == o.m_textOrientation | |
203 && m_textIndentLine == o.m_textIndentLine | |
204 && m_textIndentType == o.m_textIndentType | |
205 && m_lineBoxContain == o.m_lineBoxContain | |
206 && m_subtreeWillChangeContents == o.m_subtreeWillChangeContents | |
207 && m_selfOrAncestorHasDirAutoAttribute == o.m_selfOrAncestorHasDirAutoAt
tribute | |
208 && hyphenationString == o.hyphenationString | |
209 && locale == o.locale | |
210 && textEmphasisCustomMark == o.textEmphasisCustomMark | |
211 && quotesDataEquivalent(o) | |
212 && m_tabSize == o.m_tabSize | |
213 && m_imageRendering == o.m_imageRendering | |
214 && m_textUnderlinePosition == o.m_textUnderlinePosition | |
215 && m_rubyPosition == o.m_rubyPosition | |
216 && dataEquivalent(listStyleImage.get(), o.listStyleImage.get()) | |
217 && dataEquivalent(appliedTextDecorations, o.appliedTextDecorations); | |
218 } | |
219 | |
220 bool StyleRareInheritedData::shadowDataEquivalent(const StyleRareInheritedData&
o) const | |
221 { | |
222 return dataEquivalent(textShadow.get(), o.textShadow.get()); | |
223 } | |
224 | |
225 bool StyleRareInheritedData::quotesDataEquivalent(const StyleRareInheritedData&
o) const | |
226 { | |
227 return dataEquivalent(quotes, o.quotes); | |
228 } | |
229 | |
230 } // namespace blink | |
OLD | NEW |