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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 218 |
219 // don't inherit | 219 // don't inherit |
220 struct NonInheritedData { | 220 struct NonInheritedData { |
221 // Compare computed styles, differences in inherited bits or other flags | 221 // Compare computed styles, differences in inherited bits or other flags |
222 // should not cause an inequality. | 222 // should not cause an inequality. |
223 bool operator==(const NonInheritedData& other) const { | 223 bool operator==(const NonInheritedData& other) const { |
224 // Generated properties are compared in ComputedStyleBase | 224 // Generated properties are compared in ComputedStyleBase |
225 return m_effectiveDisplay == other.m_effectiveDisplay && | 225 return m_effectiveDisplay == other.m_effectiveDisplay && |
226 m_originalDisplay == other.m_originalDisplay && | 226 m_originalDisplay == other.m_originalDisplay && |
227 m_verticalAlign == other.m_verticalAlign && | 227 m_verticalAlign == other.m_verticalAlign && |
228 m_position == other.m_position && | 228 m_position == other.m_position; |
229 // hasViewportUnits | 229 // Differences in the following fields do not cause inequality: |
230 m_breakBefore == other.m_breakBefore && | 230 // hasViewportUnits |
231 m_breakAfter == other.m_breakAfter && | |
232 m_breakInside == other.m_breakInside; | |
233 // styleType | 231 // styleType |
234 // pseudoBits | 232 // pseudoBits |
235 // explicitInheritance | 233 // explicitInheritance |
236 // unique | 234 // unique |
237 // emptyState | 235 // emptyState |
238 // affectedByFocus | 236 // affectedByFocus |
239 // affectedByHover | 237 // affectedByHover |
240 // affectedByActive | 238 // affectedByActive |
241 // affectedByDrag | 239 // affectedByDrag |
242 // isLink | 240 // isLink |
243 // isInherited flags | 241 // isInherited flags |
244 } | 242 } |
245 | 243 |
246 bool operator!=(const NonInheritedData& other) const { | 244 bool operator!=(const NonInheritedData& other) const { |
247 return !(*this == other); | 245 return !(*this == other); |
248 } | 246 } |
249 | 247 |
250 unsigned m_effectiveDisplay : 5; // EDisplay | 248 unsigned m_effectiveDisplay : 5; // EDisplay |
251 unsigned m_originalDisplay : 5; // EDisplay | 249 unsigned m_originalDisplay : 5; // EDisplay |
252 unsigned m_verticalAlign : 4; // EVerticalAlign | 250 unsigned m_verticalAlign : 4; // EVerticalAlign |
253 unsigned m_position : 3; // EPosition | 251 unsigned m_position : 3; // EPosition |
254 | 252 |
255 // This is set if we used viewport units when resolving a length. | 253 // This is set if we used viewport units when resolving a length. |
256 // It is mutable so we can pass around const ComputedStyles to resolve | 254 // It is mutable so we can pass around const ComputedStyles to resolve |
257 // lengths. | 255 // lengths. |
258 mutable unsigned m_hasViewportUnits : 1; | 256 mutable unsigned m_hasViewportUnits : 1; |
259 | 257 |
260 // 32 bits | 258 // 32 bits |
261 | 259 |
262 unsigned m_breakBefore : 4; // EBreakBetween | |
263 unsigned m_breakAfter : 4; // EBreakBetween | |
264 unsigned m_breakInside : 2; // EBreakInside | |
265 | |
266 unsigned m_styleType : 6; // PseudoId | 260 unsigned m_styleType : 6; // PseudoId |
267 unsigned m_pseudoBits : 8; | 261 unsigned m_pseudoBits : 8; |
268 unsigned m_explicitInheritance : 1; // Explicitly inherits a non-inherited | 262 unsigned m_explicitInheritance : 1; // Explicitly inherits a non-inherited |
269 // property | 263 // property |
270 unsigned m_variableReference : 1; // A non-inherited property references a | 264 unsigned m_variableReference : 1; // A non-inherited property references a |
271 // variable or @apply is used. | 265 // variable or @apply is used. |
272 unsigned m_unique : 1; // Style can not be shared. | 266 unsigned m_unique : 1; // Style can not be shared. |
273 | 267 |
274 unsigned m_emptyState : 1; | 268 unsigned m_emptyState : 1; |
275 | 269 |
(...skipping 21 matching lines...) Expand all Loading... |
297 m_inheritedData.m_cursorStyle = static_cast<unsigned>(initialCursor()); | 291 m_inheritedData.m_cursorStyle = static_cast<unsigned>(initialCursor()); |
298 m_inheritedData.m_insideLink = | 292 m_inheritedData.m_insideLink = |
299 static_cast<unsigned>(EInsideLink::kNotInsideLink); | 293 static_cast<unsigned>(EInsideLink::kNotInsideLink); |
300 | 294 |
301 m_nonInheritedData.m_effectiveDisplay = | 295 m_nonInheritedData.m_effectiveDisplay = |
302 m_nonInheritedData.m_originalDisplay = | 296 m_nonInheritedData.m_originalDisplay = |
303 static_cast<unsigned>(initialDisplay()); | 297 static_cast<unsigned>(initialDisplay()); |
304 m_nonInheritedData.m_verticalAlign = | 298 m_nonInheritedData.m_verticalAlign = |
305 static_cast<unsigned>(initialVerticalAlign()); | 299 static_cast<unsigned>(initialVerticalAlign()); |
306 m_nonInheritedData.m_position = initialPosition(); | 300 m_nonInheritedData.m_position = initialPosition(); |
307 m_nonInheritedData.m_breakBefore = | |
308 static_cast<unsigned>(initialBreakBefore()); | |
309 m_nonInheritedData.m_breakAfter = | |
310 static_cast<unsigned>(initialBreakAfter()); | |
311 m_nonInheritedData.m_breakInside = | |
312 static_cast<unsigned>(initialBreakInside()); | |
313 m_nonInheritedData.m_styleType = PseudoIdNone; | 301 m_nonInheritedData.m_styleType = PseudoIdNone; |
314 m_nonInheritedData.m_pseudoBits = 0; | 302 m_nonInheritedData.m_pseudoBits = 0; |
315 m_nonInheritedData.m_explicitInheritance = false; | 303 m_nonInheritedData.m_explicitInheritance = false; |
316 m_nonInheritedData.m_variableReference = false; | 304 m_nonInheritedData.m_variableReference = false; |
317 m_nonInheritedData.m_unique = false; | 305 m_nonInheritedData.m_unique = false; |
318 m_nonInheritedData.m_emptyState = false; | 306 m_nonInheritedData.m_emptyState = false; |
319 m_nonInheritedData.m_hasViewportUnits = false; | 307 m_nonInheritedData.m_hasViewportUnits = false; |
320 m_nonInheritedData.m_affectedByFocus = false; | 308 m_nonInheritedData.m_affectedByFocus = false; |
321 m_nonInheritedData.m_affectedByHover = false; | 309 m_nonInheritedData.m_affectedByHover = false; |
322 m_nonInheritedData.m_affectedByActive = false; | 310 m_nonInheritedData.m_affectedByActive = false; |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 } | 737 } |
750 void setBoxShadow(PassRefPtr<ShadowList>); | 738 void setBoxShadow(PassRefPtr<ShadowList>); |
751 | 739 |
752 // box-sizing (aka -webkit-box-sizing) | 740 // box-sizing (aka -webkit-box-sizing) |
753 static EBoxSizing initialBoxSizing() { return EBoxSizing::kContentBox; } | 741 static EBoxSizing initialBoxSizing() { return EBoxSizing::kContentBox; } |
754 EBoxSizing boxSizing() const { return m_box->boxSizing(); } | 742 EBoxSizing boxSizing() const { return m_box->boxSizing(); } |
755 void setBoxSizing(EBoxSizing s) { | 743 void setBoxSizing(EBoxSizing s) { |
756 SET_VAR(m_box, m_boxSizing, static_cast<unsigned>(s)); | 744 SET_VAR(m_box, m_boxSizing, static_cast<unsigned>(s)); |
757 } | 745 } |
758 | 746 |
759 // Page break properties. | |
760 // break-after (shorthand for page-break-after and -webkit-column-break-after) | |
761 static EBreakBetween initialBreakAfter() { return EBreakBetween::kAuto; } | |
762 EBreakBetween breakAfter() const { | |
763 return static_cast<EBreakBetween>(m_nonInheritedData.m_breakAfter); | |
764 } | |
765 void setBreakAfter(EBreakBetween b) { | |
766 m_nonInheritedData.m_breakAfter = static_cast<unsigned>(b); | |
767 } | |
768 | |
769 // break-before (shorthand for page-break-before and | |
770 // -webkit-column-break-before) | |
771 static EBreakBetween initialBreakBefore() { return EBreakBetween::kAuto; } | |
772 EBreakBetween breakBefore() const { | |
773 return static_cast<EBreakBetween>(m_nonInheritedData.m_breakBefore); | |
774 } | |
775 void setBreakBefore(EBreakBetween b) { | |
776 m_nonInheritedData.m_breakBefore = static_cast<unsigned>(b); | |
777 } | |
778 | |
779 // break-inside (shorthand for page-break-inside and | |
780 // -webkit-column-break-inside) | |
781 static EBreakInside initialBreakInside() { return EBreakInside::kAuto; } | |
782 EBreakInside breakInside() const { | |
783 return static_cast<EBreakInside>(m_nonInheritedData.m_breakInside); | |
784 } | |
785 void setBreakInside(EBreakInside b) { | |
786 m_nonInheritedData.m_breakInside = static_cast<unsigned>(b); | |
787 } | |
788 | |
789 // clip | 747 // clip |
790 static LengthBox initialClip() { return LengthBox(); } | 748 static LengthBox initialClip() { return LengthBox(); } |
791 const LengthBox& clip() const { return m_visual->clip; } | 749 const LengthBox& clip() const { return m_visual->clip; } |
792 void setClip(const LengthBox& box) { | 750 void setClip(const LengthBox& box) { |
793 SET_VAR(m_visual, hasAutoClip, false); | 751 SET_VAR(m_visual, hasAutoClip, false); |
794 SET_VAR(m_visual, clip, box); | 752 SET_VAR(m_visual, clip, box); |
795 } | 753 } |
796 bool hasAutoClip() const { return m_visual->hasAutoClip; } | 754 bool hasAutoClip() const { return m_visual->hasAutoClip; } |
797 void setHasAutoClip() { | 755 void setHasAutoClip() { |
798 SET_VAR(m_visual, hasAutoClip, true); | 756 SET_VAR(m_visual, hasAutoClip, true); |
(...skipping 3093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3892 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); | 3850 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - 1); |
3893 } | 3851 } |
3894 | 3852 |
3895 inline bool ComputedStyle::hasPseudoElementStyle() const { | 3853 inline bool ComputedStyle::hasPseudoElementStyle() const { |
3896 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; | 3854 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; |
3897 } | 3855 } |
3898 | 3856 |
3899 } // namespace blink | 3857 } // namespace blink |
3900 | 3858 |
3901 #endif // ComputedStyle_h | 3859 #endif // ComputedStyle_h |
OLD | NEW |