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

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: Ownptrization and a null check 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 inline PassOwnPtr<CachedUAStyle> create(const RenderStyle*);
36 : hasAppearance(false)
37 , backgroundLayers(BackgroundFillLayer)
38 , backgroundColor(StyleColor::currentColor())
39 { }
40 36
37 bool hasAppearance;
38 BorderData border;
39 FillLayer backgroundLayers;
40 StyleColor backgroundColor;
41
42 private:
41 explicit CachedUAStyle(const RenderStyle* style) 43 explicit CachedUAStyle(const RenderStyle* style)
42 : hasAppearance(true) 44 : hasAppearance(true)
43 , backgroundLayers(BackgroundFillLayer) 45 , backgroundLayers(BackgroundFillLayer)
44 , backgroundColor(StyleColor::currentColor()) 46 , backgroundColor(StyleColor::currentColor())
45 { 47 {
46 ASSERT(style->hasAppearance()); 48 ASSERT(style->hasAppearance());
47 border = style->border(); 49 border = style->border();
48 backgroundLayers = *style->backgroundLayers(); 50 backgroundLayers = *style->backgroundLayers();
49 backgroundColor = style->backgroundColor(); 51 backgroundColor = style->backgroundColor();
50 } 52 }
51
52 bool hasAppearance;
53 BorderData border;
54 FillLayer backgroundLayers;
55 StyleColor backgroundColor;
56 }; 53 };
57 54
55 PassOwnPtr<CachedUAStyle> CachedUAStyle::create(const RenderStyle* style)
esprehn 2014/06/15 05:09:59 Just put this in the class above.
pdr. 2014/06/15 05:33:45 Done.
56 {
57 return adoptPtr(new CachedUAStyle(style));
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