Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: trunk/Source/core/css/resolver/StyleResolverState.h

Issue 948053002: Revert 190605 "Make RenderObject::style() return a const object" (Closed) Base URL: svn://svn.chromium.org/blink/
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 27 matching lines...) Expand all
38 38
39 namespace blink { 39 namespace blink {
40 40
41 class CSSAnimationUpdate; 41 class CSSAnimationUpdate;
42 class FontDescription; 42 class FontDescription;
43 43
44 class StyleResolverState { 44 class StyleResolverState {
45 STACK_ALLOCATED(); 45 STACK_ALLOCATED();
46 WTF_MAKE_NONCOPYABLE(StyleResolverState); 46 WTF_MAKE_NONCOPYABLE(StyleResolverState);
47 public: 47 public:
48 StyleResolverState(Document&, const ElementResolveContext&, const LayoutStyl e* parentStyle); 48 StyleResolverState(Document&, const ElementResolveContext&, LayoutStyle* par entStyle);
49 StyleResolverState(Document&, Element*, const LayoutStyle* parentStyle = 0); 49 StyleResolverState(Document&, Element*, LayoutStyle* parentStyle = 0);
50 ~StyleResolverState(); 50 ~StyleResolverState();
51 51
52 // In FontFaceSet and CanvasRenderingContext2D, we don't have an element to grab the document from. 52 // In FontFaceSet and CanvasRenderingContext2D, we don't have an element to grab the document from.
53 // This is why we have to store the document separately. 53 // This is why we have to store the document separately.
54 Document& document() const { return *m_document; } 54 Document& document() const { return *m_document; }
55 // These are all just pass-through methods to ElementResolveContext. 55 // These are all just pass-through methods to ElementResolveContext.
56 Element* element() const { return m_elementContext.element(); } 56 Element* element() const { return m_elementContext.element(); }
57 const ContainerNode* parentNode() const { return m_elementContext.parentNode (); } 57 const ContainerNode* parentNode() const { return m_elementContext.parentNode (); }
58 const LayoutStyle* rootElementStyle() const { return m_elementContext.rootEl ementStyle(); } 58 const LayoutStyle* rootElementStyle() const { return m_elementContext.rootEl ementStyle(); }
59 EInsideLink elementLinkState() const { return m_elementContext.elementLinkSt ate(); } 59 EInsideLink elementLinkState() const { return m_elementContext.elementLinkSt ate(); }
(...skipping 16 matching lines...) Expand all
76 76
77 const CSSToLengthConversionData& cssToLengthConversionData() const { return m_cssToLengthConversionData; } 77 const CSSToLengthConversionData& cssToLengthConversionData() const { return m_cssToLengthConversionData; }
78 78
79 void setConversionFontSizes(const CSSToLengthConversionData::FontSizes& font Sizes) { m_cssToLengthConversionData.setFontSizes(fontSizes); } 79 void setConversionFontSizes(const CSSToLengthConversionData::FontSizes& font Sizes) { m_cssToLengthConversionData.setFontSizes(fontSizes); }
80 void setConversionZoom(float zoom) { m_cssToLengthConversionData.setZoom(zoo m); } 80 void setConversionZoom(float zoom) { m_cssToLengthConversionData.setZoom(zoo m); }
81 81
82 void setAnimationUpdate(PassOwnPtrWillBeRawPtr<CSSAnimationUpdate>); 82 void setAnimationUpdate(PassOwnPtrWillBeRawPtr<CSSAnimationUpdate>);
83 const CSSAnimationUpdate* animationUpdate() { return m_animationUpdate.get() ; } 83 const CSSAnimationUpdate* animationUpdate() { return m_animationUpdate.get() ; }
84 PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> takeAnimationUpdate(); 84 PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> takeAnimationUpdate();
85 85
86 void setParentStyle(PassRefPtr<LayoutStyle> parentStyle) { m_overrideParentS tyle = parentStyle; } 86 void setParentStyle(PassRefPtr<LayoutStyle> parentStyle) { m_parentStyle = p arentStyle; }
87 const LayoutStyle* parentStyle() const 87 const LayoutStyle* parentStyle() const { return m_parentStyle.get(); }
88 { 88 LayoutStyle* parentStyle() { return m_parentStyle.get(); }
89 if (m_overrideParentStyle)
90 return m_overrideParentStyle.get();
91 return m_parentStyle;
92 }
93 89
94 // FIXME: These are effectively side-channel "out parameters" for the variou s 90 // FIXME: These are effectively side-channel "out parameters" for the variou s
95 // map functions. When we map from CSS to style objects we use this state ob ject 91 // map functions. When we map from CSS to style objects we use this state ob ject
96 // to track various meta-data about that mapping (e.g. if it's cache-able). 92 // to track various meta-data about that mapping (e.g. if it's cache-able).
97 // We need to move this data off of StyleResolverState and closer to the 93 // We need to move this data off of StyleResolverState and closer to the
98 // objects it applies to. Possibly separating (immutable) inputs from (mutab le) outputs. 94 // objects it applies to. Possibly separating (immutable) inputs from (mutab le) outputs.
99 void setApplyPropertyToRegularStyle(bool isApply) { m_applyPropertyToRegular Style = isApply; } 95 void setApplyPropertyToRegularStyle(bool isApply) { m_applyPropertyToRegular Style = isApply; }
100 void setApplyPropertyToVisitedLinkStyle(bool isApply) { m_applyPropertyToVis itedLinkStyle = isApply; } 96 void setApplyPropertyToVisitedLinkStyle(bool isApply) { m_applyPropertyToVis itedLinkStyle = isApply; }
101 bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularSt yle; } 97 bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularSt yle; }
102 bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisit edLinkStyle; } 98 bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisit edLinkStyle; }
(...skipping 22 matching lines...) Expand all
125 { 121 {
126 return m_elementStyleResources.styleImage(document(), document().textLin kColors(), style()->color(), propertyId, value); 122 return m_elementStyleResources.styleImage(document(), document().textLin kColors(), style()->color(), propertyId, value);
127 } 123 }
128 124
129 FontBuilder& fontBuilder() { return m_fontBuilder; } 125 FontBuilder& fontBuilder() { return m_fontBuilder; }
130 // FIXME: These exist as a primitive way to track mutations to font-related properties 126 // FIXME: These exist as a primitive way to track mutations to font-related properties
131 // on a LayoutStyle. As designed, these are very error-prone, as some caller s 127 // on a LayoutStyle. As designed, these are very error-prone, as some caller s
132 // set these directly on the LayoutStyle w/o telling us. Presumably we'll 128 // set these directly on the LayoutStyle w/o telling us. Presumably we'll
133 // want to design a better wrapper around LayoutStyle for tracking these mut ations 129 // want to design a better wrapper around LayoutStyle for tracking these mut ations
134 // and separate it from StyleResolverState. 130 // and separate it from StyleResolverState.
135 const FontDescription& parentFontDescription() { return parentStyle()->fontD escription(); } 131 const FontDescription& parentFontDescription() { return m_parentStyle->fontD escription(); }
136 132
137 void setZoom(float f) 133 void setZoom(float f)
138 { 134 {
139 if (m_style->setZoom(f)) 135 if (m_style->setZoom(f))
140 m_fontBuilder.didChangeEffectiveZoom(); 136 m_fontBuilder.didChangeEffectiveZoom();
141 } 137 }
142 void setEffectiveZoom(float f) 138 void setEffectiveZoom(float f)
143 { 139 {
144 if (m_style->setEffectiveZoom(f)) 140 if (m_style->setEffectiveZoom(f))
145 m_fontBuilder.didChangeEffectiveZoom(); 141 m_fontBuilder.didChangeEffectiveZoom();
(...skipping 13 matching lines...) Expand all
159 ElementResolveContext m_elementContext; 155 ElementResolveContext m_elementContext;
160 RawPtrWillBeMember<Document> m_document; 156 RawPtrWillBeMember<Document> m_document;
161 157
162 // m_style is the primary output for each element's style resolve. 158 // m_style is the primary output for each element's style resolve.
163 RefPtr<LayoutStyle> m_style; 159 RefPtr<LayoutStyle> m_style;
164 160
165 CSSToLengthConversionData m_cssToLengthConversionData; 161 CSSToLengthConversionData m_cssToLengthConversionData;
166 162
167 // m_parentStyle is not always just ElementResolveContext::parentStyle, 163 // m_parentStyle is not always just ElementResolveContext::parentStyle,
168 // so we keep it separate. 164 // so we keep it separate.
169 const LayoutStyle* m_parentStyle; 165 RefPtr<LayoutStyle> m_parentStyle;
170 RefPtr<LayoutStyle> m_overrideParentStyle;
171 166
172 OwnPtrWillBeMember<CSSAnimationUpdate> m_animationUpdate; 167 OwnPtrWillBeMember<CSSAnimationUpdate> m_animationUpdate;
173 168
174 bool m_applyPropertyToRegularStyle; 169 bool m_applyPropertyToRegularStyle;
175 bool m_applyPropertyToVisitedLinkStyle; 170 bool m_applyPropertyToVisitedLinkStyle;
176 171
177 FontBuilder m_fontBuilder; 172 FontBuilder m_fontBuilder;
178 173
179 OwnPtr<CachedUAStyle> m_cachedUAStyle; 174 OwnPtr<CachedUAStyle> m_cachedUAStyle;
180 175
181 ElementStyleResources m_elementStyleResources; 176 ElementStyleResources m_elementStyleResources;
182 }; 177 };
183 178
184 } // namespace blink 179 } // namespace blink
185 180
186 #endif // StyleResolverState_h 181 #endif // StyleResolverState_h
OLDNEW
« no previous file with comments | « trunk/Source/core/css/resolver/StyleResolver.cpp ('k') | trunk/Source/core/css/resolver/StyleResolverState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698