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