OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. |
4 * All rights reserved. | 4 * All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 class FontDescription; | 44 class FontDescription; |
45 | 45 |
46 class CORE_EXPORT StyleResolverState { | 46 class CORE_EXPORT StyleResolverState { |
47 STACK_ALLOCATED(); | 47 STACK_ALLOCATED(); |
48 WTF_MAKE_NONCOPYABLE(StyleResolverState); | 48 WTF_MAKE_NONCOPYABLE(StyleResolverState); |
49 | 49 |
50 public: | 50 public: |
51 StyleResolverState(Document&, | 51 StyleResolverState(Document&, |
52 const ElementResolveContext&, | 52 const ElementResolveContext&, |
53 const ComputedStyle* parentStyle); | 53 const ComputedStyle* parentStyle, |
54 StyleResolverState(Document&, Element*, const ComputedStyle* parentStyle = 0); | 54 const ComputedStyle* layoutParentStyle); |
| 55 StyleResolverState(Document&, |
| 56 Element*, |
| 57 const ComputedStyle* parentStyle = nullptr, |
| 58 const ComputedStyle* layoutParentStyle = nullptr); |
55 ~StyleResolverState(); | 59 ~StyleResolverState(); |
56 | 60 |
57 // In FontFaceSet and CanvasRenderingContext2D, we don't have an element to | 61 // In FontFaceSet and CanvasRenderingContext2D, we don't have an element to |
58 // grab the document from. This is why we have to store the document | 62 // grab the document from. This is why we have to store the document |
59 // separately. | 63 // separately. |
60 Document& document() const { return *m_document; } | 64 Document& document() const { return *m_document; } |
61 // These are all just pass-through methods to ElementResolveContext. | 65 // These are all just pass-through methods to ElementResolveContext. |
62 Element* element() const { return m_elementContext.element(); } | 66 Element* element() const { return m_elementContext.element(); } |
63 const ContainerNode* parentNode() const { | 67 const ContainerNode* parentNode() const { |
64 return m_elementContext.parentNode(); | 68 return m_elementContext.parentNode(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 103 } |
100 | 104 |
101 CSSAnimationUpdate& animationUpdate() { return m_animationUpdate; } | 105 CSSAnimationUpdate& animationUpdate() { return m_animationUpdate; } |
102 | 106 |
103 void setParentStyle(PassRefPtr<ComputedStyle> parentStyle) { | 107 void setParentStyle(PassRefPtr<ComputedStyle> parentStyle) { |
104 m_parentStyle = parentStyle; | 108 m_parentStyle = parentStyle; |
105 } | 109 } |
106 const ComputedStyle* parentStyle() const { return m_parentStyle.get(); } | 110 const ComputedStyle* parentStyle() const { return m_parentStyle.get(); } |
107 ComputedStyle* parentStyle() { return m_parentStyle.get(); } | 111 ComputedStyle* parentStyle() { return m_parentStyle.get(); } |
108 | 112 |
| 113 void setLayoutParentStyle(PassRefPtr<ComputedStyle> parentStyle) { |
| 114 m_layoutParentStyle = parentStyle; |
| 115 } |
| 116 const ComputedStyle* layoutParentStyle() const { |
| 117 return m_layoutParentStyle.get(); |
| 118 } |
| 119 |
109 // FIXME: These are effectively side-channel "out parameters" for the various | 120 // FIXME: These are effectively side-channel "out parameters" for the various |
110 // map functions. When we map from CSS to style objects we use this state | 121 // map functions. When we map from CSS to style objects we use this state |
111 // object to track various meta-data about that mapping (e.g. if it's | 122 // object to track various meta-data about that mapping (e.g. if it's |
112 // cache-able). We need to move this data off of StyleResolverState and | 123 // cache-able). We need to move this data off of StyleResolverState and |
113 // closer to the objects it applies to. Possibly separating (immutable) inputs | 124 // closer to the objects it applies to. Possibly separating (immutable) inputs |
114 // from (mutable) outputs. | 125 // from (mutable) outputs. |
115 void setApplyPropertyToRegularStyle(bool isApply) { | 126 void setApplyPropertyToRegularStyle(bool isApply) { |
116 m_applyPropertyToRegularStyle = isApply; | 127 m_applyPropertyToRegularStyle = isApply; |
117 } | 128 } |
118 void setApplyPropertyToVisitedLinkStyle(bool isApply) { | 129 void setApplyPropertyToVisitedLinkStyle(bool isApply) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 Member<Document> m_document; | 203 Member<Document> m_document; |
193 | 204 |
194 // m_style is the primary output for each element's style resolve. | 205 // m_style is the primary output for each element's style resolve. |
195 RefPtr<ComputedStyle> m_style; | 206 RefPtr<ComputedStyle> m_style; |
196 | 207 |
197 CSSToLengthConversionData m_cssToLengthConversionData; | 208 CSSToLengthConversionData m_cssToLengthConversionData; |
198 | 209 |
199 // m_parentStyle is not always just ElementResolveContext::parentStyle, | 210 // m_parentStyle is not always just ElementResolveContext::parentStyle, |
200 // so we keep it separate. | 211 // so we keep it separate. |
201 RefPtr<ComputedStyle> m_parentStyle; | 212 RefPtr<ComputedStyle> m_parentStyle; |
| 213 // This will almost-always be the same that m_parentStyle, except in the |
| 214 // presence of display: contents. This is the style against which we have to |
| 215 // do adjustment. |
| 216 RefPtr<const ComputedStyle> m_layoutParentStyle; |
202 | 217 |
203 CSSAnimationUpdate m_animationUpdate; | 218 CSSAnimationUpdate m_animationUpdate; |
204 | 219 |
205 bool m_applyPropertyToRegularStyle; | 220 bool m_applyPropertyToRegularStyle; |
206 bool m_applyPropertyToVisitedLinkStyle; | 221 bool m_applyPropertyToVisitedLinkStyle; |
207 bool m_hasDirAutoAttribute; | 222 bool m_hasDirAutoAttribute; |
208 | 223 |
209 FontBuilder m_fontBuilder; | 224 FontBuilder m_fontBuilder; |
210 | 225 |
211 std::unique_ptr<CachedUAStyle> m_cachedUAStyle; | 226 std::unique_ptr<CachedUAStyle> m_cachedUAStyle; |
212 | 227 |
213 ElementStyleResources m_elementStyleResources; | 228 ElementStyleResources m_elementStyleResources; |
214 | 229 |
215 HeapHashMap<String, Member<StylePropertySet>> | 230 HeapHashMap<String, Member<StylePropertySet>> |
216 m_customPropertySetsForApplyAtRule; | 231 m_customPropertySetsForApplyAtRule; |
217 | 232 |
218 mutable HeapHashMap< | 233 mutable HeapHashMap< |
219 Member<const CSSPendingSubstitutionValue>, | 234 Member<const CSSPendingSubstitutionValue>, |
220 Member<HeapHashMap<CSSPropertyID, Member<const CSSValue>>>> | 235 Member<HeapHashMap<CSSPropertyID, Member<const CSSValue>>>> |
221 m_parsedPropertiesForPendingSubstitutionCache; | 236 m_parsedPropertiesForPendingSubstitutionCache; |
222 }; | 237 }; |
223 | 238 |
224 } // namespace blink | 239 } // namespace blink |
225 | 240 |
226 #endif // StyleResolverState_h | 241 #endif // StyleResolverState_h |
OLD | NEW |