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

Side by Side Diff: Source/core/rendering/style/CachedUAStyle.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/rendering/RenderThemeChromiumMac.mm ('k') | no next file » | 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) 2013 Google, Inc. 2 * Copyright (C) 2013 Google, Inc.
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 14 matching lines...) Expand all
25 #include "core/rendering/style/RenderStyle.h" 25 #include "core/rendering/style/RenderStyle.h"
26 26
27 namespace WebCore { 27 namespace WebCore {
28 28
29 // RenderTheme::adjustStyle wants the background and borders 29 // RenderTheme::adjustStyle wants the background and borders
30 // as specified by the UA sheets, excluding any author rules. 30 // as specified by the UA sheets, excluding any author rules.
31 // We use this class to cache those values during 31 // We use this class to cache those values during
32 // applyMatchedProperties for later use during adjustRenderStyle. 32 // applyMatchedProperties for later use during adjustRenderStyle.
33 class CachedUAStyle { 33 class CachedUAStyle {
34 public: 34 public:
35 CachedUAStyle() 35 static PassOwnPtr<CachedUAStyle> create(const RenderStyle* style)
36 : hasAppearance(false) 36 {
37 , backgroundLayers(BackgroundFillLayer) 37 return adoptPtr(new CachedUAStyle(style));
38 , backgroundColor(StyleColor::currentColor()) 38 }
39 { }
40 39
40 bool hasAppearance;
41 BorderData border;
42 FillLayer backgroundLayers;
43 StyleColor backgroundColor;
44
45 private:
41 explicit CachedUAStyle(const RenderStyle* style) 46 explicit CachedUAStyle(const RenderStyle* style)
42 : hasAppearance(true) 47 : hasAppearance(true)
43 , backgroundLayers(BackgroundFillLayer) 48 , backgroundLayers(BackgroundFillLayer)
44 , backgroundColor(StyleColor::currentColor()) 49 , backgroundColor(StyleColor::currentColor())
45 { 50 {
46 ASSERT(style->hasAppearance()); 51 ASSERT(style->hasAppearance());
47 border = style->border(); 52 border = style->border();
48 backgroundLayers = *style->backgroundLayers(); 53 backgroundLayers = *style->backgroundLayers();
49 backgroundColor = style->backgroundColor(); 54 backgroundColor = style->backgroundColor();
50 } 55 }
56 };
51 57
52 bool hasAppearance;
53 BorderData border;
54 FillLayer backgroundLayers;
55 StyleColor backgroundColor;
56 };
57 58
58 59
59 } // namespace WebCore 60 } // namespace WebCore
60 61
61 #endif // CachedUAStyle_h 62 #endif // CachedUAStyle_h
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderThemeChromiumMac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698