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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/rendering/style/CachedUAStyle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/StyleResolverState.h
diff --git a/Source/core/css/resolver/StyleResolverState.h b/Source/core/css/resolver/StyleResolverState.h
index 4e01e8c4fa48bc016e62a86868ad8b56e1a2db45..a23f9da7bd9f7b7d7bc7d54b5d91a7d452de4c01 100644
--- a/Source/core/css/resolver/StyleResolverState.h
+++ b/Source/core/css/resolver/StyleResolverState.h
@@ -94,7 +94,14 @@ public:
void setLineHeightValue(CSSValue* value) { m_lineHeightValue = value; }
CSSValue* lineHeightValue() { return m_lineHeightValue; }
- void cacheUserAgentBorderAndBackground() { m_cachedUAStyle = CachedUAStyle(style()); }
+ void cacheUserAgentBorderAndBackground()
ojan 2014/03/17 18:59:13 Nit: this is now kind of big for the header file.
+ {
+ // RenderTheme only needs the cached style if it has an appearance,
+ // and constructing it is expensive so we avoid it if possible.
+ if (!style()->hasAppearance())
+ return;
+ m_cachedUAStyle = CachedUAStyle(style());
+ }
const CachedUAStyle& cachedUAStyle() const { return m_cachedUAStyle; }
ElementStyleResources& elementStyleResources() { return m_elementStyleResources; }
« 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