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

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

Issue 772803002: Delay construction of StyleResolverState until after style sharing. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years 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
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&, Element*, RenderStyle* parentStyle = 0); 49 StyleResolverState(Document&, Element*, RenderStyle* parentStyle = 0);
49 ~StyleResolverState(); 50 ~StyleResolverState();
50 51
51 // 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.
52 // This is why we have to store the document separately. 53 // This is why we have to store the document separately.
53 Document& document() const { return *m_document; } 54 Document& document() const { return *m_document; }
54 // These are all just pass-through methods to ElementResolveContext. 55 // These are all just pass-through methods to ElementResolveContext.
55 Element* element() const { return m_elementContext.element(); } 56 Element* element() const { return m_elementContext.element(); }
56 const ContainerNode* parentNode() const { return m_elementContext.parentNode (); } 57 const ContainerNode* parentNode() const { return m_elementContext.parentNode (); }
57 const RenderStyle* rootElementStyle() const { return m_elementContext.rootEl ementStyle(); } 58 const RenderStyle* rootElementStyle() const { return m_elementContext.rootEl ementStyle(); }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 139
139 private: 140 private:
140 ElementResolveContext m_elementContext; 141 ElementResolveContext m_elementContext;
141 RawPtrWillBeMember<Document> m_document; 142 RawPtrWillBeMember<Document> m_document;
142 143
143 // m_style is the primary output for each element's style resolve. 144 // m_style is the primary output for each element's style resolve.
144 RefPtr<RenderStyle> m_style; 145 RefPtr<RenderStyle> m_style;
145 146
146 CSSToLengthConversionData m_cssToLengthConversionData; 147 CSSToLengthConversionData m_cssToLengthConversionData;
147 148
148 // m_parentStyle is not always just element->parentNode()->style() 149 // m_parentStyle is not always just ElementResolveContext::parentStyle,
149 // so we keep it separate from m_elementContext. 150 // so we keep it separate.
150 RefPtr<RenderStyle> m_parentStyle; 151 RefPtr<RenderStyle> m_parentStyle;
151 152
152 OwnPtrWillBeMember<CSSAnimationUpdate> m_animationUpdate; 153 OwnPtrWillBeMember<CSSAnimationUpdate> m_animationUpdate;
153 154
154 bool m_applyPropertyToRegularStyle; 155 bool m_applyPropertyToRegularStyle;
155 bool m_applyPropertyToVisitedLinkStyle; 156 bool m_applyPropertyToVisitedLinkStyle;
156 157
157 FontBuilder m_fontBuilder; 158 FontBuilder m_fontBuilder;
158 159
159 OwnPtr<CachedUAStyle> m_cachedUAStyle; 160 OwnPtr<CachedUAStyle> m_cachedUAStyle;
160 161
161 ElementStyleResources m_elementStyleResources; 162 ElementStyleResources m_elementStyleResources;
162 // CSSToStyleMap is a pure-logic class and only contains 163 // CSSToStyleMap is a pure-logic class and only contains
163 // a back-pointer to this object. 164 // a back-pointer to this object.
164 CSSToStyleMap m_styleMap; 165 CSSToStyleMap m_styleMap;
165 Vector<AtomicString> m_contentAttrValues; 166 Vector<AtomicString> m_contentAttrValues;
166 }; 167 };
167 168
168 } // namespace blink 169 } // namespace blink
169 170
170 #endif // StyleResolverState_h 171 #endif // StyleResolverState_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698