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

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

Issue 338673002: Reduce the number of CachedUAStyles (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Return a create that somehow escaped Created 6 years, 6 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
« no previous file with comments | « Source/core/css/resolver/StyleResolver.cpp ('k') | Source/core/rendering/RenderTheme.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 void setLineHeightValue(CSSValue* value) { m_lineHeightValue = value; } 94 void setLineHeightValue(CSSValue* value) { m_lineHeightValue = value; }
95 CSSValue* lineHeightValue() { return m_lineHeightValue; } 95 CSSValue* lineHeightValue() { return m_lineHeightValue; }
96 96
97 void cacheUserAgentBorderAndBackground() 97 void cacheUserAgentBorderAndBackground()
98 { 98 {
99 // RenderTheme only needs the cached style if it has an appearance, 99 // RenderTheme only needs the cached style if it has an appearance,
100 // and constructing it is expensive so we avoid it if possible. 100 // and constructing it is expensive so we avoid it if possible.
101 if (!style()->hasAppearance()) 101 if (!style()->hasAppearance())
102 return; 102 return;
103 m_cachedUAStyle = CachedUAStyle(style()); 103
104 m_cachedUAStyle = CachedUAStyle::create(style());
104 } 105 }
105 const CachedUAStyle& cachedUAStyle() const { return m_cachedUAStyle; } 106
107 const CachedUAStyle* cachedUAStyle() const
108 {
109 return m_cachedUAStyle.get();
110 }
106 111
107 ElementStyleResources& elementStyleResources() { return m_elementStyleResour ces; } 112 ElementStyleResources& elementStyleResources() { return m_elementStyleResour ces; }
108 const CSSToStyleMap& styleMap() const { return m_styleMap; } 113 const CSSToStyleMap& styleMap() const { return m_styleMap; }
109 CSSToStyleMap& styleMap() { return m_styleMap; } 114 CSSToStyleMap& styleMap() { return m_styleMap; }
110 115
111 // FIXME: Once styleImage can be made to not take a StyleResolverState 116 // FIXME: Once styleImage can be made to not take a StyleResolverState
112 // this convenience function should be removed. As-is, without this, call 117 // this convenience function should be removed. As-is, without this, call
113 // sites are extremely verbose. 118 // sites are extremely verbose.
114 PassRefPtr<StyleImage> styleImage(CSSPropertyID propertyId, CSSValue* value) 119 PassRefPtr<StyleImage> styleImage(CSSPropertyID propertyId, CSSValue* value)
115 { 120 {
(...skipping 27 matching lines...) Expand all
143 148
144 OwnPtrWillBeMember<CSSAnimationUpdate> m_animationUpdate; 149 OwnPtrWillBeMember<CSSAnimationUpdate> m_animationUpdate;
145 150
146 bool m_applyPropertyToRegularStyle; 151 bool m_applyPropertyToRegularStyle;
147 bool m_applyPropertyToVisitedLinkStyle; 152 bool m_applyPropertyToVisitedLinkStyle;
148 153
149 RawPtrWillBeMember<CSSValue> m_lineHeightValue; 154 RawPtrWillBeMember<CSSValue> m_lineHeightValue;
150 155
151 FontBuilder m_fontBuilder; 156 FontBuilder m_fontBuilder;
152 157
153 CachedUAStyle m_cachedUAStyle; 158 OwnPtr<CachedUAStyle> m_cachedUAStyle;
154 159
155 ElementStyleResources m_elementStyleResources; 160 ElementStyleResources m_elementStyleResources;
156 // CSSToStyleMap is a pure-logic class and only contains 161 // CSSToStyleMap is a pure-logic class and only contains
157 // a back-pointer to this object. 162 // a back-pointer to this object.
158 CSSToStyleMap m_styleMap; 163 CSSToStyleMap m_styleMap;
159 Vector<AtomicString> m_contentAttrValues; 164 Vector<AtomicString> m_contentAttrValues;
160 165
161 RawPtrWillBeMember<StyleRule> m_currentRule; 166 RawPtrWillBeMember<StyleRule> m_currentRule;
162 }; 167 };
163 168
164 } // namespace WebCore 169 } // namespace WebCore
165 170
166 #endif // StyleResolverState_h 171 #endif // StyleResolverState_h
OLDNEW
« no previous file with comments | « Source/core/css/resolver/StyleResolver.cpp ('k') | Source/core/rendering/RenderTheme.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698