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

Side by Side Diff: Source/core/rendering/style/CachedUAStyle.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
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 21 matching lines...) Expand all
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 CachedUAStyle()
36 : hasAppearance(false) 36 : hasAppearance(false)
37 , backgroundLayers(BackgroundFillLayer) 37 , backgroundLayers(BackgroundFillLayer)
38 , backgroundColor(StyleColor::currentColor()) 38 , backgroundColor(StyleColor::currentColor())
39 { } 39 { }
40 40
41 explicit CachedUAStyle(const RenderStyle* style) 41 explicit CachedUAStyle(const RenderStyle* style)
42 : hasAppearance(style->hasAppearance()) 42 : hasAppearance(true)
43 , backgroundLayers(BackgroundFillLayer) 43 , backgroundLayers(BackgroundFillLayer)
44 , backgroundColor(StyleColor::currentColor()) 44 , backgroundColor(StyleColor::currentColor())
45 { 45 {
46 // RenderTheme::adjustStyle is the only consumer of this data. 46 ASSERT(style->hasAppearance());
47 // It only cares about the styles if appearance is set,
48 // so we cheat and don't bother to copy them when !hasAppearance.
49 if (!hasAppearance)
50 return;
51 border = style->border(); 47 border = style->border();
52 backgroundLayers = *style->backgroundLayers(); 48 backgroundLayers = *style->backgroundLayers();
53 backgroundColor = style->backgroundColor(); 49 backgroundColor = style->backgroundColor();
54 } 50 }
55 51
56 bool hasAppearance; 52 bool hasAppearance;
57 BorderData border; 53 BorderData border;
58 FillLayer backgroundLayers; 54 FillLayer backgroundLayers;
59 StyleColor backgroundColor; 55 StyleColor backgroundColor;
60 }; 56 };
61 57
62 58
63 } // namespace WebCore 59 } // namespace WebCore
64 60
65 #endif // CachedUAStyle_h 61 #endif // CachedUAStyle_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698