Diff
Modified: trunk/Source/WebCore/ChangeLog (134544 => 134545)
--- trunk/Source/WebCore/ChangeLog 2012-11-14 06:15:12 UTC (rev 134544)
+++ trunk/Source/WebCore/ChangeLog 2012-11-14 06:18:03 UTC (rev 134545)
@@ -1,3 +1,33 @@
+2012-11-13 Sheriff Bot <webkit.review....@gmail.com>
+
+ Unreviewed, rolling out r134524.
+ http://trac.webkit.org/changeset/134524
+ https://bugs.webkit.org/show_bug.cgi?id=102177
+
+ "Chromiium build broken" (Requested by haraken on #webkit).
+
+ * WebCore.gyp/WebCore.gyp:
+ * WebCore.gypi:
+ * rendering/RenderThemeChromiumFontProvider.cpp: Removed.
+ * rendering/RenderThemeChromiumFontProvider.h: Removed.
+ * rendering/RenderThemeChromiumFontProviderLinux.cpp: Removed.
+ * rendering/RenderThemeChromiumFontProviderWin.cpp: Removed.
+ * rendering/RenderThemeChromiumSkia.cpp:
+ (WebCore::RenderThemeChromiumSkia::defaultGUIFont):
+ (WebCore::RenderThemeChromiumSkia::systemFont):
+ (WebCore::RenderThemeChromiumSkia::setDefaultFontSize):
+ * rendering/RenderThemeChromiumSkia.h:
+ (RenderThemeChromiumSkia):
+ * rendering/RenderThemeChromiumWin.cpp:
+ (WebCore):
+ (WebCore::getNonClientMetrics):
+ (WebCore::systemFontSize):
+ (WebCore::pointsToPixels):
+ (WebCore::RenderThemeChromiumWin::systemFont):
+ (WebCore::RenderThemeChromiumWin::setDefaultFontSize):
+ * rendering/RenderThemeChromiumWin.h:
+ (RenderThemeChromiumWin):
+
2012-11-13 KyungTae Kim <ktf....@samsung.com>
Fix compile warning [-Wsign-compare]
Modified: trunk/Source/WebCore/WebCore.gyp/WebCore.gyp (134544 => 134545)
--- trunk/Source/WebCore/WebCore.gyp/WebCore.gyp 2012-11-14 06:15:12 UTC (rev 134544)
+++ trunk/Source/WebCore/WebCore.gyp/WebCore.gyp 2012-11-14 06:18:03 UTC (rev 134545)
@@ -1965,8 +1965,7 @@
# FIXME: Figure out how to store these patterns in a variable.
['exclude', '(cairo|ca|cf|cg|curl|efl|freetype|gstreamer|gtk|linux|mac|opengl|openvg|opentype|pango|posix|qt|soup|svg|symbian|texmap|iphone|win|wince|wx)/'],
['exclude', '(?<!Chromium)(Cairo|CF|CG|Curl|Gtk|JSC|Linux|Mac|OpenType|POSIX|Posix|Qt|Safari|Soup|Symbian|Win|WinCE|Wx)\\.(cpp|mm?)$'],
- # Previous rule excludes things like ChromiumFooWin, include those.
- ['include', 'rendering/.*Chromium.*\\.(cpp|mm?)$'],
+
['exclude', 'AllInOne\\.cpp$'],
],
'conditions': [
@@ -1984,9 +1983,6 @@
# RenderThemeChromiumSkia is not used on mac since RenderThemeChromiumMac
# does not reference the Skia code that is used by Windows, Linux and Android.
['exclude', 'rendering/RenderThemeChromiumSkia\\.cpp$'],
- # RenderThemeChromiumFontProvider is used by RenderThemeChromiumSkia.
- ['exclude', 'rendering/RenderThemeChromiumFontProvider\\.cpp'],
- ['exclude', 'rendering/RenderThemeChromiumFontProvider\\.h'],
],
},{ # OS!="mac"
'sources/': [['exclude', 'Mac\\.(cpp|mm?)$']]
@@ -2012,7 +2008,6 @@
}],
['OS=="android"', {
'sources/': [
- ['include', 'rendering/RenderThemeChromiumFontProviderLinux\\.cpp$'],
['include', 'rendering/RenderThemeChromiumLinux\\.cpp$'],
],
},{ # OS!="android"
Modified: trunk/Source/WebCore/WebCore.gypi (134544 => 134545)
--- trunk/Source/WebCore/WebCore.gypi 2012-11-14 06:15:12 UTC (rev 134544)
+++ trunk/Source/WebCore/WebCore.gypi 2012-11-14 06:18:03 UTC (rev 134545)
@@ -3455,10 +3455,6 @@
'rendering/RenderThemeChromiumAndroid.h',
'rendering/RenderThemeChromiumCommon.cpp',
'rendering/RenderThemeChromiumCommon.h',
- 'rendering/RenderThemeChromiumFontProvider.cpp',
- 'rendering/RenderThemeChromiumFontProvider.h',
- 'rendering/RenderThemeChromiumFontProviderLinux.cpp',
- 'rendering/RenderThemeChromiumFontProviderWin.cpp',
'rendering/RenderThemeChromiumLinux.cpp',
'rendering/RenderThemeChromiumLinux.h',
'rendering/RenderThemeChromiumMac.h',
Deleted: trunk/Source/WebCore/rendering/RenderThemeChromiumFontProvider.cpp (134544 => 134545)
--- trunk/Source/WebCore/rendering/RenderThemeChromiumFontProvider.cpp 2012-11-14 06:15:12 UTC (rev 134544)
+++ trunk/Source/WebCore/rendering/RenderThemeChromiumFontProvider.cpp 2012-11-14 06:18:03 UTC (rev 134545)
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "RenderThemeChromiumFontProvider.h"
-
-#include <wtf/StdLibExtras.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-// The default variable-width font size. We use this as the default font
-// size for the "system font", and as a base size (which we then shrink) for
-// form control fonts.
-// static
-float RenderThemeChromiumFontProvider::s_defaultFontSize = 16.0;
-
-// We aim to match IE here.
-// -IE uses a font based on the encoding as the default font for form controls.
-// -Gecko uses MS Shell Dlg (actually calls GetStockObject(DEFAULT_GUI_FONT),
-// which returns MS Shell Dlg)
-// -Safari uses Lucida Grande.
-//
-// FIXME: The only case where we know we don't match IE is for ANSI encodings.
-// IE uses MS Shell Dlg there, which we render incorrectly at certain pixel
-// sizes (e.g. 15px). So, for now we just use Arial.
-const String& RenderThemeChromiumFontProvider::defaultGUIFont()
-{
- DEFINE_STATIC_LOCAL(String, fontFace, (ASCIILiteral("Arial")));
- return fontFace;
-}
-
-} // namespace WebCore
Deleted: trunk/Source/WebCore/rendering/RenderThemeChromiumFontProvider.h (134544 => 134545)
--- trunk/Source/WebCore/rendering/RenderThemeChromiumFontProvider.h 2012-11-14 06:15:12 UTC (rev 134544)
+++ trunk/Source/WebCore/rendering/RenderThemeChromiumFontProvider.h 2012-11-14 06:18:03 UTC (rev 134545)
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RenderThemeChromiumFontProvider_h
-#define RenderThemeChromiumFontProvider_h
-
-namespace WTF {
-class String;
-}
-
-namespace WebCore {
-
-class FontDescription;
-
-class RenderThemeChromiumFontProvider {
-public:
- static void systemFont(int propId, FontDescription&);
- static void setDefaultFontSize(int);
-
-protected:
- static const WTF::String& defaultGUIFont();
-
- static float s_defaultFontSize;
-};
-
-} // namespace WebCore
-
-#endif // RenderThemeChromiumFontProvider_h
Deleted: trunk/Source/WebCore/rendering/RenderThemeChromiumFontProviderLinux.cpp (134544 => 134545)
--- trunk/Source/WebCore/rendering/RenderThemeChromiumFontProviderLinux.cpp 2012-11-14 06:15:12 UTC (rev 134544)
+++ trunk/Source/WebCore/rendering/RenderThemeChromiumFontProviderLinux.cpp 2012-11-14 06:18:03 UTC (rev 134545)
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "RenderThemeChromiumFontProvider.h"
-
-#include "CSSValueKeywords.h"
-#include "FontDescription.h"
-
-#include <wtf/StdLibExtras.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-static FontDescription smallSystemFont;
-static FontDescription menuFont;
-static FontDescription labelFont;
-
-// static
-void RenderThemeChromiumFontProvider::setDefaultFontSize(int fontSize)
-{
- s_defaultFontSize = static_cast<float>(fontSize);
-
- // Reset cached fonts.
- smallSystemFont = menuFont = labelFont = FontDescription();
-}
-
-// static
-void RenderThemeChromiumFontProvider::systemFont(int propId, FontDescription& fontDescription)
-{
- float fontSize = s_defaultFontSize;
-
- switch (propId) {
- case CSSValueWebkitMiniControl:
- case CSSValueWebkitSmallControl:
- case CSSValueWebkitControl:
- // Why 2 points smaller? Because that's what Gecko does. Note that we
- // are assuming a 96dpi screen, which is the default that we use on
- // Windows.
- static const float pointsPerInch = 72.0f;
- static const float pixelsPerInch = 96.0f;
- fontSize -= (2.0f / pointsPerInch) * pixelsPerInch;
- break;
- }
-
- fontDescription.firstFamily().setFamily(defaultGUIFont());
- fontDescription.setSpecifiedSize(fontSize);
- fontDescription.setIsAbsoluteSize(true);
- fontDescription.setGenericFamily(FontDescription::NoFamily);
- fontDescription.setWeight(FontWeightNormal);
- fontDescription.setItalic(false);
-}
-
-} // namespace WebCore
Deleted: trunk/Source/WebCore/rendering/RenderThemeChromiumFontProviderWin.cpp (134544 => 134545)
--- trunk/Source/WebCore/rendering/RenderThemeChromiumFontProviderWin.cpp 2012-11-14 06:15:12 UTC (rev 134544)
+++ trunk/Source/WebCore/rendering/RenderThemeChromiumFontProviderWin.cpp 2012-11-14 06:18:03 UTC (rev 134545)
@@ -1,178 +0,0 @@
-/*
- * Copyright (C) 2012 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "RenderThemeChromiumFontProvider.h"
-
-#include "CSSValueKeywords.h"
-#include "FontDescription.h"
-#include "HWndDC.h"
-#include "SystemInfo.h"
-
-#include <windows.h>
-#include <wtf/text/WTFString.h>
-
-#define SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(structName, member) \
- offsetof(structName, member) + \
- (sizeof static_cast<structName*>(0)->member)
-#define NONCLIENTMETRICS_SIZE_PRE_VISTA \
- SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(NONCLIENTMETRICS, lfMessageFont)
-
-namespace WebCore {
-
-static FontDescription smallSystemFont;
-static FontDescription menuFont;
-static FontDescription labelFont;
-
-// Converts |points| to pixels. One point is 1/72 of an inch.
-static float pointsToPixels(float points)
-{
- static float pixelsPerInch = 0.0f;
- if (!pixelsPerInch) {
- HWndDC hdc(0); // What about printing? Is this the right DC?
- if (hdc) // Can this ever actually be 0?
- pixelsPerInch = GetDeviceCaps(hdc, LOGPIXELSY);
- else
- pixelsPerInch = 96.0f;
- }
-
- static const float pointsPerInch = 72.0f;
- return points / pointsPerInch * pixelsPerInch;
-}
-
-static void getNonClientMetrics(NONCLIENTMETRICS* metrics)
-{
- static UINT size = (windowsVersion() >= WindowsVista) ?
- sizeof(NONCLIENTMETRICS) : NONCLIENTMETRICS_SIZE_PRE_VISTA;
- metrics->cbSize = size;
- bool success = !!SystemParametersInfo(SPI_GETNONCLIENTMETRICS, size, metrics, 0);
- ASSERT(success);
-}
-
-// Return the height of system font |font| in pixels. We use this size by
-// default for some non-form-control elements.
-static float systemFontSize(const LOGFONT& font)
-{
- float size = -font.lfHeight;
- if (size < 0) {
- HFONT hFont = CreateFontIndirect(&font);
- if (hFont) {
- HWndDC hdc(0); // What about printing? Is this the right DC?
- if (hdc) {
- HGDIOBJ hObject = SelectObject(hdc, hFont);
- TEXTMETRIC tm;
- GetTextMetrics(hdc, &tm);
- SelectObject(hdc, hObject);
- size = tm.tmAscent;
- }
- DeleteObject(hFont);
- }
- }
-
- // The "codepage 936" bit here is from Gecko; apparently this helps make
- // fonts more legible in Simplified Chinese where the default font size is
- // too small.
- //
- // FIXME: http://b/1119883 Since this is only used for "small caption",
- // "menu", and "status bar" objects, I'm not sure how much this even
- // matters. Plus the Gecko patch went in back in 2002, and maybe this
- // isn't even relevant anymore. We should investigate whether this should
- // be removed, or perhaps broadened to be "any CJK locale".
- //
- return ((size < 12.0f) && (GetACP() == 936)) ? 12.0f : size;
-}
-
-// static
-void RenderThemeChromiumFontProvider::systemFont(int propId, FontDescription& fontDescription)
-{
- // This logic owes much to RenderThemeSafari.cpp.
- FontDescription* cachedDesc = 0;
- AtomicString faceName;
- float fontSize = 0;
- switch (propId) {
- case CSSValueSmallCaption:
- cachedDesc = &smallSystemFont;
- if (!smallSystemFont.isAbsoluteSize()) {
- NONCLIENTMETRICS metrics;
- getNonClientMetrics(&metrics);
- faceName = AtomicString(metrics.lfSmCaptionFont.lfFaceName, wcslen(metrics.lfSmCaptionFont.lfFaceName));
- fontSize = systemFontSize(metrics.lfSmCaptionFont);
- }
- break;
- case CSSValueMenu:
- cachedDesc = &menuFont;
- if (!menuFont.isAbsoluteSize()) {
- NONCLIENTMETRICS metrics;
- getNonClientMetrics(&metrics);
- faceName = AtomicString(metrics.lfMenuFont.lfFaceName, wcslen(metrics.lfMenuFont.lfFaceName));
- fontSize = systemFontSize(metrics.lfMenuFont);
- }
- break;
- case CSSValueStatusBar:
- cachedDesc = &labelFont;
- if (!labelFont.isAbsoluteSize()) {
- NONCLIENTMETRICS metrics;
- getNonClientMetrics(&metrics);
- faceName = metrics.lfStatusFont.lfFaceName;
- fontSize = systemFontSize(metrics.lfStatusFont);
- }
- break;
- case CSSValueWebkitMiniControl:
- case CSSValueWebkitSmallControl:
- case CSSValueWebkitControl:
- faceName = defaultGUIFont();
- // Why 2 points smaller? Because that's what Gecko does.
- fontSize = s_defaultFontSize - pointsToPixels(2);
- break;
- default:
- faceName = defaultGUIFont();
- fontSize = s_defaultFontSize;
- break;
- }
-
- if (!cachedDesc)
- cachedDesc = &fontDescription;
-
- if (fontSize) {
- cachedDesc->firstFamily().setFamily(faceName);
- cachedDesc->setIsAbsoluteSize(true);
- cachedDesc->setGenericFamily(FontDescription::NoFamily);
- cachedDesc->setSpecifiedSize(fontSize);
- cachedDesc->setWeight(FontWeightNormal);
- cachedDesc->setItalic(false);
- }
- fontDescription = *cachedDesc;
-}
-
-// static
-void RenderThemeChromiumFontProvider::setDefaultFontSize(int fontSize)
-{
- s_defaultFontSize = static_cast<float>(fontSize);
-
- // Reset cached fonts.
- smallSystemFont = menuFont = labelFont = FontDescription();
-}
-
-} // namespace WebCore
Modified: trunk/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp (134544 => 134545)
--- trunk/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp 2012-11-14 06:15:12 UTC (rev 134544)
+++ trunk/Source/WebCore/rendering/RenderThemeChromiumSkia.cpp 2012-11-14 06:18:03 UTC (rev 134545)
@@ -39,7 +39,6 @@
#include "RenderObject.h"
#include "RenderProgress.h"
#include "RenderSlider.h"
-#include "RenderThemeChromiumFontProvider.h"
#include "ScrollbarTheme.h"
#include "TimeRanges.h"
#include "TransformationMatrix.h"
@@ -71,6 +70,23 @@
static const float maxSearchFieldResultsDecorationSize = 30;
static const float defaultSearchFieldResultsButtonWidth = 18;
+// We aim to match IE here.
+// -IE uses a font based on the encoding as the default font for form controls.
+// -Gecko uses MS Shell Dlg (actually calls GetStockObject(DEFAULT_GUI_FONT),
+// which returns MS Shell Dlg)
+// -Safari uses Lucida Grande.
+//
+// FIXME: The only case where we know we don't match IE is for ANSI encodings.
+// IE uses MS Shell Dlg there, which we render incorrectly at certain pixel
+// sizes (e.g. 15px). So, for now we just use Arial.
+const String& RenderThemeChromiumSkia::defaultGUIFont()
+{
+ DEFINE_STATIC_LOCAL(String, fontFace, (ASCIILiteral("Arial")));
+ return fontFace;
+}
+
+float RenderThemeChromiumSkia::defaultFontSize = 16.0;
+
RenderThemeChromiumSkia::RenderThemeChromiumSkia()
{
}
@@ -167,7 +183,27 @@
void RenderThemeChromiumSkia::systemFont(int propId, FontDescription& fontDescription) const
{
- RenderThemeChromiumFontProvider::systemFont(propId, fontDescription);
+ float fontSize = defaultFontSize;
+
+ switch (propId) {
+ case CSSValueWebkitMiniControl:
+ case CSSValueWebkitSmallControl:
+ case CSSValueWebkitControl:
+ // Why 2 points smaller? Because that's what Gecko does. Note that we
+ // are assuming a 96dpi screen, which is the default that we use on
+ // Windows.
+ static const float pointsPerInch = 72.0f;
+ static const float pixelsPerInch = 96.0f;
+ fontSize -= (2.0f / pointsPerInch) * pixelsPerInch;
+ break;
+ }
+
+ fontDescription.firstFamily().setFamily(defaultGUIFont());
+ fontDescription.setSpecifiedSize(fontSize);
+ fontDescription.setIsAbsoluteSize(true);
+ fontDescription.setGenericFamily(FontDescription::NoFamily);
+ fontDescription.setWeight(FontWeightNormal);
+ fontDescription.setItalic(false);
}
int RenderThemeChromiumSkia::minimumMenuListSize(RenderStyle* style) const
@@ -537,7 +573,7 @@
// static
void RenderThemeChromiumSkia::setDefaultFontSize(int fontSize)
{
- RenderThemeChromiumFontProvider::setDefaultFontSize(fontSize);
+ defaultFontSize = static_cast<float>(fontSize);
}
double RenderThemeChromiumSkia::caretBlinkIntervalInternal() const
Modified: trunk/Source/WebCore/rendering/RenderThemeChromiumSkia.h (134544 => 134545)
--- trunk/Source/WebCore/rendering/RenderThemeChromiumSkia.h 2012-11-14 06:15:12 UTC (rev 134544)
+++ trunk/Source/WebCore/rendering/RenderThemeChromiumSkia.h 2012-11-14 06:18:03 UTC (rev 134545)
@@ -145,6 +145,13 @@
static void setDefaultFontSize(int);
protected:
+ static const String& defaultGUIFont();
+
+ // The default variable-width font size. We use this as the default font
+ // size for the "system font", and as a base size (which we then shrink) for
+ // form control fonts.
+ static float defaultFontSize;
+
virtual double caretBlinkIntervalInternal() const;
virtual int menuListArrowPadding() const;
Modified: trunk/Source/WebCore/rendering/RenderThemeChromiumWin.cpp (134544 => 134545)
--- trunk/Source/WebCore/rendering/RenderThemeChromiumWin.cpp 2012-11-14 06:15:12 UTC (rev 134544)
+++ trunk/Source/WebCore/rendering/RenderThemeChromiumWin.cpp 2012-11-14 06:18:03 UTC (rev 134545)
@@ -35,6 +35,7 @@
#include "GraphicsContext.h"
#include "HTMLMediaElement.h"
#include "HTMLNames.h"
+#include "HWndDC.h"
#include "LayoutTestSupport.h"
#include "MediaControlElements.h"
#include "PaintInfo.h"
@@ -42,7 +43,6 @@
#include "RenderBox.h"
#include "RenderProgress.h"
#include "RenderSlider.h"
-#include "RenderThemeChromiumCommon.h"
#include "ScrollbarTheme.h"
#include "SystemInfo.h"
#include "TransparencyWin.h"
@@ -52,6 +52,12 @@
// FIXME: This dependency should eventually be removed.
#include <skia/ext/skia_utils_win.h>
+#define SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(structName, member) \
+ offsetof(structName, member) + \
+ (sizeof static_cast<structName*>(0)->member)
+#define NONCLIENTMETRICS_SIZE_PRE_VISTA \
+ SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(NONCLIENTMETRICS, lfMessageFont)
+
namespace WebCore {
// The standard width for the menu list drop-down button when run under
@@ -129,6 +135,19 @@
} // namespace
+static void getNonClientMetrics(NONCLIENTMETRICS* metrics)
+{
+ static UINT size = (windowsVersion() >= WindowsVista) ?
+ sizeof(NONCLIENTMETRICS) : NONCLIENTMETRICS_SIZE_PRE_VISTA;
+ metrics->cbSize = size;
+ bool success = !!SystemParametersInfo(SPI_GETNONCLIENTMETRICS, size, metrics, 0);
+ ASSERT(success);
+}
+
+static FontDescription smallSystemFont;
+static FontDescription menuFont;
+static FontDescription labelFont;
+
// Internal static helper functions. We don't put them in an anonymous
// namespace so they have easier access to the WebCore namespace.
@@ -147,6 +166,55 @@
return false;
}
+// Return the height of system font |font| in pixels. We use this size by
+// default for some non-form-control elements.
+static float systemFontSize(const LOGFONT& font)
+{
+ float size = -font.lfHeight;
+ if (size < 0) {
+ HFONT hFont = CreateFontIndirect(&font);
+ if (hFont) {
+ HWndDC hdc(0); // What about printing? Is this the right DC?
+ if (hdc) {
+ HGDIOBJ hObject = SelectObject(hdc, hFont);
+ TEXTMETRIC tm;
+ GetTextMetrics(hdc, &tm);
+ SelectObject(hdc, hObject);
+ size = tm.tmAscent;
+ }
+ DeleteObject(hFont);
+ }
+ }
+
+ // The "codepage 936" bit here is from Gecko; apparently this helps make
+ // fonts more legible in Simplified Chinese where the default font size is
+ // too small.
+ //
+ // FIXME: http://b/1119883 Since this is only used for "small caption",
+ // "menu", and "status bar" objects, I'm not sure how much this even
+ // matters. Plus the Gecko patch went in back in 2002, and maybe this
+ // isn't even relevant anymore. We should investigate whether this should
+ // be removed, or perhaps broadened to be "any CJK locale".
+ //
+ return ((size < 12.0f) && (GetACP() == 936)) ? 12.0f : size;
+}
+
+// Converts |points| to pixels. One point is 1/72 of an inch.
+static float pointsToPixels(float points)
+{
+ static float pixelsPerInch = 0.0f;
+ if (!pixelsPerInch) {
+ HWndDC hdc(0); // What about printing? Is this the right DC?
+ if (hdc) // Can this ever actually be NULL?
+ pixelsPerInch = GetDeviceCaps(hdc, LOGPIXELSY);
+ else
+ pixelsPerInch = 96.0f;
+ }
+
+ static const float pointsPerInch = 72.0f;
+ return points / pointsPerInch * pixelsPerInch;
+}
+
static double querySystemBlinkInterval(double defaultInterval)
{
UINT blinkTime = GetCaretBlinkTime();
@@ -217,6 +285,67 @@
return Color(0xff, 0xff, 0x96); // Yellow.
}
+void RenderThemeChromiumWin::systemFont(int propId, FontDescription& fontDescription) const
+{
+ // This logic owes much to RenderThemeSafari.cpp.
+ FontDescription* cachedDesc = 0;
+ AtomicString faceName;
+ float fontSize = 0;
+ switch (propId) {
+ case CSSValueSmallCaption:
+ cachedDesc = &smallSystemFont;
+ if (!smallSystemFont.isAbsoluteSize()) {
+ NONCLIENTMETRICS metrics;
+ getNonClientMetrics(&metrics);
+ faceName = AtomicString(metrics.lfSmCaptionFont.lfFaceName, wcslen(metrics.lfSmCaptionFont.lfFaceName));
+ fontSize = systemFontSize(metrics.lfSmCaptionFont);
+ }
+ break;
+ case CSSValueMenu:
+ cachedDesc = &menuFont;
+ if (!menuFont.isAbsoluteSize()) {
+ NONCLIENTMETRICS metrics;
+ getNonClientMetrics(&metrics);
+ faceName = AtomicString(metrics.lfMenuFont.lfFaceName, wcslen(metrics.lfMenuFont.lfFaceName));
+ fontSize = systemFontSize(metrics.lfMenuFont);
+ }
+ break;
+ case CSSValueStatusBar:
+ cachedDesc = &labelFont;
+ if (!labelFont.isAbsoluteSize()) {
+ NONCLIENTMETRICS metrics;
+ getNonClientMetrics(&metrics);
+ faceName = metrics.lfStatusFont.lfFaceName;
+ fontSize = systemFontSize(metrics.lfStatusFont);
+ }
+ break;
+ case CSSValueWebkitMiniControl:
+ case CSSValueWebkitSmallControl:
+ case CSSValueWebkitControl:
+ faceName = defaultGUIFont();
+ // Why 2 points smaller? Because that's what Gecko does.
+ fontSize = defaultFontSize - pointsToPixels(2);
+ break;
+ default:
+ faceName = defaultGUIFont();
+ fontSize = defaultFontSize;
+ break;
+ }
+
+ if (!cachedDesc)
+ cachedDesc = &fontDescription;
+
+ if (fontSize) {
+ cachedDesc->firstFamily().setFamily(faceName);
+ cachedDesc->setIsAbsoluteSize(true);
+ cachedDesc->setGenericFamily(FontDescription::NoFamily);
+ cachedDesc->setSpecifiedSize(fontSize);
+ cachedDesc->setWeight(FontWeightNormal);
+ cachedDesc->setItalic(false);
+ }
+ fontDescription = *cachedDesc;
+}
+
// Map a CSSValue* system color to an index understood by GetSysColor().
static int cssValueIdToSysColorIndex(int cssValueId)
{
@@ -407,6 +536,15 @@
return false;
}
+// static
+void RenderThemeChromiumWin::setDefaultFontSize(int fontSize)
+{
+ RenderThemeChromiumSkia::setDefaultFontSize(fontSize);
+
+ // Reset cached fonts.
+ smallSystemFont = menuFont = labelFont = FontDescription();
+}
+
double RenderThemeChromiumWin::caretBlinkIntervalInternal() const
{
// This involves a system call, so we cache the result.
Modified: trunk/Source/WebCore/rendering/RenderThemeChromiumWin.h (134544 => 134545)
--- trunk/Source/WebCore/rendering/RenderThemeChromiumWin.h 2012-11-14 06:15:12 UTC (rev 134544)
+++ trunk/Source/WebCore/rendering/RenderThemeChromiumWin.h 2012-11-14 06:18:03 UTC (rev 134545)
@@ -57,6 +57,8 @@
virtual Color platformActiveTextSearchHighlightColor() const;
virtual Color platformInactiveTextSearchHighlightColor() const;
+ // System fonts.
+ virtual void systemFont(int propId, FontDescription&) const;
virtual Color systemColor(int cssValueId) const;
#if ENABLE(DATALIST_ELEMENT)
@@ -84,6 +86,10 @@
// entire menulist.
virtual bool paintMenuList(RenderObject*, const PaintInfo&, const IntRect&);
+ // Override RenderThemeChromiumSkia's setDefaultFontSize method to also reset the local font property caches.
+ // See comment in RenderThemeChromiumSkia::setDefaultFontSize() regarding ugliness of this hack.
+ static void setDefaultFontSize(int);
+
virtual void adjustInnerSpinButtonStyle(StyleResolver*, RenderStyle*, Element*) const;
virtual bool paintInnerSpinButton(RenderObject*, const PaintInfo&, const IntRect&);