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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 193 |
194 // inherited attributes | 194 // inherited attributes |
195 DataRef<StyleRareInheritedData> m_rareInheritedData; | 195 DataRef<StyleRareInheritedData> m_rareInheritedData; |
196 DataRef<StyleInheritedData> m_styleInheritedData; | 196 DataRef<StyleInheritedData> m_styleInheritedData; |
197 | 197 |
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 |
| 204 // ComputedStyle.cpp. |
| 205 |
| 206 // don't inherit |
| 207 struct NonInheritedData { |
| 208 NonInheritedData() : m_hasViewportUnits(false), m_hasRemUnits(false) {} |
| 209 |
| 210 // Compare computed styles, differences in inherited bits or other flags |
| 211 // should not cause an inequality. |
| 212 bool operator==(const NonInheritedData& other) const { |
| 213 // Generated properties are compared in ComputedStyleBase |
| 214 return true; |
| 215 // Differences in the following fields do not cause inequality: |
| 216 // hasViewportUnits |
| 217 // styleType |
| 218 // pseudoBits |
| 219 // explicitInheritance |
| 220 // unique |
| 221 // emptyState |
| 222 // affectedByFocus |
| 223 // affectedByHover |
| 224 // affectedByActive |
| 225 // affectedByDrag |
| 226 // isLink |
| 227 // isInherited flags |
| 228 } |
| 229 |
| 230 bool operator!=(const NonInheritedData& other) const { |
| 231 return !(*this == other); |
| 232 } |
| 233 |
| 234 // These are set if we used viewport or rem units when resolving a length. |
| 235 unsigned m_hasViewportUnits : 1; |
| 236 unsigned m_hasRemUnits : 1; |
| 237 |
| 238 // If you add more style bits here, you will also need to update |
| 239 // ComputedStyle::copyNonInheritedFromCached() 68 bits |
| 240 } m_nonInheritedData; |
| 241 |
| 242 // !END SYNC! |
| 243 |
203 private: | 244 private: |
204 // TODO(sashab): Move these private members to the bottom of ComputedStyle. | 245 // TODO(sashab): Move these private members to the bottom of ComputedStyle. |
205 ALWAYS_INLINE ComputedStyle(); | 246 ALWAYS_INLINE ComputedStyle(); |
206 ALWAYS_INLINE ComputedStyle(const ComputedStyle&); | 247 ALWAYS_INLINE ComputedStyle(const ComputedStyle&); |
207 | 248 |
208 static PassRefPtr<ComputedStyle> createInitialStyle(); | 249 static PassRefPtr<ComputedStyle> createInitialStyle(); |
209 // TODO(shend): Remove this. Initial style should not be mutable. | 250 // TODO(shend): Remove this. Initial style should not be mutable. |
210 static inline ComputedStyle& mutableInitialStyle() { | 251 static inline ComputedStyle& mutableInitialStyle() { |
211 LEAK_SANITIZER_DISABLED_SCOPE; | 252 LEAK_SANITIZER_DISABLED_SCOPE; |
212 DEFINE_STATIC_REF(ComputedStyle, s_initialStyle, | 253 DEFINE_STATIC_REF(ComputedStyle, s_initialStyle, |
(...skipping 2082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2295 } | 2336 } |
2296 CSSTransitionData& accessTransitions(); | 2337 CSSTransitionData& accessTransitions(); |
2297 | 2338 |
2298 // Callback selectors. | 2339 // Callback selectors. |
2299 const Vector<String>& callbackSelectors() const { | 2340 const Vector<String>& callbackSelectors() const { |
2300 return m_rareNonInheritedData->m_callbackSelectors; | 2341 return m_rareNonInheritedData->m_callbackSelectors; |
2301 } | 2342 } |
2302 void addCallbackSelector(const String& selector); | 2343 void addCallbackSelector(const String& selector); |
2303 | 2344 |
2304 // Non-property flags. | 2345 // Non-property flags. |
| 2346 bool hasViewportUnits() const { |
| 2347 return m_nonInheritedData.m_hasViewportUnits; |
| 2348 } |
| 2349 // TODO(shend): This function should take no arguments. |
| 2350 void setHasViewportUnits(bool hasViewportUnits) { |
| 2351 m_nonInheritedData.m_hasViewportUnits = hasViewportUnits; |
| 2352 } |
| 2353 |
| 2354 bool hasRemUnits() const { return m_nonInheritedData.m_hasRemUnits; } |
| 2355 void setHasRemUnits() { m_nonInheritedData.m_hasRemUnits = true; } |
| 2356 |
2305 bool emptyState() const { return m_emptyState; } | 2357 bool emptyState() const { return m_emptyState; } |
2306 void setEmptyState(bool b) { | 2358 void setEmptyState(bool b) { |
2307 setUnique(); | 2359 setUnique(); |
2308 m_emptyState = b; | 2360 m_emptyState = b; |
2309 } | 2361 } |
2310 | 2362 |
2311 bool hasInlineTransform() const { | 2363 bool hasInlineTransform() const { |
2312 return m_rareNonInheritedData->m_hasInlineTransform; | 2364 return m_rareNonInheritedData->m_hasInlineTransform; |
2313 } | 2365 } |
2314 void setHasInlineTransform(bool b) { | 2366 void setHasInlineTransform(bool b) { |
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3689 m_pseudoBits |= 1 << (pseudo - FirstPublicPseudoId); | 3741 m_pseudoBits |= 1 << (pseudo - FirstPublicPseudoId); |
3690 } | 3742 } |
3691 | 3743 |
3692 inline bool ComputedStyle::hasPseudoElementStyle() const { | 3744 inline bool ComputedStyle::hasPseudoElementStyle() const { |
3693 return m_pseudoBits & ElementPseudoIdMask; | 3745 return m_pseudoBits & ElementPseudoIdMask; |
3694 } | 3746 } |
3695 | 3747 |
3696 } // namespace blink | 3748 } // namespace blink |
3697 | 3749 |
3698 #endif // ComputedStyle_h | 3750 #endif // ComputedStyle_h |
OLD | NEW |