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

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

Issue 889563002: Make RenderObject::style() return a const object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Blind fix for Mac. 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&, RenderStyle* par entStyle); 48 StyleResolverState(Document&, const ElementResolveContext&, const RenderStyl e* parentStyle);
49 StyleResolverState(Document&, Element*, RenderStyle* parentStyle = 0); 49 StyleResolverState(Document&, Element*, const RenderStyle* 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 RenderStyle* rootElementStyle() const { return m_elementContext.rootEl ementStyle(); } 58 const RenderStyle* 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 14 matching lines...) Expand all
74 74
75 const CSSToLengthConversionData& cssToLengthConversionData() const { return m_cssToLengthConversionData; } 75 const CSSToLengthConversionData& cssToLengthConversionData() const { return m_cssToLengthConversionData; }
76 76
77 void setConversionFontSizes(const CSSToLengthConversionData::FontSizes& font Sizes) { m_cssToLengthConversionData.setFontSizes(fontSizes); } 77 void setConversionFontSizes(const CSSToLengthConversionData::FontSizes& font Sizes) { m_cssToLengthConversionData.setFontSizes(fontSizes); }
78 void setConversionZoom(float zoom) { m_cssToLengthConversionData.setZoom(zoo m); } 78 void setConversionZoom(float zoom) { m_cssToLengthConversionData.setZoom(zoo m); }
79 79
80 void setAnimationUpdate(PassOwnPtrWillBeRawPtr<CSSAnimationUpdate>); 80 void setAnimationUpdate(PassOwnPtrWillBeRawPtr<CSSAnimationUpdate>);
81 const CSSAnimationUpdate* animationUpdate() { return m_animationUpdate.get() ; } 81 const CSSAnimationUpdate* animationUpdate() { return m_animationUpdate.get() ; }
82 PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> takeAnimationUpdate(); 82 PassOwnPtrWillBeRawPtr<CSSAnimationUpdate> takeAnimationUpdate();
83 83
84 void setParentStyle(PassRefPtr<RenderStyle> parentStyle) { m_parentStyle = p arentStyle; } 84 void setParentStyle(PassRefPtr<RenderStyle> parentStyle) { m_overrideParentS tyle = parentStyle; }
85 const RenderStyle* parentStyle() const { return m_parentStyle.get(); } 85 const RenderStyle* parentStyle() const
86 RenderStyle* parentStyle() { return m_parentStyle.get(); } 86 {
87 if (m_overrideParentStyle)
88 return m_overrideParentStyle.get();
89 return m_parentStyle;
90 }
87 91
88 // FIXME: These are effectively side-channel "out parameters" for the variou s 92 // FIXME: These are effectively side-channel "out parameters" for the variou s
89 // map functions. When we map from CSS to style objects we use this state ob ject 93 // map functions. When we map from CSS to style objects we use this state ob ject
90 // to track various meta-data about that mapping (e.g. if it's cache-able). 94 // to track various meta-data about that mapping (e.g. if it's cache-able).
91 // We need to move this data off of StyleResolverState and closer to the 95 // We need to move this data off of StyleResolverState and closer to the
92 // objects it applies to. Possibly separating (immutable) inputs from (mutab le) outputs. 96 // objects it applies to. Possibly separating (immutable) inputs from (mutab le) outputs.
93 void setApplyPropertyToRegularStyle(bool isApply) { m_applyPropertyToRegular Style = isApply; } 97 void setApplyPropertyToRegularStyle(bool isApply) { m_applyPropertyToRegular Style = isApply; }
94 void setApplyPropertyToVisitedLinkStyle(bool isApply) { m_applyPropertyToVis itedLinkStyle = isApply; } 98 void setApplyPropertyToVisitedLinkStyle(bool isApply) { m_applyPropertyToVis itedLinkStyle = isApply; }
95 bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularSt yle; } 99 bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularSt yle; }
96 bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisit edLinkStyle; } 100 bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisit edLinkStyle; }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 ElementResolveContext m_elementContext; 140 ElementResolveContext m_elementContext;
137 RawPtrWillBeMember<Document> m_document; 141 RawPtrWillBeMember<Document> m_document;
138 142
139 // m_style is the primary output for each element's style resolve. 143 // m_style is the primary output for each element's style resolve.
140 RefPtr<RenderStyle> m_style; 144 RefPtr<RenderStyle> m_style;
141 145
142 CSSToLengthConversionData m_cssToLengthConversionData; 146 CSSToLengthConversionData m_cssToLengthConversionData;
143 147
144 // m_parentStyle is not always just ElementResolveContext::parentStyle, 148 // m_parentStyle is not always just ElementResolveContext::parentStyle,
145 // so we keep it separate. 149 // so we keep it separate.
146 RefPtr<RenderStyle> m_parentStyle; 150 const RenderStyle* m_parentStyle;
151 RefPtr<RenderStyle> m_overrideParentStyle;
147 152
148 OwnPtrWillBeMember<CSSAnimationUpdate> m_animationUpdate; 153 OwnPtrWillBeMember<CSSAnimationUpdate> m_animationUpdate;
149 154
150 bool m_applyPropertyToRegularStyle; 155 bool m_applyPropertyToRegularStyle;
151 bool m_applyPropertyToVisitedLinkStyle; 156 bool m_applyPropertyToVisitedLinkStyle;
152 157
153 FontBuilder m_fontBuilder; 158 FontBuilder m_fontBuilder;
154 159
155 OwnPtr<CachedUAStyle> m_cachedUAStyle; 160 OwnPtr<CachedUAStyle> m_cachedUAStyle;
156 161
157 ElementStyleResources m_elementStyleResources; 162 ElementStyleResources m_elementStyleResources;
158 }; 163 };
159 164
160 } // namespace blink 165 } // namespace blink
161 166
162 #endif // StyleResolverState_h 167 #endif // StyleResolverState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698