OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 namespace WebCore { | 35 namespace WebCore { |
36 | 36 |
37 // static | 37 // static |
38 void RenderThemeChromiumFontProvider::setDefaultFontSize(int fontSize) | 38 void RenderThemeChromiumFontProvider::setDefaultFontSize(int fontSize) |
39 { | 39 { |
40 s_defaultFontSize = static_cast<float>(fontSize); | 40 s_defaultFontSize = static_cast<float>(fontSize); |
41 } | 41 } |
42 | 42 |
43 // static | 43 // static |
44 void RenderThemeChromiumFontProvider::systemFont(CSSValueID valueID, FontDescrip
tion& fontDescription) | 44 void RenderThemeChromiumFontProvider::systemFont(CSSValueID systemFontID, FontSt
yle& fontStyle, FontWeight& fontWeight, float& fontSize, AtomicString& fontFamil
y) |
45 { | 45 { |
46 float fontSize = s_defaultFontSize; | 46 fontWeight = FontWeightNormal; |
| 47 fontStyle = FontStyleNormal; |
| 48 fontSize = s_defaultFontSize; |
| 49 fontFamily = defaultGUIFont(); |
47 | 50 |
48 switch (valueID) { | 51 switch (systemFontID) { |
49 case CSSValueWebkitMiniControl: | 52 case CSSValueWebkitMiniControl: |
50 case CSSValueWebkitSmallControl: | 53 case CSSValueWebkitSmallControl: |
51 case CSSValueWebkitControl: | 54 case CSSValueWebkitControl: |
52 // Why 2 points smaller? Because that's what Gecko does. Note that we | 55 // Why 2 points smaller? Because that's what Gecko does. Note that we |
53 // are assuming a 96dpi screen, which is the default that we use on | 56 // are assuming a 96dpi screen, which is the default that we use on |
54 // Windows. | 57 // Windows. |
55 static const float pointsPerInch = 72.0f; | 58 static const float pointsPerInch = 72.0f; |
56 static const float pixelsPerInch = 96.0f; | 59 static const float pixelsPerInch = 96.0f; |
57 fontSize -= (2.0f / pointsPerInch) * pixelsPerInch; | 60 fontSize -= (2.0f / pointsPerInch) * pixelsPerInch; |
58 break; | 61 break; |
59 default: | 62 default: |
60 break; | 63 break; |
61 } | 64 } |
62 | |
63 fontDescription.firstFamily().setFamily(defaultGUIFont()); | |
64 fontDescription.setSpecifiedSize(fontSize); | |
65 fontDescription.setIsAbsoluteSize(true); | |
66 fontDescription.setGenericFamily(FontDescription::NoFamily); | |
67 fontDescription.setWeight(FontWeightNormal); | |
68 fontDescription.setStyle(false); | |
69 } | 65 } |
70 | 66 |
71 } // namespace WebCore | 67 } // namespace WebCore |
OLD | NEW |