Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: third_party/WebKit/WebCore/rendering/RenderThemeChromiumWin.cpp

Issue 56198: Roll out dominantScript, getGenericFontForScript patches to unfork a bunch of... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/WebKit/WebCore/rendering/RenderThemeChromiumWin.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * Copyright (C) 2008, 2009 Google, Inc. 5 * Copyright (C) 2008, 2009 Google, Inc.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 13 matching lines...) Expand all
24 #include "config.h" 24 #include "config.h"
25 #include "RenderThemeChromiumWin.h" 25 #include "RenderThemeChromiumWin.h"
26 26
27 #include <windows.h> 27 #include <windows.h>
28 #include <uxtheme.h> 28 #include <uxtheme.h>
29 #include <vssym32.h> 29 #include <vssym32.h>
30 30
31 #include "ChromiumBridge.h" 31 #include "ChromiumBridge.h"
32 #include "CSSStyleSheet.h" 32 #include "CSSStyleSheet.h"
33 #include "CSSValueKeywords.h" 33 #include "CSSValueKeywords.h"
34 #include "Document.h"
35 #include "FontSelector.h" 34 #include "FontSelector.h"
36 #include "FontUtilsChromiumWin.h" 35 #include "FontUtilsChromiumWin.h"
37 #include "GraphicsContext.h" 36 #include "GraphicsContext.h"
38 #include "RenderBox.h" 37 #include "RenderBox.h"
39 #include "RenderSlider.h" 38 #include "RenderSlider.h"
40 #include "ScrollbarTheme.h" 39 #include "ScrollbarTheme.h"
41 #include "SkiaUtils.h" 40 #include "SkiaUtils.h"
42 #include "TransparencyWin.h" 41 #include "TransparencyWin.h"
43 #include "UserAgentStyleSheets.h" 42 #include "UserAgentStyleSheets.h"
44 #include "WindowsVersion.h" 43 #include "WindowsVersion.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 198
200 // We aim to match IE here. 199 // We aim to match IE here.
201 // -IE uses a font based on the encoding as the default font for form controls. 200 // -IE uses a font based on the encoding as the default font for form controls.
202 // -Gecko uses MS Shell Dlg (actually calls GetStockObject(DEFAULT_GUI_FONT), 201 // -Gecko uses MS Shell Dlg (actually calls GetStockObject(DEFAULT_GUI_FONT),
203 // which returns MS Shell Dlg) 202 // which returns MS Shell Dlg)
204 // -Safari uses Lucida Grande. 203 // -Safari uses Lucida Grande.
205 // 204 //
206 // FIXME: The only case where we know we don't match IE is for ANSI encodings. 205 // FIXME: The only case where we know we don't match IE is for ANSI encodings.
207 // IE uses MS Shell Dlg there, which we render incorrectly at certain pixel 206 // IE uses MS Shell Dlg there, which we render incorrectly at certain pixel
208 // sizes (e.g. 15px). So, for now we just use Arial. 207 // sizes (e.g. 15px). So, for now we just use Arial.
209 static wchar_t* defaultGUIFont(Document* document) 208 static wchar_t* defaultGUIFont()
210 { 209 {
211 UScriptCode dominantScript = document->dominantScript();
212 const wchar_t* family = NULL;
213
214 // FIXME: Special-casing of Latin/Greeek/Cyrillic should go away once
215 // GetFontFamilyForScript is enhanced to support GenericFamilyType for
216 // real. For now, we make sure that we use Arial to match IE for those
217 // scripts.
218 if (dominantScript != USCRIPT_LATIN &&
219 dominantScript != USCRIPT_CYRILLIC &&
220 dominantScript != USCRIPT_GREEK &&
221 dominantScript != USCRIPT_INVALID_CODE) {
222 family = getFontFamilyForScript(dominantScript, FontDescription::NoFamil y);
223 if (family)
224 return const_cast<wchar_t*>(family);
225 }
226 return L"Arial"; 210 return L"Arial";
227 } 211 }
228 212
229 // Converts |points| to pixels. One point is 1/72 of an inch. 213 // Converts |points| to pixels. One point is 1/72 of an inch.
230 static float pointsToPixels(float points) 214 static float pointsToPixels(float points)
231 { 215 {
232 static float pixelsPerInch = 0.0f; 216 static float pixelsPerInch = 0.0f;
233 if (!pixelsPerInch) { 217 if (!pixelsPerInch) {
234 HDC hdc = GetDC(0); // What about printing? Is this the right DC? 218 HDC hdc = GetDC(0); // What about printing? Is this the right DC?
235 if (hdc) { // Can this ever actually be NULL? 219 if (hdc) { // Can this ever actually be NULL?
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 // Disable the blinking caret in layout test mode, as it introduces 315 // Disable the blinking caret in layout test mode, as it introduces
332 // a race condition for the pixel tests. http://b/1198440 316 // a race condition for the pixel tests. http://b/1198440
333 if (ChromiumBridge::layoutTestMode()) 317 if (ChromiumBridge::layoutTestMode())
334 return 0; 318 return 0;
335 319
336 // This involves a system call, so we cache the result. 320 // This involves a system call, so we cache the result.
337 static double blinkInterval = querySystemBlinkInterval(RenderTheme::caretBli nkInterval()); 321 static double blinkInterval = querySystemBlinkInterval(RenderTheme::caretBli nkInterval());
338 return blinkInterval; 322 return blinkInterval;
339 } 323 }
340 324
341 void RenderThemeChromiumWin::systemFont(int propId, Document* document, FontDesc ription& fontDescription) const 325 void RenderThemeChromiumWin::systemFont(int propId, FontDescription& fontDescrip tion) const
342 { 326 {
343 // This logic owes much to RenderThemeSafari.cpp. 327 // This logic owes much to RenderThemeSafari.cpp.
344 FontDescription* cachedDesc = NULL; 328 FontDescription* cachedDesc = NULL;
345 wchar_t* faceName = 0; 329 wchar_t* faceName = 0;
346 float fontSize = 0; 330 float fontSize = 0;
347 switch (propId) { 331 switch (propId) {
348 case CSSValueSmallCaption: 332 case CSSValueSmallCaption:
349 cachedDesc = &smallSystemFont; 333 cachedDesc = &smallSystemFont;
350 if (!smallSystemFont.isAbsoluteSize()) { 334 if (!smallSystemFont.isAbsoluteSize()) {
351 NONCLIENTMETRICS metrics; 335 NONCLIENTMETRICS metrics;
(...skipping 16 matching lines...) Expand all
368 if (!labelFont.isAbsoluteSize()) { 352 if (!labelFont.isAbsoluteSize()) {
369 NONCLIENTMETRICS metrics; 353 NONCLIENTMETRICS metrics;
370 getNonClientMetrics(&metrics); 354 getNonClientMetrics(&metrics);
371 faceName = metrics.lfStatusFont.lfFaceName; 355 faceName = metrics.lfStatusFont.lfFaceName;
372 fontSize = systemFontSize(metrics.lfStatusFont); 356 fontSize = systemFontSize(metrics.lfStatusFont);
373 } 357 }
374 break; 358 break;
375 case CSSValueWebkitMiniControl: 359 case CSSValueWebkitMiniControl:
376 case CSSValueWebkitSmallControl: 360 case CSSValueWebkitSmallControl:
377 case CSSValueWebkitControl: 361 case CSSValueWebkitControl:
378 faceName = defaultGUIFont(document); 362 faceName = defaultGUIFont();
379 // Why 2 points smaller? Because that's what Gecko does. 363 // Why 2 points smaller? Because that's what Gecko does.
380 fontSize = defaultFontSize - pointsToPixels(2); 364 fontSize = defaultFontSize - pointsToPixels(2);
381 break; 365 break;
382 default: 366 default:
383 faceName = defaultGUIFont(document); 367 faceName = defaultGUIFont();
384 fontSize = defaultFontSize; 368 fontSize = defaultFontSize;
385 break; 369 break;
386 } 370 }
387 371
388 if (!cachedDesc) 372 if (!cachedDesc)
389 cachedDesc = &fontDescription; 373 cachedDesc = &fontDescription;
390 374
391 if (fontSize) { 375 if (fontSize) {
392 ASSERT(faceName); 376 ASSERT(faceName);
393 cachedDesc->firstFamily().setFamily(AtomicString(faceName, 377 cachedDesc->firstFamily().setFamily(AtomicString(faceName,
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 // static 829 // static
846 void RenderThemeChromiumWin::setFindInPageMode(bool enable) { 830 void RenderThemeChromiumWin::setFindInPageMode(bool enable) {
847 if (m_findInPageMode == enable) 831 if (m_findInPageMode == enable)
848 return; 832 return;
849 833
850 m_findInPageMode = enable; 834 m_findInPageMode = enable;
851 theme()->platformColorsDidChange(); 835 theme()->platformColorsDidChange();
852 } 836 }
853 837
854 } // namespace WebCore 838 } // namespace WebCore
OLDNEW
« no previous file with comments | « third_party/WebKit/WebCore/rendering/RenderThemeChromiumWin.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698