OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2000 Lars Knoll (knoll@kde.org) |
3 * (C) 2000 Antti Koivisto (koivisto@kde.org) | 3 * (C) 2000 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All | 5 * Copyright (C) 2003, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
6 * rights reserved. | 6 * rights reserved. |
7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 std::unique_ptr<PseudoStyleCache> m_cachedPseudoStyles; | 191 std::unique_ptr<PseudoStyleCache> m_cachedPseudoStyles; |
192 | 192 |
193 DataRef<SVGComputedStyle> m_svgStyle; | 193 DataRef<SVGComputedStyle> m_svgStyle; |
194 | 194 |
195 // !START SYNC!: Keep this in sync with the copy constructor in | 195 // !START SYNC!: Keep this in sync with the copy constructor in |
196 // ComputedStyle.cpp. | 196 // ComputedStyle.cpp. |
197 | 197 |
198 // inherit | 198 // inherit |
199 struct InheritedData { | 199 struct InheritedData { |
200 bool operator==(const InheritedData& other) const { | 200 bool operator==(const InheritedData& other) const { |
| 201 // Generated properties are compared in ComputedStyleBase |
201 return (m_hasSimpleUnderline == other.m_hasSimpleUnderline) && | 202 return (m_hasSimpleUnderline == other.m_hasSimpleUnderline) && |
202 (m_cursorStyle == other.m_cursorStyle) && | 203 (m_cursorStyle == other.m_cursorStyle) && |
203 (m_insideLink == other.m_insideLink); | 204 (m_insideLink == other.m_insideLink); |
204 } | 205 } |
205 | 206 |
206 bool operator!=(const InheritedData& other) const { | 207 bool operator!=(const InheritedData& other) const { |
207 return !(*this == other); | 208 return !(*this == other); |
208 } | 209 } |
209 | 210 |
210 unsigned m_hasSimpleUnderline : 1; // True if 'underline solid' is the only | 211 unsigned m_hasSimpleUnderline : 1; // True if 'underline solid' is the only |
211 // text decoration on this element. | 212 // text decoration on this element. |
212 unsigned m_cursorStyle : 6; // ECursor | 213 unsigned m_cursorStyle : 6; // ECursor |
213 | 214 |
214 // non CSS2 inherited | 215 // non CSS2 inherited |
215 unsigned m_insideLink : 2; // EInsideLink | 216 unsigned m_insideLink : 2; // EInsideLink |
216 } m_inheritedData; | 217 } m_inheritedData; |
217 | 218 |
218 // don't inherit | 219 // don't inherit |
219 struct NonInheritedData { | 220 struct NonInheritedData { |
220 // Compare computed styles, differences in inherited bits or other flags | 221 // Compare computed styles, differences in inherited bits or other flags |
221 // should not cause an inequality. | 222 // should not cause an inequality. |
222 bool operator==(const NonInheritedData& other) const { | 223 bool operator==(const NonInheritedData& other) const { |
| 224 // Generated properties are compared in ComputedStyleBase |
223 return m_effectiveDisplay == other.m_effectiveDisplay && | 225 return m_effectiveDisplay == other.m_effectiveDisplay && |
224 m_originalDisplay == other.m_originalDisplay && | 226 m_originalDisplay == other.m_originalDisplay && |
225 m_overflowX == other.m_overflowX && | 227 m_overflowX == other.m_overflowX && |
226 m_overflowY == other.m_overflowY && | 228 m_overflowY == other.m_overflowY && |
227 m_verticalAlign == other.m_verticalAlign && | 229 m_verticalAlign == other.m_verticalAlign && |
228 m_position == other.m_position && | 230 m_position == other.m_position && |
229 m_tableLayout == other.m_tableLayout && | |
230 // hasViewportUnits | 231 // hasViewportUnits |
231 m_breakBefore == other.m_breakBefore && | 232 m_breakBefore == other.m_breakBefore && |
232 m_breakAfter == other.m_breakAfter && | 233 m_breakAfter == other.m_breakAfter && |
233 m_breakInside == other.m_breakInside; | 234 m_breakInside == other.m_breakInside; |
234 // styleType | 235 // styleType |
235 // pseudoBits | 236 // pseudoBits |
236 // explicitInheritance | 237 // explicitInheritance |
237 // unique | 238 // unique |
238 // emptyState | 239 // emptyState |
239 // affectedByFocus | 240 // affectedByFocus |
240 // affectedByHover | 241 // affectedByHover |
241 // affectedByActive | 242 // affectedByActive |
242 // affectedByDrag | 243 // affectedByDrag |
243 // isLink | 244 // isLink |
244 // isInherited flags | 245 // isInherited flags |
245 } | 246 } |
246 | 247 |
247 bool operator!=(const NonInheritedData& other) const { | 248 bool operator!=(const NonInheritedData& other) const { |
248 return !(*this == other); | 249 return !(*this == other); |
249 } | 250 } |
250 | 251 |
251 unsigned m_effectiveDisplay : 5; // EDisplay | 252 unsigned m_effectiveDisplay : 5; // EDisplay |
252 unsigned m_originalDisplay : 5; // EDisplay | 253 unsigned m_originalDisplay : 5; // EDisplay |
253 unsigned m_overflowX : 3; // EOverflow | 254 unsigned m_overflowX : 3; // EOverflow |
254 unsigned m_overflowY : 3; // EOverflow | 255 unsigned m_overflowY : 3; // EOverflow |
255 unsigned m_verticalAlign : 4; // EVerticalAlign | 256 unsigned m_verticalAlign : 4; // EVerticalAlign |
256 unsigned m_position : 3; // EPosition | 257 unsigned m_position : 3; // EPosition |
257 unsigned m_tableLayout : 1; // ETableLayout | |
258 | 258 |
259 // This is set if we used viewport units when resolving a length. | 259 // This is set if we used viewport units when resolving a length. |
260 // It is mutable so we can pass around const ComputedStyles to resolve | 260 // It is mutable so we can pass around const ComputedStyles to resolve |
261 // lengths. | 261 // lengths. |
262 mutable unsigned m_hasViewportUnits : 1; | 262 mutable unsigned m_hasViewportUnits : 1; |
263 | 263 |
264 // 32 bits | 264 // 32 bits |
265 | 265 |
266 unsigned m_breakBefore : 4; // EBreak | 266 unsigned m_breakBefore : 4; // EBreak |
267 unsigned m_breakAfter : 4; // EBreak | 267 unsigned m_breakAfter : 4; // EBreak |
(...skipping 20 matching lines...) Expand all Loading... |
288 | 288 |
289 mutable unsigned m_hasRemUnits : 1; | 289 mutable unsigned m_hasRemUnits : 1; |
290 | 290 |
291 // If you add more style bits here, you will also need to update | 291 // If you add more style bits here, you will also need to update |
292 // ComputedStyle::copyNonInheritedFromCached() 68 bits | 292 // ComputedStyle::copyNonInheritedFromCached() 68 bits |
293 } m_nonInheritedData; | 293 } m_nonInheritedData; |
294 | 294 |
295 // !END SYNC! | 295 // !END SYNC! |
296 | 296 |
297 void setBitDefaults() { | 297 void setBitDefaults() { |
| 298 // Generated properties are updated in ComputedStyleBase |
298 ComputedStyleBase::setBitDefaults(); | 299 ComputedStyleBase::setBitDefaults(); |
299 m_inheritedData.m_hasSimpleUnderline = false; | 300 m_inheritedData.m_hasSimpleUnderline = false; |
300 m_inheritedData.m_cursorStyle = static_cast<unsigned>(initialCursor()); | 301 m_inheritedData.m_cursorStyle = static_cast<unsigned>(initialCursor()); |
301 m_inheritedData.m_insideLink = | 302 m_inheritedData.m_insideLink = |
302 static_cast<unsigned>(EInsideLink::kNotInsideLink); | 303 static_cast<unsigned>(EInsideLink::kNotInsideLink); |
303 | 304 |
304 m_nonInheritedData.m_effectiveDisplay = | 305 m_nonInheritedData.m_effectiveDisplay = |
305 m_nonInheritedData.m_originalDisplay = | 306 m_nonInheritedData.m_originalDisplay = |
306 static_cast<unsigned>(initialDisplay()); | 307 static_cast<unsigned>(initialDisplay()); |
307 m_nonInheritedData.m_overflowX = static_cast<unsigned>(initialOverflowX()); | 308 m_nonInheritedData.m_overflowX = static_cast<unsigned>(initialOverflowX()); |
308 m_nonInheritedData.m_overflowY = static_cast<unsigned>(initialOverflowY()); | 309 m_nonInheritedData.m_overflowY = static_cast<unsigned>(initialOverflowY()); |
309 m_nonInheritedData.m_verticalAlign = | 310 m_nonInheritedData.m_verticalAlign = |
310 static_cast<unsigned>(initialVerticalAlign()); | 311 static_cast<unsigned>(initialVerticalAlign()); |
311 m_nonInheritedData.m_position = initialPosition(); | 312 m_nonInheritedData.m_position = initialPosition(); |
312 m_nonInheritedData.m_tableLayout = | |
313 static_cast<unsigned>(initialTableLayout()); | |
314 m_nonInheritedData.m_breakBefore = initialBreakBefore(); | 313 m_nonInheritedData.m_breakBefore = initialBreakBefore(); |
315 m_nonInheritedData.m_breakAfter = initialBreakAfter(); | 314 m_nonInheritedData.m_breakAfter = initialBreakAfter(); |
316 m_nonInheritedData.m_breakInside = initialBreakInside(); | 315 m_nonInheritedData.m_breakInside = initialBreakInside(); |
317 m_nonInheritedData.m_styleType = PseudoIdNone; | 316 m_nonInheritedData.m_styleType = PseudoIdNone; |
318 m_nonInheritedData.m_pseudoBits = 0; | 317 m_nonInheritedData.m_pseudoBits = 0; |
319 m_nonInheritedData.m_explicitInheritance = false; | 318 m_nonInheritedData.m_explicitInheritance = false; |
320 m_nonInheritedData.m_variableReference = false; | 319 m_nonInheritedData.m_variableReference = false; |
321 m_nonInheritedData.m_unique = false; | 320 m_nonInheritedData.m_unique = false; |
322 m_nonInheritedData.m_emptyState = false; | 321 m_nonInheritedData.m_emptyState = false; |
323 m_nonInheritedData.m_hasViewportUnits = false; | 322 m_nonInheritedData.m_hasViewportUnits = false; |
(...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1747 } | 1746 } |
1748 PageSizeType getPageSizeType() const { | 1747 PageSizeType getPageSizeType() const { |
1749 return static_cast<PageSizeType>(m_rareNonInheritedData->m_pageSizeType); | 1748 return static_cast<PageSizeType>(m_rareNonInheritedData->m_pageSizeType); |
1750 } | 1749 } |
1751 void setPageSize(const FloatSize& s) { | 1750 void setPageSize(const FloatSize& s) { |
1752 SET_VAR(m_rareNonInheritedData, m_pageSize, s); | 1751 SET_VAR(m_rareNonInheritedData, m_pageSize, s); |
1753 } | 1752 } |
1754 void setPageSizeType(PageSizeType t) { | 1753 void setPageSizeType(PageSizeType t) { |
1755 SET_VAR(m_rareNonInheritedData, m_pageSizeType, t); | 1754 SET_VAR(m_rareNonInheritedData, m_pageSizeType, t); |
1756 } | 1755 } |
1757 // table-layout | |
1758 static ETableLayout initialTableLayout() { return ETableLayout::kAuto; } | |
1759 ETableLayout tableLayout() const { | |
1760 return static_cast<ETableLayout>(m_nonInheritedData.m_tableLayout); | |
1761 } | |
1762 void setTableLayout(ETableLayout v) { | |
1763 m_nonInheritedData.m_tableLayout = static_cast<unsigned>(v); | |
1764 } | |
1765 | 1756 |
1766 // Text decoration properties. | 1757 // Text decoration properties. |
1767 // text-decoration-line | 1758 // text-decoration-line |
1768 static TextDecoration initialTextDecoration() { return TextDecorationNone; } | 1759 static TextDecoration initialTextDecoration() { return TextDecorationNone; } |
1769 TextDecoration getTextDecoration() const { | 1760 TextDecoration getTextDecoration() const { |
1770 return static_cast<TextDecoration>(m_visual->textDecoration); | 1761 return static_cast<TextDecoration>(m_visual->textDecoration); |
1771 } | 1762 } |
1772 void setTextDecoration(TextDecoration v) { | 1763 void setTextDecoration(TextDecoration v) { |
1773 SET_VAR(m_visual, textDecoration, v); | 1764 SET_VAR(m_visual, textDecoration, v); |
1774 } | 1765 } |
(...skipping 2150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3925 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); | 3916 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); |
3926 } | 3917 } |
3927 | 3918 |
3928 inline bool ComputedStyle::hasPseudoElementStyle() const { | 3919 inline bool ComputedStyle::hasPseudoElementStyle() const { |
3929 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; | 3920 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; |
3930 } | 3921 } |
3931 | 3922 |
3932 } // namespace blink | 3923 } // namespace blink |
3933 | 3924 |
3934 #endif // ComputedStyle_h | 3925 #endif // ComputedStyle_h |
OLD | NEW |