| OLD | NEW |
| 1 /* | 1 /* |
| 2 * This file is part of the WebKit project. | 2 * This file is part of the WebKit project. |
| 3 * | 3 * |
| 4 * Copyright (C) 2006 Apple Computer, Inc. | 4 * Copyright (C) 2006 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 13 matching lines...) Expand all Loading... |
| 24 #include "RenderThemeWin.h" | 24 #include "RenderThemeWin.h" |
| 25 | 25 |
| 26 #include <windows.h> | 26 #include <windows.h> |
| 27 #include <uxtheme.h> | 27 #include <uxtheme.h> |
| 28 #include <vssym32.h> | 28 #include <vssym32.h> |
| 29 | 29 |
| 30 #include "ChromiumBridge.h" | 30 #include "ChromiumBridge.h" |
| 31 #include "CSSValueKeywords.h" | 31 #include "CSSValueKeywords.h" |
| 32 #include "Document.h" | 32 #include "Document.h" |
| 33 #include "FontSelector.h" | 33 #include "FontSelector.h" |
| 34 #include "FontUtilsWin.h" |
| 34 #include "GraphicsContext.h" | 35 #include "GraphicsContext.h" |
| 35 #include "ScrollbarTheme.h" | 36 #include "ScrollbarTheme.h" |
| 36 #include "SkiaUtils.h" | 37 #include "SkiaUtils.h" |
| 37 #include "ThemeHelperWin.h" | 38 #include "ThemeHelperWin.h" |
| 38 | 39 |
| 39 #include "base/gfx/native_theme.h" | 40 #include "base/gfx/native_theme.h" |
| 40 #include "base/gfx/font_utils.h" | |
| 41 #include "base/gfx/skia_utils.h" | 41 #include "base/gfx/skia_utils.h" |
| 42 #include "base/win_util.h" | 42 #include "base/win_util.h" |
| 43 | 43 |
| 44 // These enums correspond to similarly named values defined by SafariTheme.h | 44 // These enums correspond to similarly named values defined by SafariTheme.h |
| 45 enum ControlSize { | 45 enum ControlSize { |
| 46 RegularControlSize, | 46 RegularControlSize, |
| 47 SmallControlSize, | 47 SmallControlSize, |
| 48 MiniControlSize | 48 MiniControlSize |
| 49 }; | 49 }; |
| 50 | 50 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // -Gecko uses MS Shell Dlg (actually calls GetStockObject(DEFAULT_GUI_FONT), | 236 // -Gecko uses MS Shell Dlg (actually calls GetStockObject(DEFAULT_GUI_FONT), |
| 237 // which returns MS Shell Dlg) | 237 // which returns MS Shell Dlg) |
| 238 // -Safari uses Lucida Grande. | 238 // -Safari uses Lucida Grande. |
| 239 // | 239 // |
| 240 // TODO(ojan): Fix this! | 240 // TODO(ojan): Fix this! |
| 241 // The only case where we know we don't match IE is for ANSI encodings. IE uses | 241 // The only case where we know we don't match IE is for ANSI encodings. IE uses |
| 242 // MS Shell Dlg there, which we render incorrectly at certain pixel sizes | 242 // MS Shell Dlg there, which we render incorrectly at certain pixel sizes |
| 243 // (e.g. 15px). So, for now we just use Arial. | 243 // (e.g. 15px). So, for now we just use Arial. |
| 244 static wchar_t* defaultGUIFont(Document* document) | 244 static wchar_t* defaultGUIFont(Document* document) |
| 245 { | 245 { |
| 246 UScriptCode dominantScript = document->dominantScript(); | 246 UScriptCode dominantScript = document->dominantScript(); |
| 247 const wchar_t* family = NULL; | 247 const wchar_t* family = NULL; |
| 248 | 248 |
| 249 // TODO(jungshik) : Special-casing of Latin/Greeek/Cyrillic should go away | 249 // TODO(jungshik) : Special-casing of Latin/Greeek/Cyrillic should go away |
| 250 // once GetFontFamilyForScript is enhanced to support GenericFamilyType for re
al. | 250 // once GetFontFamilyForScript is enhanced to support GenericFamilyType for |
| 251 // For now, we make sure that we use Arial to match IE for those scripts. | 251 // real. For now, we make sure that we use Arial to match IE for those |
| 252 if (dominantScript != USCRIPT_LATIN && dominantScript != USCRIPT_CYRILLIC && | 252 // scripts. |
| 253 dominantScript != USCRIPT_GREEK && dominantScript != USCRIPT_INVALID_CODE)
{ | 253 if (dominantScript != USCRIPT_LATIN && |
| 254 family = gfx::GetFontFamilyForScript(dominantScript, | 254 dominantScript != USCRIPT_CYRILLIC && |
| 255 gfx::GENERIC_FAMILY_NONE); | 255 dominantScript != USCRIPT_GREEK && |
| 256 if (family) | 256 dominantScript != USCRIPT_INVALID_CODE) { |
| 257 return const_cast<wchar_t*>(family); | 257 family = GetFontFamilyForScript(dominantScript, GENERIC_FAMILY_NONE); |
| 258 } | 258 if (family) |
| 259 return L"Arial"; | 259 return const_cast<wchar_t*>(family); |
| 260 } |
| 261 return L"Arial"; |
| 260 } | 262 } |
| 261 | 263 |
| 262 // Converts |points| to pixels. One point is 1/72 of an inch. | 264 // Converts |points| to pixels. One point is 1/72 of an inch. |
| 263 static float pointsToPixels(float points) | 265 static float pointsToPixels(float points) |
| 264 { | 266 { |
| 265 static float pixelsPerInch = 0.0f; | 267 static float pixelsPerInch = 0.0f; |
| 266 if (!pixelsPerInch) { | 268 if (!pixelsPerInch) { |
| 267 HDC hdc = GetDC(0); // What about printing? Is this the right DC? | 269 HDC hdc = GetDC(0); // What about printing? Is this the right DC? |
| 268 if (hdc) { // Can this ever actually be NULL? | 270 if (hdc) { // Can this ever actually be NULL? |
| 269 pixelsPerInch = GetDeviceCaps(hdc, LOGPIXELSY); | 271 pixelsPerInch = GetDeviceCaps(hdc, LOGPIXELSY); |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 | 902 |
| 901 // static | 903 // static |
| 902 void RenderThemeWin::setDefaultFontSize(int fontSize) { | 904 void RenderThemeWin::setDefaultFontSize(int fontSize) { |
| 903 DefaultFontSize = static_cast<float>(fontSize); | 905 DefaultFontSize = static_cast<float>(fontSize); |
| 904 | 906 |
| 905 // Reset cached fonts. | 907 // Reset cached fonts. |
| 906 smallSystemFont = menuFont = labelFont = FontDescription(); | 908 smallSystemFont = menuFont = labelFont = FontDescription(); |
| 907 } | 909 } |
| 908 | 910 |
| 909 } | 911 } |
| OLD | NEW |