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. |
| 4 * All rights reserved. |
4 * | 5 * |
5 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
8 * 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. |
9 * | 10 * |
10 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 14 * Library General Public License for more details. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 STACK_ALLOCATED(); | 47 STACK_ALLOCATED(); |
47 WTF_MAKE_NONCOPYABLE(StyleResolverState); | 48 WTF_MAKE_NONCOPYABLE(StyleResolverState); |
48 | 49 |
49 public: | 50 public: |
50 StyleResolverState(Document&, | 51 StyleResolverState(Document&, |
51 const ElementResolveContext&, | 52 const ElementResolveContext&, |
52 const ComputedStyle* parentStyle); | 53 const ComputedStyle* parentStyle); |
53 StyleResolverState(Document&, Element*, const ComputedStyle* parentStyle = 0); | 54 StyleResolverState(Document&, Element*, const ComputedStyle* parentStyle = 0); |
54 ~StyleResolverState(); | 55 ~StyleResolverState(); |
55 | 56 |
56 // In FontFaceSet and CanvasRenderingContext2D, we don't have an element to gr
ab the document from. | 57 // In FontFaceSet and CanvasRenderingContext2D, we don't have an element to |
57 // This is why we have to store the document separately. | 58 // grab the document from. This is why we have to store the document |
| 59 // separately. |
58 Document& document() const { return *m_document; } | 60 Document& document() const { return *m_document; } |
59 // These are all just pass-through methods to ElementResolveContext. | 61 // These are all just pass-through methods to ElementResolveContext. |
60 Element* element() const { return m_elementContext.element(); } | 62 Element* element() const { return m_elementContext.element(); } |
61 const ContainerNode* parentNode() const { | 63 const ContainerNode* parentNode() const { |
62 return m_elementContext.parentNode(); | 64 return m_elementContext.parentNode(); |
63 } | 65 } |
64 const ComputedStyle* rootElementStyle() const { | 66 const ComputedStyle* rootElementStyle() const { |
65 return m_elementContext.rootElementStyle(); | 67 return m_elementContext.rootElementStyle(); |
66 } | 68 } |
67 EInsideLink elementLinkState() const { | 69 EInsideLink elementLinkState() const { |
(...skipping 30 matching lines...) Expand all Loading... |
98 | 100 |
99 CSSAnimationUpdate& animationUpdate() { return m_animationUpdate; } | 101 CSSAnimationUpdate& animationUpdate() { return m_animationUpdate; } |
100 | 102 |
101 void setParentStyle(PassRefPtr<ComputedStyle> parentStyle) { | 103 void setParentStyle(PassRefPtr<ComputedStyle> parentStyle) { |
102 m_parentStyle = parentStyle; | 104 m_parentStyle = parentStyle; |
103 } | 105 } |
104 const ComputedStyle* parentStyle() const { return m_parentStyle.get(); } | 106 const ComputedStyle* parentStyle() const { return m_parentStyle.get(); } |
105 ComputedStyle* parentStyle() { return m_parentStyle.get(); } | 107 ComputedStyle* parentStyle() { return m_parentStyle.get(); } |
106 | 108 |
107 // FIXME: These are effectively side-channel "out parameters" for the various | 109 // FIXME: These are effectively side-channel "out parameters" for the various |
108 // map functions. When we map from CSS to style objects we use this state obje
ct | 110 // map functions. When we map from CSS to style objects we use this state |
109 // to track various meta-data about that mapping (e.g. if it's cache-able). | 111 // object to track various meta-data about that mapping (e.g. if it's |
110 // We need to move this data off of StyleResolverState and closer to the | 112 // cache-able). We need to move this data off of StyleResolverState and |
111 // objects it applies to. Possibly separating (immutable) inputs from (mutable
) outputs. | 113 // closer to the objects it applies to. Possibly separating (immutable) inputs |
| 114 // from (mutable) outputs. |
112 void setApplyPropertyToRegularStyle(bool isApply) { | 115 void setApplyPropertyToRegularStyle(bool isApply) { |
113 m_applyPropertyToRegularStyle = isApply; | 116 m_applyPropertyToRegularStyle = isApply; |
114 } | 117 } |
115 void setApplyPropertyToVisitedLinkStyle(bool isApply) { | 118 void setApplyPropertyToVisitedLinkStyle(bool isApply) { |
116 m_applyPropertyToVisitedLinkStyle = isApply; | 119 m_applyPropertyToVisitedLinkStyle = isApply; |
117 } | 120 } |
118 bool applyPropertyToRegularStyle() const { | 121 bool applyPropertyToRegularStyle() const { |
119 return m_applyPropertyToRegularStyle; | 122 return m_applyPropertyToRegularStyle; |
120 } | 123 } |
121 bool applyPropertyToVisitedLinkStyle() const { | 124 bool applyPropertyToVisitedLinkStyle() const { |
(...skipping 19 matching lines...) Expand all Loading... |
141 | 144 |
142 // FIXME: Once styleImage can be made to not take a StyleResolverState | 145 // FIXME: Once styleImage can be made to not take a StyleResolverState |
143 // this convenience function should be removed. As-is, without this, call | 146 // this convenience function should be removed. As-is, without this, call |
144 // sites are extremely verbose. | 147 // sites are extremely verbose. |
145 StyleImage* styleImage(CSSPropertyID propertyId, const CSSValue& value) { | 148 StyleImage* styleImage(CSSPropertyID propertyId, const CSSValue& value) { |
146 return m_elementStyleResources.styleImage(propertyId, value); | 149 return m_elementStyleResources.styleImage(propertyId, value); |
147 } | 150 } |
148 | 151 |
149 FontBuilder& fontBuilder() { return m_fontBuilder; } | 152 FontBuilder& fontBuilder() { return m_fontBuilder; } |
150 const FontBuilder& fontBuilder() const { return m_fontBuilder; } | 153 const FontBuilder& fontBuilder() const { return m_fontBuilder; } |
151 // FIXME: These exist as a primitive way to track mutations to font-related pr
operties | 154 // FIXME: These exist as a primitive way to track mutations to font-related |
152 // on a ComputedStyle. As designed, these are very error-prone, as some caller
s | 155 // properties on a ComputedStyle. As designed, these are very error-prone, as |
153 // set these directly on the ComputedStyle w/o telling us. Presumably we'll | 156 // some callers set these directly on the ComputedStyle w/o telling us. |
154 // want to design a better wrapper around ComputedStyle for tracking these mut
ations | 157 // Presumably we'll want to design a better wrapper around ComputedStyle for |
155 // and separate it from StyleResolverState. | 158 // tracking these mutations and separate it from StyleResolverState. |
156 const FontDescription& parentFontDescription() const { | 159 const FontDescription& parentFontDescription() const { |
157 return m_parentStyle->getFontDescription(); | 160 return m_parentStyle->getFontDescription(); |
158 } | 161 } |
159 | 162 |
160 void setZoom(float f) { | 163 void setZoom(float f) { |
161 if (m_style->setZoom(f)) | 164 if (m_style->setZoom(f)) |
162 m_fontBuilder.didChangeEffectiveZoom(); | 165 m_fontBuilder.didChangeEffectiveZoom(); |
163 } | 166 } |
164 void setEffectiveZoom(float f) { | 167 void setEffectiveZoom(float f) { |
165 if (m_style->setEffectiveZoom(f)) | 168 if (m_style->setEffectiveZoom(f)) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 217 |
215 mutable HeapHashMap< | 218 mutable HeapHashMap< |
216 Member<const CSSPendingSubstitutionValue>, | 219 Member<const CSSPendingSubstitutionValue>, |
217 Member<HeapHashMap<CSSPropertyID, Member<const CSSValue>>>> | 220 Member<HeapHashMap<CSSPropertyID, Member<const CSSValue>>>> |
218 m_parsedPropertiesForPendingSubstitutionCache; | 221 m_parsedPropertiesForPendingSubstitutionCache; |
219 }; | 222 }; |
220 | 223 |
221 } // namespace blink | 224 } // namespace blink |
222 | 225 |
223 #endif // StyleResolverState_h | 226 #endif // StyleResolverState_h |
OLD | NEW |