OLD | NEW |
---|---|
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 Loading... | |
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 |
OLD | NEW |