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 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 | 982 |
983 void RenderTheme::adjustSearchFieldResultsDecorationStyle(RenderStyle*, Element*
) const | 983 void RenderTheme::adjustSearchFieldResultsDecorationStyle(RenderStyle*, Element*
) const |
984 { | 984 { |
985 } | 985 } |
986 | 986 |
987 void RenderTheme::platformColorsDidChange() | 987 void RenderTheme::platformColorsDidChange() |
988 { | 988 { |
989 Page::scheduleForcedStyleRecalcForAllPages(); | 989 Page::scheduleForcedStyleRecalcForAllPages(); |
990 } | 990 } |
991 | 991 |
| 992 static FontDescription& getCachedFontDescription(CSSValueID systemFontID) |
| 993 { |
| 994 DEFINE_STATIC_LOCAL(FontDescription, caption, ()); |
| 995 DEFINE_STATIC_LOCAL(FontDescription, icon, ()); |
| 996 DEFINE_STATIC_LOCAL(FontDescription, menu, ()); |
| 997 DEFINE_STATIC_LOCAL(FontDescription, messageBox, ()); |
| 998 DEFINE_STATIC_LOCAL(FontDescription, smallCaption, ()); |
| 999 DEFINE_STATIC_LOCAL(FontDescription, statusBar, ()); |
| 1000 DEFINE_STATIC_LOCAL(FontDescription, webkitMiniControl, ()); |
| 1001 DEFINE_STATIC_LOCAL(FontDescription, webkitSmallControl, ()); |
| 1002 DEFINE_STATIC_LOCAL(FontDescription, webkitControl, ()); |
| 1003 switch (systemFontID) { |
| 1004 case CSSValueCaption: |
| 1005 return caption; |
| 1006 case CSSValueIcon: |
| 1007 return icon; |
| 1008 case CSSValueMenu: |
| 1009 return menu; |
| 1010 case CSSValueMessageBox: |
| 1011 return messageBox; |
| 1012 case CSSValueSmallCaption: |
| 1013 return smallCaption; |
| 1014 case CSSValueStatusBar: |
| 1015 return statusBar; |
| 1016 case CSSValueWebkitMiniControl: |
| 1017 return webkitMiniControl; |
| 1018 case CSSValueWebkitSmallControl: |
| 1019 return webkitSmallControl; |
| 1020 case CSSValueWebkitControl: |
| 1021 return webkitControl; |
| 1022 default: |
| 1023 ASSERT_NOT_REACHED(); |
| 1024 return caption; |
| 1025 } |
| 1026 } |
| 1027 |
| 1028 void RenderTheme::systemFont(CSSValueID systemFontID, FontDescription& fontDescr
iption) |
| 1029 { |
| 1030 fontDescription = getCachedFontDescription(systemFontID); |
| 1031 if (fontDescription.isAbsoluteSize()) |
| 1032 return; |
| 1033 |
| 1034 FontStyle fontStyle = FontStyleNormal; |
| 1035 FontWeight fontWeight = FontWeightNormal; |
| 1036 float fontSize = 0; |
| 1037 AtomicString fontFamily; |
| 1038 systemFont(systemFontID, fontStyle, fontWeight, fontSize, fontFamily); |
| 1039 fontDescription.setStyle(fontStyle); |
| 1040 fontDescription.setWeight(fontWeight); |
| 1041 fontDescription.setSpecifiedSize(fontSize); |
| 1042 fontDescription.setIsAbsoluteSize(true); |
| 1043 fontDescription.firstFamily().setFamily(fontFamily); |
| 1044 fontDescription.setGenericFamily(FontDescription::NoFamily); |
| 1045 } |
| 1046 |
992 Color RenderTheme::systemColor(CSSValueID cssValueId) const | 1047 Color RenderTheme::systemColor(CSSValueID cssValueId) const |
993 { | 1048 { |
994 switch (cssValueId) { | 1049 switch (cssValueId) { |
995 case CSSValueActiveborder: | 1050 case CSSValueActiveborder: |
996 return 0xFFFFFFFF; | 1051 return 0xFFFFFFFF; |
997 case CSSValueActivecaption: | 1052 case CSSValueActivecaption: |
998 return 0xFFCCCCCC; | 1053 return 0xFFCCCCCC; |
999 case CSSValueAppworkspace: | 1054 case CSSValueAppworkspace: |
1000 return 0xFFFFFFFF; | 1055 return 0xFFFFFFFF; |
1001 case CSSValueBackground: | 1056 case CSSValueBackground: |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1248 | 1303 |
1249 // padding - not honored by WinIE, needs to be removed. | 1304 // padding - not honored by WinIE, needs to be removed. |
1250 style->resetPadding(); | 1305 style->resetPadding(); |
1251 | 1306 |
1252 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) | 1307 // border - honored by WinIE, but looks terrible (just paints in the control
box and turns off the Windows XP theme) |
1253 // for now, we will not honor it. | 1308 // for now, we will not honor it. |
1254 style->resetBorder(); | 1309 style->resetBorder(); |
1255 } | 1310 } |
1256 | 1311 |
1257 } // namespace WebCore | 1312 } // namespace WebCore |
OLD | NEW |