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 | |
244 private: | 203 private: |
245 // TODO(sashab): Move these private members to the bottom of ComputedStyle. | 204 // TODO(sashab): Move these private members to the bottom of ComputedStyle. |
246 ALWAYS_INLINE ComputedStyle(); | 205 ALWAYS_INLINE ComputedStyle(); |
247 ALWAYS_INLINE ComputedStyle(const ComputedStyle&); | 206 ALWAYS_INLINE ComputedStyle(const ComputedStyle&); |
248 | 207 |
249 static PassRefPtr<ComputedStyle> createInitialStyle(); | 208 static PassRefPtr<ComputedStyle> createInitialStyle(); |
250 // TODO(shend): Remove this. Initial style should not be mutable. | 209 // TODO(shend): Remove this. Initial style should not be mutable. |
251 static inline ComputedStyle& mutableInitialStyle() { | 210 static inline ComputedStyle& mutableInitialStyle() { |
252 LEAK_SANITIZER_DISABLED_SCOPE; | 211 LEAK_SANITIZER_DISABLED_SCOPE; |
253 DEFINE_STATIC_REF(ComputedStyle, s_initialStyle, | 212 DEFINE_STATIC_REF(ComputedStyle, s_initialStyle, |
(...skipping 2082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2336 } | 2295 } |
2337 CSSTransitionData& accessTransitions(); | 2296 CSSTransitionData& accessTransitions(); |
2338 | 2297 |
2339 // Callback selectors. | 2298 // Callback selectors. |
2340 const Vector<String>& callbackSelectors() const { | 2299 const Vector<String>& callbackSelectors() const { |
2341 return m_rareNonInheritedData->m_callbackSelectors; | 2300 return m_rareNonInheritedData->m_callbackSelectors; |
2342 } | 2301 } |
2343 void addCallbackSelector(const String& selector); | 2302 void addCallbackSelector(const String& selector); |
2344 | 2303 |
2345 // Non-property flags. | 2304 // 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 | |
2357 bool emptyState() const { return m_emptyState; } | 2305 bool emptyState() const { return m_emptyState; } |
2358 void setEmptyState(bool b) { | 2306 void setEmptyState(bool b) { |
2359 setUnique(); | 2307 setUnique(); |
2360 m_emptyState = b; | 2308 m_emptyState = b; |
2361 } | 2309 } |
2362 | 2310 |
2363 bool hasInlineTransform() const { | 2311 bool hasInlineTransform() const { |
2364 return m_rareNonInheritedData->m_hasInlineTransform; | 2312 return m_rareNonInheritedData->m_hasInlineTransform; |
2365 } | 2313 } |
2366 void setHasInlineTransform(bool b) { | 2314 void setHasInlineTransform(bool b) { |
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3741 m_pseudoBits |= 1 << (pseudo - FirstPublicPseudoId); | 3689 m_pseudoBits |= 1 << (pseudo - FirstPublicPseudoId); |
3742 } | 3690 } |
3743 | 3691 |
3744 inline bool ComputedStyle::hasPseudoElementStyle() const { | 3692 inline bool ComputedStyle::hasPseudoElementStyle() const { |
3745 return m_pseudoBits & ElementPseudoIdMask; | 3693 return m_pseudoBits & ElementPseudoIdMask; |
3746 } | 3694 } |
3747 | 3695 |
3748 } // namespace blink | 3696 } // namespace blink |
3749 | 3697 |
3750 #endif // ComputedStyle_h | 3698 #endif // ComputedStyle_h |
OLD | NEW |