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(int propId, FontDescription& fo
ntDescription) | 44 void RenderThemeChromiumFontProvider::systemFont(CSSValueID valueID, FontDescrip
tion& fontDescription) |
45 { | 45 { |
46 float fontSize = s_defaultFontSize; | 46 float fontSize = s_defaultFontSize; |
47 | 47 |
48 switch (propId) { | 48 switch (valueID) { |
49 case CSSValueWebkitMiniControl: | 49 case CSSValueWebkitMiniControl: |
50 case CSSValueWebkitSmallControl: | 50 case CSSValueWebkitSmallControl: |
51 case CSSValueWebkitControl: | 51 case CSSValueWebkitControl: |
52 // Why 2 points smaller? Because that's what Gecko does. Note that we | 52 // 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 | 53 // are assuming a 96dpi screen, which is the default that we use on |
54 // Windows. | 54 // Windows. |
55 static const float pointsPerInch = 72.0f; | 55 static const float pointsPerInch = 72.0f; |
56 static const float pixelsPerInch = 96.0f; | 56 static const float pixelsPerInch = 96.0f; |
57 fontSize -= (2.0f / pointsPerInch) * pixelsPerInch; | 57 fontSize -= (2.0f / pointsPerInch) * pixelsPerInch; |
58 break; | 58 break; |
| 59 default: |
| 60 break; |
59 } | 61 } |
60 | 62 |
61 fontDescription.firstFamily().setFamily(defaultGUIFont()); | 63 fontDescription.firstFamily().setFamily(defaultGUIFont()); |
62 fontDescription.setSpecifiedSize(fontSize); | 64 fontDescription.setSpecifiedSize(fontSize); |
63 fontDescription.setIsAbsoluteSize(true); | 65 fontDescription.setIsAbsoluteSize(true); |
64 fontDescription.setGenericFamily(FontDescription::NoFamily); | 66 fontDescription.setGenericFamily(FontDescription::NoFamily); |
65 fontDescription.setWeight(FontWeightNormal); | 67 fontDescription.setWeight(FontWeightNormal); |
66 fontDescription.setItalic(false); | 68 fontDescription.setItalic(false); |
67 } | 69 } |
68 | 70 |
69 } // namespace WebCore | 71 } // namespace WebCore |
OLD | NEW |