| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 unsigned m_insideLink : 2; // EInsideLink | 226 unsigned m_insideLink : 2; // EInsideLink |
| 227 } m_inheritedData; | 227 } m_inheritedData; |
| 228 | 228 |
| 229 // don't inherit | 229 // don't inherit |
| 230 struct NonInheritedData { | 230 struct NonInheritedData { |
| 231 NonInheritedData() | 231 NonInheritedData() |
| 232 : m_effectiveDisplay(static_cast<unsigned>(initialDisplay())), | 232 : m_effectiveDisplay(static_cast<unsigned>(initialDisplay())), |
| 233 m_originalDisplay(static_cast<unsigned>(initialDisplay())), | 233 m_originalDisplay(static_cast<unsigned>(initialDisplay())), |
| 234 m_verticalAlign(static_cast<unsigned>(initialVerticalAlign())), | 234 m_verticalAlign(static_cast<unsigned>(initialVerticalAlign())), |
| 235 m_hasViewportUnits(false), | 235 m_hasViewportUnits(false), |
| 236 m_styleType(PseudoIdNone), | |
| 237 m_pseudoBits(0), | |
| 238 m_hasRemUnits(false) {} | 236 m_hasRemUnits(false) {} |
| 239 | 237 |
| 240 // Compare computed styles, differences in inherited bits or other flags | 238 // Compare computed styles, differences in inherited bits or other flags |
| 241 // should not cause an inequality. | 239 // should not cause an inequality. |
| 242 bool operator==(const NonInheritedData& other) const { | 240 bool operator==(const NonInheritedData& other) const { |
| 243 // Generated properties are compared in ComputedStyleBase | 241 // Generated properties are compared in ComputedStyleBase |
| 244 return m_effectiveDisplay == other.m_effectiveDisplay && | 242 return m_effectiveDisplay == other.m_effectiveDisplay && |
| 245 m_originalDisplay == other.m_originalDisplay && | 243 m_originalDisplay == other.m_originalDisplay && |
| 246 m_verticalAlign == other.m_verticalAlign; | 244 m_verticalAlign == other.m_verticalAlign; |
| 247 // Differences in the following fields do not cause inequality: | 245 // Differences in the following fields do not cause inequality: |
| (...skipping 17 matching lines...) Expand all Loading... |
| 265 | 263 |
| 266 unsigned m_effectiveDisplay : 5; // EDisplay | 264 unsigned m_effectiveDisplay : 5; // EDisplay |
| 267 unsigned m_originalDisplay : 5; // EDisplay | 265 unsigned m_originalDisplay : 5; // EDisplay |
| 268 unsigned m_verticalAlign : 4; // EVerticalAlign | 266 unsigned m_verticalAlign : 4; // EVerticalAlign |
| 269 | 267 |
| 270 // This is set if we used viewport units when resolving a length. | 268 // This is set if we used viewport units when resolving a length. |
| 271 // It is mutable so we can pass around const ComputedStyles to resolve | 269 // It is mutable so we can pass around const ComputedStyles to resolve |
| 272 // lengths. | 270 // lengths. |
| 273 mutable unsigned m_hasViewportUnits : 1; | 271 mutable unsigned m_hasViewportUnits : 1; |
| 274 | 272 |
| 275 // 32 bits | |
| 276 | |
| 277 unsigned m_styleType : 6; // PseudoId | |
| 278 unsigned m_pseudoBits : 8; | |
| 279 | |
| 280 // 64 bits | |
| 281 | |
| 282 mutable unsigned m_hasRemUnits : 1; | 273 mutable unsigned m_hasRemUnits : 1; |
| 283 | 274 |
| 284 // If you add more style bits here, you will also need to update | 275 // If you add more style bits here, you will also need to update |
| 285 // ComputedStyle::copyNonInheritedFromCached() 68 bits | 276 // ComputedStyle::copyNonInheritedFromCached() 68 bits |
| 286 } m_nonInheritedData; | 277 } m_nonInheritedData; |
| 287 | 278 |
| 288 // !END SYNC! | 279 // !END SYNC! |
| 289 | 280 |
| 290 private: | 281 private: |
| 291 // TODO(sashab): Move these private members to the bottom of ComputedStyle. | 282 // TODO(sashab): Move these private members to the bottom of ComputedStyle. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 StyleSelfAlignmentData resolvedJustifySelf( | 328 StyleSelfAlignmentData resolvedJustifySelf( |
| 338 ItemPosition normalValueBehaviour, | 329 ItemPosition normalValueBehaviour, |
| 339 const ComputedStyle* parentStyle = nullptr) const; | 330 const ComputedStyle* parentStyle = nullptr) const; |
| 340 | 331 |
| 341 StyleDifference visualInvalidationDiff(const ComputedStyle&) const; | 332 StyleDifference visualInvalidationDiff(const ComputedStyle&) const; |
| 342 | 333 |
| 343 void inheritFrom(const ComputedStyle& inheritParent, | 334 void inheritFrom(const ComputedStyle& inheritParent, |
| 344 IsAtShadowBoundary = NotAtShadowBoundary); | 335 IsAtShadowBoundary = NotAtShadowBoundary); |
| 345 void copyNonInheritedFromCached(const ComputedStyle&); | 336 void copyNonInheritedFromCached(const ComputedStyle&); |
| 346 | 337 |
| 347 PseudoId styleType() const { | 338 PseudoId styleType() const { return static_cast<PseudoId>(m_styleType); } |
| 348 return static_cast<PseudoId>(m_nonInheritedData.m_styleType); | 339 void setStyleType(PseudoId styleType) { m_styleType = styleType; } |
| 349 } | |
| 350 void setStyleType(PseudoId styleType) { | |
| 351 m_nonInheritedData.m_styleType = styleType; | |
| 352 } | |
| 353 | 340 |
| 354 ComputedStyle* getCachedPseudoStyle(PseudoId) const; | 341 ComputedStyle* getCachedPseudoStyle(PseudoId) const; |
| 355 ComputedStyle* addCachedPseudoStyle(PassRefPtr<ComputedStyle>); | 342 ComputedStyle* addCachedPseudoStyle(PassRefPtr<ComputedStyle>); |
| 356 void removeCachedPseudoStyle(PseudoId); | 343 void removeCachedPseudoStyle(PseudoId); |
| 357 | 344 |
| 358 const PseudoStyleCache* cachedPseudoStyles() const { | 345 const PseudoStyleCache* cachedPseudoStyles() const { |
| 359 return m_cachedPseudoStyles.get(); | 346 return m_cachedPseudoStyles.get(); |
| 360 } | 347 } |
| 361 | 348 |
| 362 /** | 349 /** |
| (...skipping 3398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3761 | 3748 |
| 3762 inline bool ComputedStyle::setTextOrientation(TextOrientation textOrientation) { | 3749 inline bool ComputedStyle::setTextOrientation(TextOrientation textOrientation) { |
| 3763 if (compareEqual(m_rareInheritedData->m_textOrientation, textOrientation)) | 3750 if (compareEqual(m_rareInheritedData->m_textOrientation, textOrientation)) |
| 3764 return false; | 3751 return false; |
| 3765 | 3752 |
| 3766 m_rareInheritedData.access()->m_textOrientation = textOrientation; | 3753 m_rareInheritedData.access()->m_textOrientation = textOrientation; |
| 3767 return true; | 3754 return true; |
| 3768 } | 3755 } |
| 3769 | 3756 |
| 3770 inline bool ComputedStyle::hasAnyPublicPseudoStyles() const { | 3757 inline bool ComputedStyle::hasAnyPublicPseudoStyles() const { |
| 3771 return m_nonInheritedData.m_pseudoBits; | 3758 return m_pseudoBits; |
| 3772 } | 3759 } |
| 3773 | 3760 |
| 3774 inline bool ComputedStyle::hasPseudoStyle(PseudoId pseudo) const { | 3761 inline bool ComputedStyle::hasPseudoStyle(PseudoId pseudo) const { |
| 3775 DCHECK(pseudo >= FirstPublicPseudoId); | 3762 DCHECK(pseudo >= FirstPublicPseudoId); |
| 3776 DCHECK(pseudo < FirstInternalPseudoId); | 3763 DCHECK(pseudo < FirstInternalPseudoId); |
| 3777 return (1 << (pseudo - FirstPublicPseudoId)) & | 3764 return (1 << (pseudo - FirstPublicPseudoId)) & m_pseudoBits; |
| 3778 m_nonInheritedData.m_pseudoBits; | |
| 3779 } | 3765 } |
| 3780 | 3766 |
| 3781 inline void ComputedStyle::setHasPseudoStyle(PseudoId pseudo) { | 3767 inline void ComputedStyle::setHasPseudoStyle(PseudoId pseudo) { |
| 3782 DCHECK(pseudo >= FirstPublicPseudoId); | 3768 DCHECK(pseudo >= FirstPublicPseudoId); |
| 3783 DCHECK(pseudo < FirstInternalPseudoId); | 3769 DCHECK(pseudo < FirstInternalPseudoId); |
| 3784 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - FirstPublicPseudoId); | 3770 m_pseudoBits |= 1 << (pseudo - FirstPublicPseudoId); |
| 3785 } | 3771 } |
| 3786 | 3772 |
| 3787 inline bool ComputedStyle::hasPseudoElementStyle() const { | 3773 inline bool ComputedStyle::hasPseudoElementStyle() const { |
| 3788 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; | 3774 return m_pseudoBits & ElementPseudoIdMask; |
| 3789 } | 3775 } |
| 3790 | 3776 |
| 3791 } // namespace blink | 3777 } // namespace blink |
| 3792 | 3778 |
| 3793 #endif // ComputedStyle_h | 3779 #endif // ComputedStyle_h |
| OLD | NEW |