OLD | NEW |
1 /** | 1 /** |
2 * This file is part of the theme implementation for form controls in WebCore. | 2 * This file is part of the theme implementation for form controls in WebCore. |
3 * | 3 * |
4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Computer, Inc. | 4 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Computer, Inc. |
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 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 | 933 |
934 void RenderTheme::adjustSearchFieldResultsDecorationStyle(RenderStyle*, Element*
) const | 934 void RenderTheme::adjustSearchFieldResultsDecorationStyle(RenderStyle*, Element*
) const |
935 { | 935 { |
936 } | 936 } |
937 | 937 |
938 void RenderTheme::platformColorsDidChange() | 938 void RenderTheme::platformColorsDidChange() |
939 { | 939 { |
940 Page::scheduleForcedStyleRecalcForAllPages(); | 940 Page::scheduleForcedStyleRecalcForAllPages(); |
941 } | 941 } |
942 | 942 |
| 943 static FontDescription& getCachedFontDescription(CSSValueID systemFontID) |
| 944 { |
| 945 DEFINE_STATIC_LOCAL(FontDescription, caption, ()); |
| 946 DEFINE_STATIC_LOCAL(FontDescription, icon, ()); |
| 947 DEFINE_STATIC_LOCAL(FontDescription, menu, ()); |
| 948 DEFINE_STATIC_LOCAL(FontDescription, messageBox, ()); |
| 949 DEFINE_STATIC_LOCAL(FontDescription, smallCaption, ()); |
| 950 DEFINE_STATIC_LOCAL(FontDescription, statusBar, ()); |
| 951 DEFINE_STATIC_LOCAL(FontDescription, webkitMiniControl, ()); |
| 952 DEFINE_STATIC_LOCAL(FontDescription, webkitSmallControl, ()); |
| 953 DEFINE_STATIC_LOCAL(FontDescription, webkitControl, ()); |
| 954 DEFINE_STATIC_LOCAL(FontDescription, defaultDescription, ()); |
| 955 switch (systemFontID) { |
| 956 case CSSValueCaption: |
| 957 return caption; |
| 958 case CSSValueIcon: |
| 959 return icon; |
| 960 case CSSValueMenu: |
| 961 return menu; |
| 962 case CSSValueMessageBox: |
| 963 return messageBox; |
| 964 case CSSValueSmallCaption: |
| 965 return smallCaption; |
| 966 case CSSValueStatusBar: |
| 967 return statusBar; |
| 968 case CSSValueWebkitMiniControl: |
| 969 return webkitMiniControl; |
| 970 case CSSValueWebkitSmallControl: |
| 971 return webkitSmallControl; |
| 972 case CSSValueWebkitControl: |
| 973 return webkitControl; |
| 974 case CSSValueNone: |
| 975 return defaultDescription; |
| 976 default: |
| 977 ASSERT_NOT_REACHED(); |
| 978 return defaultDescription; |
| 979 } |
| 980 } |
| 981 |
| 982 void RenderTheme::systemFont(CSSValueID systemFontID, FontDescription& fontDescr
iption) |
| 983 { |
| 984 fontDescription = getCachedFontDescription(systemFontID); |
| 985 if (fontDescription.isAbsoluteSize()) |
| 986 return; |
| 987 |
| 988 FontStyle fontStyle = FontStyleNormal; |
| 989 FontWeight fontWeight = FontWeightNormal; |
| 990 float fontSize = 0; |
| 991 AtomicString fontFamily; |
| 992 systemFont(systemFontID, fontStyle, fontWeight, fontSize, fontFamily); |
| 993 fontDescription.setStyle(fontStyle); |
| 994 fontDescription.setWeight(fontWeight); |
| 995 fontDescription.setSpecifiedSize(fontSize); |
| 996 fontDescription.setIsAbsoluteSize(true); |
| 997 fontDescription.firstFamily().setFamily(fontFamily); |
| 998 fontDescription.setGenericFamily(FontDescription::NoFamily); |
| 999 } |
| 1000 |
943 Color RenderTheme::systemColor(CSSValueID cssValueId) const | 1001 Color RenderTheme::systemColor(CSSValueID cssValueId) const |
944 { | 1002 { |
945 switch (cssValueId) { | 1003 switch (cssValueId) { |
946 case CSSValueActiveborder: | 1004 case CSSValueActiveborder: |
947 return 0xFFFFFFFF; | 1005 return 0xFFFFFFFF; |
948 case CSSValueActivecaption: | 1006 case CSSValueActivecaption: |
949 return 0xFFCCCCCC; | 1007 return 0xFFCCCCCC; |
950 case CSSValueAppworkspace: | 1008 case CSSValueAppworkspace: |
951 return 0xFFFFFFFF; | 1009 return 0xFFFFFFFF; |
952 case CSSValueBackground: | 1010 case CSSValueBackground: |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 | 1257 |
1200 // padding - not honored by WinIE, needs to be removed. | 1258 // padding - not honored by WinIE, needs to be removed. |
1201 style->resetPadding(); | 1259 style->resetPadding(); |
1202 | 1260 |
1203 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) | 1261 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) |
1204 // for now, we will not honor it. | 1262 // for now, we will not honor it. |
1205 style->resetBorder(); | 1263 style->resetBorder(); |
1206 } | 1264 } |
1207 | 1265 |
1208 } // namespace blink | 1266 } // namespace blink |
OLD | NEW |