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

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

Issue 202223002: Avoid copying the CachedUAStyle when possible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | « no previous file | Source/core/rendering/style/CachedUAStyle.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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 void setApplyPropertyToVisitedLinkStyle(bool isApply) { m_applyPropertyToVis itedLinkStyle = isApply; } 87 void setApplyPropertyToVisitedLinkStyle(bool isApply) { m_applyPropertyToVis itedLinkStyle = isApply; }
88 bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularSt yle; } 88 bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularSt yle; }
89 bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisit edLinkStyle; } 89 bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisit edLinkStyle; }
90 90
91 // Holds all attribute names found while applying "content" properties that contain an "attr()" value. 91 // Holds all attribute names found while applying "content" properties that contain an "attr()" value.
92 Vector<AtomicString>& contentAttrValues() { return m_contentAttrValues; } 92 Vector<AtomicString>& contentAttrValues() { return m_contentAttrValues; }
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() { m_cachedUAStyle = CachedUAStyle(s tyle()); } 97 void cacheUserAgentBorderAndBackground()
ojan 2014/03/17 18:59:13 Nit: this is now kind of big for the header file.
98 {
99 // RenderTheme only needs the cached style if it has an appearance,
100 // and constructing it is expensive so we avoid it if possible.
101 if (!style()->hasAppearance())
102 return;
103 m_cachedUAStyle = CachedUAStyle(style());
104 }
98 const CachedUAStyle& cachedUAStyle() const { return m_cachedUAStyle; } 105 const CachedUAStyle& cachedUAStyle() const { return m_cachedUAStyle; }
99 106
100 ElementStyleResources& elementStyleResources() { return m_elementStyleResour ces; } 107 ElementStyleResources& elementStyleResources() { return m_elementStyleResour ces; }
101 const CSSToStyleMap& styleMap() const { return m_styleMap; } 108 const CSSToStyleMap& styleMap() const { return m_styleMap; }
102 CSSToStyleMap& styleMap() { return m_styleMap; } 109 CSSToStyleMap& styleMap() { return m_styleMap; }
103 110
104 // FIXME: Once styleImage can be made to not take a StyleResolverState 111 // FIXME: Once styleImage can be made to not take a StyleResolverState
105 // this convenience function should be removed. As-is, without this, call 112 // this convenience function should be removed. As-is, without this, call
106 // sites are extremely verbose. 113 // sites are extremely verbose.
107 PassRefPtr<StyleImage> styleImage(CSSPropertyID propertyId, CSSValue* value) 114 PassRefPtr<StyleImage> styleImage(CSSPropertyID propertyId, CSSValue* value)
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // a back-pointer to this object. 169 // a back-pointer to this object.
163 CSSToStyleMap m_styleMap; 170 CSSToStyleMap m_styleMap;
164 Vector<AtomicString> m_contentAttrValues; 171 Vector<AtomicString> m_contentAttrValues;
165 172
166 StyleRule* m_currentRule; 173 StyleRule* m_currentRule;
167 }; 174 };
168 175
169 } // namespace WebCore 176 } // namespace WebCore
170 177
171 #endif // StyleResolverState_h 178 #endif // StyleResolverState_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/rendering/style/CachedUAStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698