| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // list of associated pseudo styles | 198 // list of associated pseudo styles |
| 199 std::unique_ptr<PseudoStyleCache> m_cachedPseudoStyles; | 199 std::unique_ptr<PseudoStyleCache> m_cachedPseudoStyles; |
| 200 | 200 |
| 201 DataRef<SVGComputedStyle> m_svgStyle; | 201 DataRef<SVGComputedStyle> m_svgStyle; |
| 202 | 202 |
| 203 // !START SYNC!: Keep this in sync with the copy constructor in | 203 // !START SYNC!: Keep this in sync with the copy constructor in |
| 204 // ComputedStyle.cpp. | 204 // ComputedStyle.cpp. |
| 205 | 205 |
| 206 // inherit | 206 // inherit |
| 207 struct InheritedData { | 207 struct InheritedData { |
| 208 InheritedData() |
| 209 : m_hasSimpleUnderline(false), |
| 210 m_cursorStyle(static_cast<unsigned>(initialCursor())), |
| 211 m_insideLink(static_cast<unsigned>(EInsideLink::kNotInsideLink)) {} |
| 212 |
| 208 bool operator==(const InheritedData& other) const { | 213 bool operator==(const InheritedData& other) const { |
| 209 // Generated properties are compared in ComputedStyleBase | 214 // Generated properties are compared in ComputedStyleBase |
| 210 return (m_hasSimpleUnderline == other.m_hasSimpleUnderline) && | 215 return (m_hasSimpleUnderline == other.m_hasSimpleUnderline) && |
| 211 (m_cursorStyle == other.m_cursorStyle) && | 216 (m_cursorStyle == other.m_cursorStyle) && |
| 212 (m_insideLink == other.m_insideLink); | 217 (m_insideLink == other.m_insideLink); |
| 213 } | 218 } |
| 214 | 219 |
| 215 bool operator!=(const InheritedData& other) const { | 220 bool operator!=(const InheritedData& other) const { |
| 216 return !(*this == other); | 221 return !(*this == other); |
| 217 } | 222 } |
| 218 | 223 |
| 219 unsigned m_hasSimpleUnderline : 1; // True if 'underline solid' is the only | 224 unsigned m_hasSimpleUnderline : 1; // True if 'underline solid' is the only |
| 220 // text decoration on this element. | 225 // text decoration on this element. |
| 221 unsigned m_cursorStyle : 6; // ECursor | 226 unsigned m_cursorStyle : 6; // ECursor |
| 222 | 227 |
| 223 // non CSS2 inherited | 228 // non CSS2 inherited |
| 224 unsigned m_insideLink : 2; // EInsideLink | 229 unsigned m_insideLink : 2; // EInsideLink |
| 225 } m_inheritedData; | 230 } m_inheritedData; |
| 226 | 231 |
| 227 // don't inherit | 232 // don't inherit |
| 228 struct NonInheritedData { | 233 struct NonInheritedData { |
| 234 NonInheritedData() |
| 235 : m_effectiveDisplay(static_cast<unsigned>(initialDisplay())), |
| 236 m_originalDisplay(static_cast<unsigned>(initialDisplay())), |
| 237 m_verticalAlign(static_cast<unsigned>(initialVerticalAlign())), |
| 238 m_hasViewportUnits(false), |
| 239 m_styleType(PseudoIdNone), |
| 240 m_pseudoBits(0), |
| 241 m_emptyState(false), |
| 242 m_hasRemUnits(false) {} |
| 243 |
| 229 // Compare computed styles, differences in inherited bits or other flags | 244 // Compare computed styles, differences in inherited bits or other flags |
| 230 // should not cause an inequality. | 245 // should not cause an inequality. |
| 231 bool operator==(const NonInheritedData& other) const { | 246 bool operator==(const NonInheritedData& other) const { |
| 232 // Generated properties are compared in ComputedStyleBase | 247 // Generated properties are compared in ComputedStyleBase |
| 233 return m_effectiveDisplay == other.m_effectiveDisplay && | 248 return m_effectiveDisplay == other.m_effectiveDisplay && |
| 234 m_originalDisplay == other.m_originalDisplay && | 249 m_originalDisplay == other.m_originalDisplay && |
| 235 m_verticalAlign == other.m_verticalAlign; | 250 m_verticalAlign == other.m_verticalAlign; |
| 236 // Differences in the following fields do not cause inequality: | 251 // Differences in the following fields do not cause inequality: |
| 237 // hasViewportUnits | 252 // hasViewportUnits |
| 238 // styleType | 253 // styleType |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 // 64 bits | 286 // 64 bits |
| 272 | 287 |
| 273 mutable unsigned m_hasRemUnits : 1; | 288 mutable unsigned m_hasRemUnits : 1; |
| 274 | 289 |
| 275 // If you add more style bits here, you will also need to update | 290 // If you add more style bits here, you will also need to update |
| 276 // ComputedStyle::copyNonInheritedFromCached() 68 bits | 291 // ComputedStyle::copyNonInheritedFromCached() 68 bits |
| 277 } m_nonInheritedData; | 292 } m_nonInheritedData; |
| 278 | 293 |
| 279 // !END SYNC! | 294 // !END SYNC! |
| 280 | 295 |
| 281 // Only call inside the constructor. Generated properties in the base class | |
| 282 // are not initialized in this method. | |
| 283 void initializeBitDefaults() { | |
| 284 m_inheritedData.m_hasSimpleUnderline = false; | |
| 285 m_inheritedData.m_cursorStyle = static_cast<unsigned>(initialCursor()); | |
| 286 m_inheritedData.m_insideLink = | |
| 287 static_cast<unsigned>(EInsideLink::kNotInsideLink); | |
| 288 | |
| 289 m_nonInheritedData.m_effectiveDisplay = | |
| 290 m_nonInheritedData.m_originalDisplay = | |
| 291 static_cast<unsigned>(initialDisplay()); | |
| 292 m_nonInheritedData.m_verticalAlign = | |
| 293 static_cast<unsigned>(initialVerticalAlign()); | |
| 294 m_nonInheritedData.m_styleType = PseudoIdNone; | |
| 295 m_nonInheritedData.m_pseudoBits = 0; | |
| 296 m_nonInheritedData.m_emptyState = false; | |
| 297 m_nonInheritedData.m_hasViewportUnits = false; | |
| 298 m_nonInheritedData.m_hasRemUnits = false; | |
| 299 } | |
| 300 | |
| 301 private: | 296 private: |
| 302 // TODO(sashab): Move these private members to the bottom of ComputedStyle. | 297 // TODO(sashab): Move these private members to the bottom of ComputedStyle. |
| 303 enum InitialStyleTag { InitialStyle }; | 298 ALWAYS_INLINE ComputedStyle(); |
| 304 ALWAYS_INLINE explicit ComputedStyle(InitialStyleTag); | |
| 305 ALWAYS_INLINE ComputedStyle(const ComputedStyle&); | 299 ALWAYS_INLINE ComputedStyle(const ComputedStyle&); |
| 306 | 300 |
| 307 static PassRefPtr<ComputedStyle> createInitialStyle(); | 301 static PassRefPtr<ComputedStyle> createInitialStyle(); |
| 308 // TODO(shend): Remove this. Initial style should not be mutable. | 302 // TODO(shend): Remove this. Initial style should not be mutable. |
| 309 static inline ComputedStyle& mutableInitialStyle() { | 303 static inline ComputedStyle& mutableInitialStyle() { |
| 310 LEAK_SANITIZER_DISABLED_SCOPE; | 304 LEAK_SANITIZER_DISABLED_SCOPE; |
| 311 DEFINE_STATIC_REF(ComputedStyle, s_initialStyle, | 305 DEFINE_STATIC_REF(ComputedStyle, s_initialStyle, |
| 312 (ComputedStyle::createInitialStyle())); | 306 (ComputedStyle::createInitialStyle())); |
| 313 return *s_initialStyle; | 307 return *s_initialStyle; |
| 314 } | 308 } |
| (...skipping 3485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3800 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - FirstPublicPseudoId); | 3794 m_nonInheritedData.m_pseudoBits |= 1 << (pseudo - FirstPublicPseudoId); |
| 3801 } | 3795 } |
| 3802 | 3796 |
| 3803 inline bool ComputedStyle::hasPseudoElementStyle() const { | 3797 inline bool ComputedStyle::hasPseudoElementStyle() const { |
| 3804 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; | 3798 return m_nonInheritedData.m_pseudoBits & ElementPseudoIdMask; |
| 3805 } | 3799 } |
| 3806 | 3800 |
| 3807 } // namespace blink | 3801 } // namespace blink |
| 3808 | 3802 |
| 3809 #endif // ComputedStyle_h | 3803 #endif // ComputedStyle_h |
| OLD | NEW |