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.
All rights reserved. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 20 matching lines...) Expand all Loading... |
31 #include "core/platform/graphics/Color.h" | 31 #include "core/platform/graphics/Color.h" |
32 #include "core/rendering/style/CachedUAStyle.h" | 32 #include "core/rendering/style/CachedUAStyle.h" |
33 #include "core/rendering/style/RenderStyle.h" | 33 #include "core/rendering/style/RenderStyle.h" |
34 #include "core/rendering/style/StyleInheritedData.h" | 34 #include "core/rendering/style/StyleInheritedData.h" |
35 #include "wtf/HashMap.h" | 35 #include "wtf/HashMap.h" |
36 | 36 |
37 namespace WebCore { | 37 namespace WebCore { |
38 | 38 |
39 class FontDescription; | 39 class FontDescription; |
40 class RenderRegion; | 40 class RenderRegion; |
| 41 class StyleRule; |
41 | 42 |
42 // ElementResolveContext is immutable and serves as an input to the style resolv
e process. | 43 // ElementResolveContext is immutable and serves as an input to the style resolv
e process. |
43 class ElementResolveContext { | 44 class ElementResolveContext { |
44 public: | 45 public: |
45 ElementResolveContext() | 46 ElementResolveContext() |
46 : m_element(0) | 47 : m_element(0) |
47 , m_parentNode(0) | 48 , m_parentNode(0) |
48 , m_rootElementStyle(0) | 49 , m_rootElementStyle(0) |
49 , m_elementLinkState(NotInsideLink) | 50 , m_elementLinkState(NotInsideLink) |
50 , m_distributedToInsertionPoint(false) | 51 , m_distributedToInsertionPoint(false) |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 class StyleResolverState { | 86 class StyleResolverState { |
86 WTF_MAKE_NONCOPYABLE(StyleResolverState); | 87 WTF_MAKE_NONCOPYABLE(StyleResolverState); |
87 public: | 88 public: |
88 StyleResolverState() | 89 StyleResolverState() |
89 : m_regionForStyling(0) | 90 : m_regionForStyling(0) |
90 , m_applyPropertyToRegularStyle(true) | 91 , m_applyPropertyToRegularStyle(true) |
91 , m_applyPropertyToVisitedLinkStyle(false) | 92 , m_applyPropertyToVisitedLinkStyle(false) |
92 , m_lineHeightValue(0) | 93 , m_lineHeightValue(0) |
93 , m_fontDirty(false) | 94 , m_fontDirty(false) |
94 , m_styleMap(*this, m_elementStyleResources) | 95 , m_styleMap(*this, m_elementStyleResources) |
| 96 , m_rule(0) |
95 { } | 97 { } |
96 | 98 |
97 // These are all just pass-through methods to ElementResolveContext. | 99 // These are all just pass-through methods to ElementResolveContext. |
98 Document* document() const { return m_elementContext.document(); } | 100 Document* document() const { return m_elementContext.document(); } |
99 Element* element() const { return m_elementContext.element(); } | 101 Element* element() const { return m_elementContext.element(); } |
100 const ContainerNode* parentNode() const { return m_elementContext.parentNode
(); } | 102 const ContainerNode* parentNode() const { return m_elementContext.parentNode
(); } |
101 RenderStyle* rootElementStyle() const { return m_elementContext.rootElementS
tyle(); } | 103 RenderStyle* rootElementStyle() const { return m_elementContext.rootElementS
tyle(); } |
102 EInsideLink elementLinkState() const { return m_elementContext.elementLinkSt
ate(); } | 104 EInsideLink elementLinkState() const { return m_elementContext.elementLinkSt
ate(); } |
103 bool distributedToInsertionPoint() const { return m_elementContext.distribut
edToInsertionPoint(); } | 105 bool distributedToInsertionPoint() const { return m_elementContext.distribut
edToInsertionPoint(); } |
104 | 106 |
105 const ElementResolveContext elementContext() const { return m_elementContext
; } | 107 const ElementResolveContext elementContext() const { return m_elementContext
; } |
106 | 108 |
107 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; } | 109 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; } |
108 RenderStyle* style() const { return m_style.get(); } | 110 RenderStyle* style() const { return m_style.get(); } |
109 PassRefPtr<RenderStyle> takeStyle() { return m_style.release(); } | 111 PassRefPtr<RenderStyle> takeStyle() { return m_style.release(); } |
110 | 112 |
111 void setParentStyle(PassRefPtr<RenderStyle> parentStyle) { m_parentStyle = p
arentStyle; } | 113 void setParentStyle(PassRefPtr<RenderStyle> parentStyle) { m_parentStyle = p
arentStyle; } |
112 RenderStyle* parentStyle() const { return m_parentStyle.get(); } | 114 RenderStyle* parentStyle() const { return m_parentStyle.get(); } |
113 | 115 |
114 const RenderRegion* regionForStyling() const { return m_regionForStyling; } | 116 const RenderRegion* regionForStyling() const { return m_regionForStyling; } |
115 | 117 |
| 118 void setRule(StyleRule* rule) { m_rule = rule; } |
| 119 const StyleRule* rule() const { return m_rule; } |
| 120 |
116 // FIXME: These are effectively side-channel "out parameters" for the variou
s | 121 // FIXME: These are effectively side-channel "out parameters" for the variou
s |
117 // map functions. When we map from CSS to style objects we use this state ob
ject | 122 // map functions. When we map from CSS to style objects we use this state ob
ject |
118 // to track various meta-data about that mapping (e.g. if it's cache-able). | 123 // to track various meta-data about that mapping (e.g. if it's cache-able). |
119 // We need to move this data off of StyleResolverState and closer to the | 124 // We need to move this data off of StyleResolverState and closer to the |
120 // objects it applies to. Possibly separating (immutable) inputs from (mutab
le) outputs. | 125 // objects it applies to. Possibly separating (immutable) inputs from (mutab
le) outputs. |
121 void setApplyPropertyToRegularStyle(bool isApply) { m_applyPropertyToRegular
Style = isApply; } | 126 void setApplyPropertyToRegularStyle(bool isApply) { m_applyPropertyToRegular
Style = isApply; } |
122 void setApplyPropertyToVisitedLinkStyle(bool isApply) { m_applyPropertyToVis
itedLinkStyle = isApply; } | 127 void setApplyPropertyToVisitedLinkStyle(bool isApply) { m_applyPropertyToVis
itedLinkStyle = isApply; } |
123 bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularSt
yle; } | 128 bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularSt
yle; } |
124 bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisit
edLinkStyle; } | 129 bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisit
edLinkStyle; } |
125 | 130 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 // is changed, StyleResolver tracks the need to update | 210 // is changed, StyleResolver tracks the need to update |
206 // style->font() with this bool. | 211 // style->font() with this bool. |
207 bool m_fontDirty; | 212 bool m_fontDirty; |
208 | 213 |
209 CachedUAStyle m_cachedUAStyle; | 214 CachedUAStyle m_cachedUAStyle; |
210 | 215 |
211 ElementStyleResources m_elementStyleResources; | 216 ElementStyleResources m_elementStyleResources; |
212 // CSSToStyleMap is a pure-logic class and only contains | 217 // CSSToStyleMap is a pure-logic class and only contains |
213 // a back-pointer to this object. | 218 // a back-pointer to this object. |
214 CSSToStyleMap m_styleMap; | 219 CSSToStyleMap m_styleMap; |
| 220 |
| 221 StyleRule* m_rule; |
215 }; | 222 }; |
216 | |
217 } // namespace WebCore | 223 } // namespace WebCore |
218 | 224 |
219 #endif // StyleResolverState_h | 225 #endif // StyleResolverState_h |
OLD | NEW |