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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
94 class StyleResolverState { | 95 class StyleResolverState { |
95 WTF_MAKE_NONCOPYABLE(StyleResolverState); | 96 WTF_MAKE_NONCOPYABLE(StyleResolverState); |
96 public: | 97 public: |
97 StyleResolverState() | 98 StyleResolverState() |
98 : m_regionForStyling(0) | 99 : m_regionForStyling(0) |
99 , m_applyPropertyToRegularStyle(true) | 100 , m_applyPropertyToRegularStyle(true) |
100 , m_applyPropertyToVisitedLinkStyle(false) | 101 , m_applyPropertyToVisitedLinkStyle(false) |
101 , m_lineHeightValue(0) | 102 , m_lineHeightValue(0) |
102 , m_fontDirty(false) | 103 , m_fontDirty(false) |
103 , m_styleMap(*this, m_elementStyleResources) | 104 , m_styleMap(*this, m_elementStyleResources) |
105 #if ENABLE(CSS_CALLBACKS) | |
106 , m_rule(0) | |
107 #endif | |
104 { } | 108 { } |
105 | 109 |
106 // These are all just pass-through methods to ElementResolveContext. | 110 // These are all just pass-through methods to ElementResolveContext. |
107 Document* document() const { return m_elementContext.document(); } | 111 Document* document() const { return m_elementContext.document(); } |
108 Element* element() const { return m_elementContext.element(); } | 112 Element* element() const { return m_elementContext.element(); } |
109 const ContainerNode* parentNode() const { return m_elementContext.parentNode (); } | 113 const ContainerNode* parentNode() const { return m_elementContext.parentNode (); } |
110 RenderStyle* rootElementStyle() const { return m_elementContext.rootElementS tyle(); } | 114 RenderStyle* rootElementStyle() const { return m_elementContext.rootElementS tyle(); } |
111 EInsideLink elementLinkState() const { return m_elementContext.elementLinkSt ate(); } | 115 EInsideLink elementLinkState() const { return m_elementContext.elementLinkSt ate(); } |
112 bool distributedToInsertionPoint() const { return m_elementContext.distribut edToInsertionPoint(); } | 116 bool distributedToInsertionPoint() const { return m_elementContext.distribut edToInsertionPoint(); } |
113 | 117 |
114 const ElementResolveContext elementContext() const { return m_elementContext ; } | 118 const ElementResolveContext elementContext() const { return m_elementContext ; } |
115 | 119 |
116 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; } | 120 void setStyle(PassRefPtr<RenderStyle> style) { m_style = style; } |
117 RenderStyle* style() const { return m_style.get(); } | 121 RenderStyle* style() const { return m_style.get(); } |
118 PassRefPtr<RenderStyle> takeStyle() { return m_style.release(); } | 122 PassRefPtr<RenderStyle> takeStyle() { return m_style.release(); } |
119 | 123 |
120 void setParentStyle(PassRefPtr<RenderStyle> parentStyle) { m_parentStyle = p arentStyle; } | 124 void setParentStyle(PassRefPtr<RenderStyle> parentStyle) { m_parentStyle = p arentStyle; } |
121 RenderStyle* parentStyle() const { return m_parentStyle.get(); } | 125 RenderStyle* parentStyle() const { return m_parentStyle.get(); } |
122 | 126 |
123 const RenderRegion* regionForStyling() const { return m_regionForStyling; } | 127 const RenderRegion* regionForStyling() const { return m_regionForStyling; } |
124 | 128 |
129 #if ENABLE(CSS_CALLBACKS) | |
130 void setRule(StyleRule* rule) { m_rule = rule; } | |
131 const StyleRule* rule() const { return m_rule; } | |
esprehn
2013/07/13 01:43:01
currentRule() ?
Jeffrey Yasskin
2013/08/13 00:29:29
Done.
| |
132 #endif | |
133 | |
125 // FIXME: These are effectively side-channel "out parameters" for the variou s | 134 // FIXME: These are effectively side-channel "out parameters" for the variou s |
126 // map functions. When we map from CSS to style objects we use this state ob ject | 135 // map functions. When we map from CSS to style objects we use this state ob ject |
127 // to track various meta-data about that mapping (e.g. if it's cache-able). | 136 // to track various meta-data about that mapping (e.g. if it's cache-able). |
128 // We need to move this data off of StyleResolverState and closer to the | 137 // We need to move this data off of StyleResolverState and closer to the |
129 // objects it applies to. Possibly separating (immutable) inputs from (mutab le) outputs. | 138 // objects it applies to. Possibly separating (immutable) inputs from (mutab le) outputs. |
130 void setApplyPropertyToRegularStyle(bool isApply) { m_applyPropertyToRegular Style = isApply; } | 139 void setApplyPropertyToRegularStyle(bool isApply) { m_applyPropertyToRegular Style = isApply; } |
131 void setApplyPropertyToVisitedLinkStyle(bool isApply) { m_applyPropertyToVis itedLinkStyle = isApply; } | 140 void setApplyPropertyToVisitedLinkStyle(bool isApply) { m_applyPropertyToVis itedLinkStyle = isApply; } |
132 bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularSt yle; } | 141 bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularSt yle; } |
133 bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisit edLinkStyle; } | 142 bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisit edLinkStyle; } |
134 | 143 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 // is changed, StyleResolver tracks the need to update | 223 // is changed, StyleResolver tracks the need to update |
215 // style->font() with this bool. | 224 // style->font() with this bool. |
216 bool m_fontDirty; | 225 bool m_fontDirty; |
217 | 226 |
218 CachedUAStyle m_cachedUAStyle; | 227 CachedUAStyle m_cachedUAStyle; |
219 | 228 |
220 ElementStyleResources m_elementStyleResources; | 229 ElementStyleResources m_elementStyleResources; |
221 // CSSToStyleMap is a pure-logic class and only contains | 230 // CSSToStyleMap is a pure-logic class and only contains |
222 // a back-pointer to this object. | 231 // a back-pointer to this object. |
223 CSSToStyleMap m_styleMap; | 232 CSSToStyleMap m_styleMap; |
233 | |
234 #if ENABLE(CSS_CALLBACKS) | |
235 StyleRule* m_rule; | |
236 #endif | |
224 }; | 237 }; |
225 | |
226 } // namespace WebCore | 238 } // namespace WebCore |
227 | 239 |
228 #endif // StyleResolverState_h | 240 #endif // StyleResolverState_h |
OLD | NEW |