<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[179050] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/179050">179050</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-01-23 17:41:30 -0800 (Fri, 23 Jan 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Implement system fonts FontDescription caching at RenderTheme level
https://bugs.webkit.org/show_bug.cgi?id=140840
Reviewed by Andreas Kling.
Implement system fonts FontDescription caching at RenderTheme level
instead of duplicating the logic in its subclasses for each platform.
This reduces code / logic duplication and reduces the amount of
platform-specific code. This will also make the refactoring at
Bug 140577 a lot easier.
The caching logic remains in RenderThemeIOS class for iOS because:
- It supports different system font values than all other platforms
- It requires cache invalidation in some cases while other platforms
do not.
This patch is inspired by the following Blink revision:
https://src.chromium.org/viewvc/blink?view=rev&revision=184449
Test: fast/css/css2-system-fonts.html</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformeflRenderThemeEflcpp">trunk/Source/WebCore/platform/efl/RenderThemeEfl.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformeflRenderThemeEflh">trunk/Source/WebCore/platform/efl/RenderThemeEfl.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemecpp">trunk/Source/WebCore/rendering/RenderTheme.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeh">trunk/Source/WebCore/rendering/RenderTheme.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeGtkcpp">trunk/Source/WebCore/rendering/RenderThemeGtk.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeGtkh">trunk/Source/WebCore/rendering/RenderThemeGtk.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeIOSh">trunk/Source/WebCore/rendering/RenderThemeIOS.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeIOSmm">trunk/Source/WebCore/rendering/RenderThemeIOS.mm</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeMach">trunk/Source/WebCore/rendering/RenderThemeMac.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeMacmm">trunk/Source/WebCore/rendering/RenderThemeMac.mm</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeSafaricpp">trunk/Source/WebCore/rendering/RenderThemeSafari.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeSafarih">trunk/Source/WebCore/rendering/RenderThemeSafari.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeWincpp">trunk/Source/WebCore/rendering/RenderThemeWin.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderThemeWinh">trunk/Source/WebCore/rendering/RenderThemeWin.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (179049 => 179050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-01-24 01:38:10 UTC (rev 179049)
+++ trunk/Source/WebCore/ChangeLog        2015-01-24 01:41:30 UTC (rev 179050)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2015-01-23 Chris Dumez <cdumez@apple.com>
+
+ Implement system fonts FontDescription caching at RenderTheme level
+ https://bugs.webkit.org/show_bug.cgi?id=140840
+
+ Reviewed by Andreas Kling.
+
+ Implement system fonts FontDescription caching at RenderTheme level
+ instead of duplicating the logic in its subclasses for each platform.
+ This reduces code / logic duplication and reduces the amount of
+ platform-specific code. This will also make the refactoring at
+ Bug 140577 a lot easier.
+
+ The caching logic remains in RenderThemeIOS class for iOS because:
+ - It supports different system font values than all other platforms
+ - It requires cache invalidation in some cases while other platforms
+ do not.
+
+ This patch is inspired by the following Blink revision:
+ https://src.chromium.org/viewvc/blink?view=rev&revision=184449
+
+ Test: fast/css/css2-system-fonts.html
+
</ins><span class="cx"> 2015-01-23 Zalan Bujtas <zalan@apple.com>
</span><span class="cx">
</span><span class="cx"> Simple line layout: Refactor line wrapping logic.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformeflRenderThemeEflcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/efl/RenderThemeEfl.cpp (179049 => 179050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/efl/RenderThemeEfl.cpp        2015-01-24 01:38:10 UTC (rev 179049)
+++ trunk/Source/WebCore/platform/efl/RenderThemeEfl.cpp        2015-01-24 01:41:30 UTC (rev 179050)
</span><span class="lines">@@ -984,7 +984,7 @@
</span><span class="cx"> defaultFontSize = size;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderThemeEfl::systemFont(CSSValueID, FontDescription& fontDescription) const
</del><ins>+void RenderThemeEfl::updateCachedSystemFontDescription(CSSValueID, FontDescription& fontDescription) const
</ins><span class="cx"> {
</span><span class="cx"> // It was called by RenderEmbeddedObject::paintReplaced to render alternative string.
</span><span class="cx"> // To avoid cairo_error while rendering, fontDescription should be passed.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformeflRenderThemeEflh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/efl/RenderThemeEfl.h (179049 => 179050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/efl/RenderThemeEfl.h        2015-01-24 01:38:10 UTC (rev 179049)
+++ trunk/Source/WebCore/platform/efl/RenderThemeEfl.h        2015-01-24 01:41:30 UTC (rev 179050)
</span><span class="lines">@@ -104,9 +104,6 @@
</span><span class="cx">
</span><span class="cx"> void adjustSizeConstraints(RenderStyle&, FormType) const;
</span><span class="cx">
</span><del>- // System fonts.
- virtual void systemFont(CSSValueID, FontDescription&) const override;
-
</del><span class="cx"> virtual void adjustCheckboxStyle(StyleResolver&, RenderStyle&, Element*) const override;
</span><span class="cx"> virtual bool paintCheckbox(const RenderObject&, const PaintInfo&, const IntRect&) override;
</span><span class="cx">
</span><span class="lines">@@ -189,6 +186,9 @@
</span><span class="cx"> return m_edje || (!m_themePath.isEmpty() && const_cast<RenderThemeEfl*>(this)->loadTheme());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ // System fonts.
+ virtual void updateCachedSystemFontDescription(CSSValueID, FontDescription&) const override;
+
</ins><span class="cx"> ALWAYS_INLINE Ecore_Evas* canvas() const { return m_canvas.get(); }
</span><span class="cx"> ALWAYS_INLINE Evas_Object* edje() const { return m_edje.get(); }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (179049 => 179050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTheme.cpp        2015-01-24 01:38:10 UTC (rev 179049)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp        2015-01-24 01:41:30 UTC (rev 179050)
</span><span class="lines">@@ -1,7 +1,8 @@
</span><del>-/**
</del><ins>+/*
</ins><span class="cx"> * This file is part of the theme implementation for form controls in WebCore.
</span><span class="cx"> *
</span><del>- * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc.
</del><ins>+ * Copyright (C) 2005-2010, 2012, 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2014 Google Inc. All rights reserved.
</ins><span class="cx"> *
</span><span class="cx"> * This library is free software; you can redistribute it and/or
</span><span class="cx"> * modify it under the terms of the GNU Library General Public
</span><span class="lines">@@ -45,6 +46,7 @@
</span><span class="cx"> #include "SpinButtonElement.h"
</span><span class="cx"> #include "StringTruncator.h"
</span><span class="cx"> #include "TextControlInnerElements.h"
</span><ins>+#include <wtf/NeverDestroyed.h>
</ins><span class="cx">
</span><span class="cx"> #if ENABLE(METER_ELEMENT)
</span><span class="cx"> #include "HTMLMeterElement.h"
</span><span class="lines">@@ -1130,6 +1132,55 @@
</span><span class="cx"> Page::updateStyleForAllPagesAfterGlobalChangeInEnvironment();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+FontDescription& RenderTheme::cachedSystemFontDescription(CSSValueID systemFontID) const
+{
+ static NeverDestroyed<FontDescription> caption;
+ static NeverDestroyed<FontDescription> icon;
+ static NeverDestroyed<FontDescription> menu;
+ static NeverDestroyed<FontDescription> messageBox;
+ static NeverDestroyed<FontDescription> smallCaption;
+ static NeverDestroyed<FontDescription> statusBar;
+ static NeverDestroyed<FontDescription> webkitMiniControl;
+ static NeverDestroyed<FontDescription> webkitSmallControl;
+ static NeverDestroyed<FontDescription> webkitControl;
+ static NeverDestroyed<FontDescription> defaultDescription;
+
+ switch (systemFontID) {
+ case CSSValueCaption:
+ return caption;
+ case CSSValueIcon:
+ return icon;
+ case CSSValueMenu:
+ return menu;
+ case CSSValueMessageBox:
+ return messageBox;
+ case CSSValueSmallCaption:
+ return smallCaption;
+ case CSSValueStatusBar:
+ return statusBar;
+ case CSSValueWebkitMiniControl:
+ return webkitMiniControl;
+ case CSSValueWebkitSmallControl:
+ return webkitSmallControl;
+ case CSSValueWebkitControl:
+ return webkitControl;
+ case CSSValueNone:
+ return defaultDescription;
+ default:
+ ASSERT_NOT_REACHED();
+ return defaultDescription;
+ }
+}
+
+void RenderTheme::systemFont(CSSValueID systemFontID, FontDescription& fontDescription) const
+{
+ fontDescription = cachedSystemFontDescription(systemFontID);
+ if (fontDescription.isAbsoluteSize())
+ return;
+
+ updateCachedSystemFontDescription(systemFontID, fontDescription);
+}
+
</ins><span class="cx"> Color RenderTheme::systemColor(CSSValueID cssValueId) const
</span><span class="cx"> {
</span><span class="cx"> switch (cssValueId) {
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderTheme.h (179049 => 179050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderTheme.h        2015-01-24 01:38:10 UTC (rev 179049)
+++ trunk/Source/WebCore/rendering/RenderTheme.h        2015-01-24 01:41:30 UTC (rev 179050)
</span><span class="lines">@@ -172,7 +172,7 @@
</span><span class="cx"> virtual double caretBlinkInterval() const { return 0.5; }
</span><span class="cx">
</span><span class="cx"> // System fonts and colors for CSS.
</span><del>- virtual void systemFont(CSSValueID, FontDescription&) const = 0;
</del><ins>+ void systemFont(CSSValueID, FontDescription&) const;
</ins><span class="cx"> virtual Color systemColor(CSSValueID) const;
</span><span class="cx">
</span><span class="cx"> virtual int minimumMenuListSize(RenderStyle&) const { return 0; }
</span><span class="lines">@@ -252,6 +252,9 @@
</span><span class="cx"> virtual bool defaultButtonHasAnimation() const { return false; }
</span><span class="cx">
</span><span class="cx"> protected:
</span><ins>+ virtual FontDescription& cachedSystemFontDescription(CSSValueID systemFontID) const;
+ virtual void updateCachedSystemFontDescription(CSSValueID systemFontID, FontDescription&) const = 0;
+
</ins><span class="cx"> // The platform selection color.
</span><span class="cx"> virtual Color platformActiveSelectionBackgroundColor() const;
</span><span class="cx"> virtual Color platformInactiveSelectionBackgroundColor() const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeGtk.cpp (179049 => 179050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeGtk.cpp        2015-01-24 01:38:10 UTC (rev 179049)
+++ trunk/Source/WebCore/rendering/RenderThemeGtk.cpp        2015-01-24 01:41:30 UTC (rev 179050)
</span><span class="lines">@@ -84,7 +84,7 @@
</span><span class="cx"> return dpi;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderThemeGtk::systemFont(CSSValueID, FontDescription& fontDescription) const
</del><ins>+void RenderThemeGtk::updateCachedSystemFontDescription(CSSValueID, FontDescription& fontDescription) const
</ins><span class="cx"> {
</span><span class="cx"> GtkSettings* settings = gtk_settings_get_default();
</span><span class="cx"> if (!settings)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeGtkh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeGtk.h (179049 => 179050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeGtk.h        2015-01-24 01:38:10 UTC (rev 179049)
+++ trunk/Source/WebCore/rendering/RenderThemeGtk.h        2015-01-24 01:41:30 UTC (rev 179050)
</span><span class="lines">@@ -36,9 +36,6 @@
</span><span class="cx"> public:
</span><span class="cx"> static PassRefPtr<RenderTheme> create();
</span><span class="cx">
</span><del>- // System fonts.
- virtual void systemFont(CSSValueID, FontDescription&) const override;
-
</del><span class="cx"> #if ENABLE(DATALIST_ELEMENT)
</span><span class="cx"> // Returns size of one slider tick mark for a horizontal track.
</span><span class="cx"> // For vertical tracks we rotate it and use it. i.e. Width is always length along the track.
</span><span class="lines">@@ -47,6 +44,11 @@
</span><span class="cx"> virtual int sliderTickOffsetFromTrackCenter() const override;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+private:
+ // System fonts.
+ virtual void updateCachedSystemFontDescription(CSSValueID, FontDescription&) const override;
+
+public:
</ins><span class="cx"> #ifndef GTK_API_VERSION_2
</span><span class="cx">
</span><span class="cx"> // A method asking if the theme's controls actually care about redrawing when hovered.
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.h (179049 => 179050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeIOS.h        2015-01-24 01:38:10 UTC (rev 179049)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.h        2015-01-24 01:41:30 UTC (rev 179050)
</span><span class="lines">@@ -43,13 +43,13 @@
</span><span class="cx">
</span><span class="cx"> static void adjustRoundBorderRadius(RenderStyle&, RenderBox&);
</span><span class="cx">
</span><del>- virtual void systemFont(CSSValueID, FontDescription&) const override;
-
</del><span class="cx"> static CFStringRef contentSizeCategory();
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT static void setContentSizeCategory(const String&);
</span><span class="cx">
</span><span class="cx"> protected:
</span><ins>+ virtual FontDescription& cachedSystemFontDescription(CSSValueID systemFontID) const override;
+ virtual void updateCachedSystemFontDescription(CSSValueID, FontDescription&) const override;
</ins><span class="cx"> virtual int baselinePosition(const RenderObject&) const override;
</span><span class="cx">
</span><span class="cx"> virtual bool isControlStyled(const RenderStyle&, const BorderData&, const FillLayer& background, const Color& backgroundColor) const override;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (179049 => 179050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm        2015-01-24 01:38:10 UTC (rev 179049)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm        2015-01-24 01:41:30 UTC (rev 179050)
</span><span class="lines">@@ -1103,7 +1103,7 @@
</span><span class="cx"> return FontWeightNormal;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderThemeIOS::systemFont(CSSValueID valueID, FontDescription& fontDescription) const
</del><ins>+FontDescription& RenderThemeIOS::cachedSystemFontDescription(CSSValueID valueID) const
</ins><span class="cx"> {
</span><span class="cx"> static NeverDestroyed<FontDescription> systemFont;
</span><span class="cx"> static NeverDestroyed<FontDescription> headlineFont;
</span><span class="lines">@@ -1143,123 +1143,130 @@
</span><span class="cx"> tallBodyFont.get().setIsAbsoluteSize(false);
</span><span class="cx"> }
</span><span class="cx">
</span><del>- FontDescription* cachedDesc;
</del><ins>+ switch (valueID) {
+ case CSSValueAppleSystemHeadline:
+ return headlineFont;
+ case CSSValueAppleSystemBody:
+ return bodyFont;
+#if __IPHONE_OS_VERSION_MIN_REQUIRED > 80200
+ case CSSValueAppleSystemTitle1:
+ return title1Font;
+ case CSSValueAppleSystemTitle2:
+ return title2Font;
+ case CSSValueAppleSystemTitle3:
+ return title3Font;
+#endif
+ case CSSValueAppleSystemSubheadline:
+ return subheadlineFont;
+ case CSSValueAppleSystemFootnote:
+ return footnoteFont;
+ case CSSValueAppleSystemCaption1:
+ return caption1Font;
+ case CSSValueAppleSystemCaption2:
+ return caption2Font;
+ // Short version.
+ case CSSValueAppleSystemShortHeadline:
+ return shortHeadlineFont;
+ case CSSValueAppleSystemShortBody:
+ return shortBodyFont;
+ case CSSValueAppleSystemShortSubheadline:
+ return shortSubheadlineFont;
+ case CSSValueAppleSystemShortFootnote:
+ return shortFootnoteFont;
+ case CSSValueAppleSystemShortCaption1:
+ return shortCaption1Font;
+ // Tall version.
+ case CSSValueAppleSystemTallBody:
+ return tallBodyFont;
+ default:
+ return systemFont;
+ }
+}
+
+void RenderThemeIOS::updateCachedSystemFontDescription(CSSValueID valueID, FontDescription& fontDescription) const
+{
</ins><span class="cx"> RetainPtr<CTFontDescriptorRef> fontDescriptor;
</span><span class="cx"> CFStringRef textStyle;
</span><span class="cx"> switch (valueID) {
</span><span class="cx"> case CSSValueAppleSystemHeadline:
</span><del>- cachedDesc = &headlineFont.get();
</del><span class="cx"> textStyle = kCTUIFontTextStyleHeadline;
</span><del>- if (!headlineFont.get().isAbsoluteSize())
- fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, userTextSize, 0));
</del><ins>+ fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), 0));
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueAppleSystemBody:
</span><del>- cachedDesc = &bodyFont.get();
</del><span class="cx"> textStyle = kCTUIFontTextStyleBody;
</span><del>- if (!bodyFont.get().isAbsoluteSize())
- fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, userTextSize, 0));
</del><ins>+ fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), 0));
</ins><span class="cx"> break;
</span><span class="cx"> #if __IPHONE_OS_VERSION_MIN_REQUIRED > 80200
</span><span class="cx"> case CSSValueAppleSystemTitle1:
</span><del>- cachedDesc = &title1Font.get();
</del><span class="cx"> textStyle = kCTUIFontTextStyleTitle1;
</span><del>- if (!title1Font.get().isAbsoluteSize())
- fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, userTextSize, 0));
</del><ins>+ fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), 0));
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueAppleSystemTitle2:
</span><del>- cachedDesc = &title2Font.get();
</del><span class="cx"> textStyle = kCTUIFontTextStyleTitle2;
</span><del>- if (!title2Font.get().isAbsoluteSize())
- fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, userTextSize, 0));
</del><ins>+ fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), 0));
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueAppleSystemTitle3:
</span><del>- cachedDesc = &title3Font.get();
</del><span class="cx"> textStyle = kCTUIFontTextStyleTitle3;
</span><del>- if (!title3Font.get().isAbsoluteSize())
- fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, userTextSize, 0));
</del><ins>+ fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), 0));
</ins><span class="cx"> break;
</span><span class="cx"> #endif
</span><span class="cx"> case CSSValueAppleSystemSubheadline:
</span><del>- cachedDesc = &subheadlineFont.get();
</del><span class="cx"> textStyle = kCTUIFontTextStyleSubhead;
</span><del>- if (!subheadlineFont.get().isAbsoluteSize())
- fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, userTextSize, 0));
</del><ins>+ fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), 0));
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueAppleSystemFootnote:
</span><del>- cachedDesc = &footnoteFont.get();
</del><span class="cx"> textStyle = kCTUIFontTextStyleFootnote;
</span><del>- if (!footnoteFont.get().isAbsoluteSize())
- fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, userTextSize, 0));
</del><ins>+ fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), 0));
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueAppleSystemCaption1:
</span><del>- cachedDesc = &caption1Font.get();
</del><span class="cx"> textStyle = kCTUIFontTextStyleCaption1;
</span><del>- if (!caption1Font.get().isAbsoluteSize())
- fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, userTextSize, 0));
</del><ins>+ fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), 0));
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueAppleSystemCaption2:
</span><del>- cachedDesc = &caption2Font.get();
</del><span class="cx"> textStyle = kCTUIFontTextStyleCaption2;
</span><del>- if (!caption2Font.get().isAbsoluteSize())
- fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, userTextSize, 0));
</del><ins>+ fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), 0));
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> // Short version.
</span><span class="cx"> case CSSValueAppleSystemShortHeadline:
</span><del>- cachedDesc = &shortHeadlineFont.get();
</del><span class="cx"> textStyle = kCTUIFontTextStyleShortHeadline;
</span><del>- if (!shortHeadlineFont.get().isAbsoluteSize())
- fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, userTextSize, 0));
</del><ins>+ fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), 0));
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueAppleSystemShortBody:
</span><del>- cachedDesc = &shortBodyFont.get();
</del><span class="cx"> textStyle = kCTUIFontTextStyleShortBody;
</span><del>- if (!shortBodyFont.get().isAbsoluteSize())
- fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, userTextSize, 0));
</del><ins>+ fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), 0));
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueAppleSystemShortSubheadline:
</span><del>- cachedDesc = &shortSubheadlineFont.get();
</del><span class="cx"> textStyle = kCTUIFontTextStyleShortSubhead;
</span><del>- if (!shortSubheadlineFont.get().isAbsoluteSize())
- fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, userTextSize, 0));
</del><ins>+ fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), 0));
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueAppleSystemShortFootnote:
</span><del>- cachedDesc = &shortFootnoteFont.get();
</del><span class="cx"> textStyle = kCTUIFontTextStyleShortFootnote;
</span><del>- if (!shortFootnoteFont.get().isAbsoluteSize())
- fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, userTextSize, 0));
</del><ins>+ fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), 0));
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueAppleSystemShortCaption1:
</span><del>- cachedDesc = &shortCaption1Font.get();
</del><span class="cx"> textStyle = kCTUIFontTextStyleShortCaption1;
</span><del>- if (!shortCaption1Font.get().isAbsoluteSize())
- fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, userTextSize, 0));
</del><ins>+ fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), 0));
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> // Tall version.
</span><span class="cx"> case CSSValueAppleSystemTallBody:
</span><del>- cachedDesc = &tallBodyFont.get();
</del><span class="cx"> textStyle = kCTUIFontTextStyleTallBody;
</span><del>- if (!tallBodyFont.get().isAbsoluteSize())
- fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, userTextSize, 0));
</del><ins>+ fontDescriptor = adoptCF(CTFontDescriptorCreateWithTextStyle(textStyle, contentSizeCategory(), 0));
</ins><span class="cx"> break;
</span><span class="cx">
</span><span class="cx"> default:
</span><span class="cx"> textStyle = kCTFontDescriptorTextStyleEmphasized;
</span><del>- cachedDesc = &systemFont.get();
- if (!systemFont.get().isAbsoluteSize())
- fontDescriptor = adoptCF(CTFontDescriptorCreateForUIType(kCTFontSystemFontType, 0, nullptr));
</del><ins>+ fontDescriptor = adoptCF(CTFontDescriptorCreateForUIType(kCTFontSystemFontType, 0, nullptr));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (fontDescriptor) {
- RetainPtr<CTFontRef> font = adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), 0, nullptr));
- cachedDesc->setIsAbsoluteSize(true);
- cachedDesc->setOneFamily(textStyle);
- cachedDesc->setSpecifiedSize(CTFontGetSize(font.get()));
- cachedDesc->setWeight(fromCTFontWeight(FontCache::weightOfCTFont(font.get())));
- cachedDesc->setItalic(FontItalicOff);
- }
- fontDescription = *cachedDesc;
</del><ins>+ ASSERT(fontDescriptor);
+ RetainPtr<CTFontRef> font = adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor.get(), 0, nullptr));
+ fontDescription.setIsAbsoluteSize(true);
+ fontDescription.setOneFamily(textStyle);
+ fontDescription.setSpecifiedSize(CTFontGetSize(font.get()));
+ fontDescription.setWeight(fromCTFontWeight(FontCache::weightOfCTFont(font.get())));
+ fontDescription.setItalic(FontItalicOff);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if ENABLE(VIDEO)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (179049 => 179050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeMac.h        2015-01-24 01:38:10 UTC (rev 179049)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h        2015-01-24 01:41:30 UTC (rev 179050)
</span><span class="lines">@@ -66,9 +66,6 @@
</span><span class="cx">
</span><span class="cx"> virtual void platformColorsDidChange() override;
</span><span class="cx">
</span><del>- // System fonts.
- virtual void systemFont(CSSValueID, FontDescription&) const override;
-
</del><span class="cx"> virtual int minimumMenuListSize(RenderStyle&) const override;
</span><span class="cx">
</span><span class="cx"> virtual void adjustSliderThumbSize(RenderStyle&, Element*) const override;
</span><span class="lines">@@ -112,6 +109,9 @@
</span><span class="cx"> RenderThemeMac();
</span><span class="cx"> virtual ~RenderThemeMac();
</span><span class="cx">
</span><ins>+ // System fonts.
+ virtual void updateCachedSystemFontDescription(CSSValueID, FontDescription&) const override;
+
</ins><span class="cx"> #if ENABLE(VIDEO)
</span><span class="cx"> // Media controls
</span><span class="cx"> virtual String mediaControlsStyleSheet() override;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (179049 => 179050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeMac.mm        2015-01-24 01:38:10 UTC (rev 179049)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm        2015-01-24 01:41:30 UTC (rev 179050)
</span><span class="lines">@@ -338,64 +338,41 @@
</span><span class="cx"> return fontWeights[appKitFontWeight - 1];
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderThemeMac::systemFont(CSSValueID cssValueId, FontDescription& fontDescription) const
</del><ins>+void RenderThemeMac::updateCachedSystemFontDescription(CSSValueID cssValueId, FontDescription& fontDescription) const
</ins><span class="cx"> {
</span><del>- DEPRECATED_DEFINE_STATIC_LOCAL(FontDescription, systemFont, ());
- DEPRECATED_DEFINE_STATIC_LOCAL(FontDescription, smallSystemFont, ());
- DEPRECATED_DEFINE_STATIC_LOCAL(FontDescription, menuFont, ());
- DEPRECATED_DEFINE_STATIC_LOCAL(FontDescription, labelFont, ());
- DEPRECATED_DEFINE_STATIC_LOCAL(FontDescription, miniControlFont, ());
- DEPRECATED_DEFINE_STATIC_LOCAL(FontDescription, smallControlFont, ());
- DEPRECATED_DEFINE_STATIC_LOCAL(FontDescription, controlFont, ());
-
- FontDescription* cachedDesc;
- NSFont* font = nil;
</del><ins>+ NSFont* font;
</ins><span class="cx"> switch (cssValueId) {
</span><span class="cx"> case CSSValueSmallCaption:
</span><del>- cachedDesc = &smallSystemFont;
- if (!smallSystemFont.isAbsoluteSize())
- font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
</del><ins>+ font = [NSFont systemFontOfSize:[NSFont smallSystemFontSize]];
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueMenu:
</span><del>- cachedDesc = &menuFont;
- if (!menuFont.isAbsoluteSize())
- font = [NSFont menuFontOfSize:[NSFont systemFontSize]];
</del><ins>+ font = [NSFont menuFontOfSize:[NSFont systemFontSize]];
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueStatusBar:
</span><del>- cachedDesc = &labelFont;
- if (!labelFont.isAbsoluteSize())
- font = [NSFont labelFontOfSize:[NSFont labelFontSize]];
</del><ins>+ font = [NSFont labelFontOfSize:[NSFont labelFontSize]];
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueWebkitMiniControl:
</span><del>- cachedDesc = &miniControlFont;
- if (!miniControlFont.isAbsoluteSize())
- font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSMiniControlSize]];
</del><ins>+ font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSMiniControlSize]];
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueWebkitSmallControl:
</span><del>- cachedDesc = &smallControlFont;
- if (!smallControlFont.isAbsoluteSize())
- font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]];
</del><ins>+ font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSSmallControlSize]];
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueWebkitControl:
</span><del>- cachedDesc = &controlFont;
- if (!controlFont.isAbsoluteSize())
- font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]];
</del><ins>+ font = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSRegularControlSize]];
</ins><span class="cx"> break;
</span><span class="cx"> default:
</span><del>- cachedDesc = &systemFont;
- if (!systemFont.isAbsoluteSize())
- font = [NSFont systemFontOfSize:[NSFont systemFontSize]];
</del><ins>+ font = [NSFont systemFontOfSize:[NSFont systemFontSize]];
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (font) {
- NSFontManager *fontManager = [NSFontManager sharedFontManager];
- cachedDesc->setIsAbsoluteSize(true);
- cachedDesc->setOneFamily([font webCoreFamilyName]);
- cachedDesc->setSpecifiedSize([font pointSize]);
- cachedDesc->setWeight(toFontWeight([fontManager weightOfFont:font]));
- cachedDesc->setIsItalic([fontManager traitsOfFont:font] & NSItalicFontMask);
- }
- fontDescription = *cachedDesc;
</del><ins>+ if (!font)
+ return;
+
+ NSFontManager *fontManager = [NSFontManager sharedFontManager];
+ fontDescription.setIsAbsoluteSize(true);
+ fontDescription.setOneFamily([font webCoreFamilyName]);
+ fontDescription.setSpecifiedSize([font pointSize]);
+ fontDescription.setWeight(toFontWeight([fontManager weightOfFont:font]));
+ fontDescription.setIsItalic([fontManager traitsOfFont:font] & NSItalicFontMask);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> static RGBA32 convertNSColorToColor(NSColor *color)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeSafaricpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeSafari.cpp (179049 => 179050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeSafari.cpp        2015-01-24 01:38:10 UTC (rev 179049)
+++ trunk/Source/WebCore/rendering/RenderThemeSafari.cpp        2015-01-24 01:41:30 UTC (rev 179050)
</span><span class="lines">@@ -192,63 +192,40 @@
</span><span class="cx"> return sizes[controlSize];
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderThemeSafari::systemFont(CSSValueID valueID, FontDescription& fontDescription) const
</del><ins>+void RenderThemeSafari::updateCachedSystemFontDescription(CSSValueID valueID, FontDescription& fontDescription) const
</ins><span class="cx"> {
</span><del>- static FontDescription systemFont;
- static FontDescription smallSystemFont;
- static FontDescription menuFont;
- static FontDescription labelFont;
- static FontDescription miniControlFont;
- static FontDescription smallControlFont;
- static FontDescription controlFont;
-
- FontDescription* cachedDesc;
- float fontSize = 0;
</del><ins>+ float fontSize;
</ins><span class="cx"> switch (valueID) {
</span><span class="cx"> case CSSValueSmallCaption:
</span><del>- cachedDesc = &smallSystemFont;
- if (!smallSystemFont.isAbsoluteSize())
- fontSize = systemFontSizeForControlSize(NSSmallControlSize);
</del><ins>+ fontSize = systemFontSizeForControlSize(NSSmallControlSize);
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueMenu:
</span><del>- cachedDesc = &menuFont;
- if (!menuFont.isAbsoluteSize())
- fontSize = systemFontSizeForControlSize(NSRegularControlSize);
</del><ins>+ fontSize = systemFontSizeForControlSize(NSRegularControlSize);
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueStatusBar:
</span><del>- cachedDesc = &labelFont;
- if (!labelFont.isAbsoluteSize())
- fontSize = 10.0f;
</del><ins>+ fontSize = 10.0f;
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueWebkitMiniControl:
</span><del>- cachedDesc = &miniControlFont;
- if (!miniControlFont.isAbsoluteSize())
- fontSize = systemFontSizeForControlSize(NSMiniControlSize);
</del><ins>+ fontSize = systemFontSizeForControlSize(NSMiniControlSize);
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueWebkitSmallControl:
</span><del>- cachedDesc = &smallControlFont;
- if (!smallControlFont.isAbsoluteSize())
- fontSize = systemFontSizeForControlSize(NSSmallControlSize);
</del><ins>+ fontSize = systemFontSizeForControlSize(NSSmallControlSize);
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueWebkitControl:
</span><del>- cachedDesc = &controlFont;
- if (!controlFont.isAbsoluteSize())
- fontSize = systemFontSizeForControlSize(NSRegularControlSize);
</del><ins>+ fontSize = systemFontSizeForControlSize(NSRegularControlSize);
</ins><span class="cx"> break;
</span><span class="cx"> default:
</span><del>- cachedDesc = &systemFont;
- if (!systemFont.isAbsoluteSize())
- fontSize = 13.0f;
</del><ins>+ fontSize = 13.0f;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- if (fontSize) {
- cachedDesc->setIsAbsoluteSize(true);
- cachedDesc->setOneFamily("Lucida Grande");
- cachedDesc->setSpecifiedSize(fontSize);
- cachedDesc->setWeight(FontWeightNormal);
- cachedDesc->setItalic(FontItalicOff);
- }
- fontDescription = *cachedDesc;
</del><ins>+ if (!fontSize)
+ return;
+
+ fontDescription.setIsAbsoluteSize(true);
+ fontDescription.setOneFamily("Lucida Grande");
+ fontDescription.setSpecifiedSize(fontSize);
+ fontDescription.setWeight(FontWeightNormal);
+ fontDescription.setItalic(FontItalicOff);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderThemeSafari::isControlStyled(const RenderStyle& style, const BorderData& border,
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeSafarih"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeSafari.h (179049 => 179050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeSafari.h        2015-01-24 01:38:10 UTC (rev 179049)
+++ trunk/Source/WebCore/rendering/RenderThemeSafari.h        2015-01-24 01:41:30 UTC (rev 179050)
</span><span class="lines">@@ -71,9 +71,6 @@
</span><span class="cx">
</span><span class="cx"> virtual Color platformFocusRingColor() const;
</span><span class="cx">
</span><del>- // System fonts.
- virtual void systemFont(CSSValueID, FontDescription&) const;
-
</del><span class="cx"> virtual int minimumMenuListSize(RenderStyle&) const;
</span><span class="cx">
</span><span class="cx"> virtual void adjustSliderThumbSize(RenderStyle&, Element*) const;
</span><span class="lines">@@ -85,6 +82,9 @@
</span><span class="cx"> virtual int popupInternalPaddingBottom(RenderStyle&) const;
</span><span class="cx">
</span><span class="cx"> protected:
</span><ins>+ // System fonts.
+ virtual void updateCachedSystemFontDescription(CSSValueID, FontDescription&) const override;
+
</ins><span class="cx"> // Methods for each appearance value.
</span><span class="cx"> virtual bool paintCheckbox(const RenderObject&, const PaintInfo&, const IntRect&);
</span><span class="cx"> virtual void setCheckboxSize(RenderStyle&) const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeWin.cpp (179049 => 179050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeWin.cpp        2015-01-24 01:38:10 UTC (rev 179049)
+++ trunk/Source/WebCore/rendering/RenderThemeWin.cpp        2015-01-24 01:41:30 UTC (rev 179050)
</span><span class="lines">@@ -329,22 +329,8 @@
</span><span class="cx"> fontDescription.setIsItalic(logFont.lfItalic);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static void fillFontDescription(FontDescription& fontDescription, LOGFONT& logFont)
-{
- fillFontDescription(fontDescription, logFont, abs(logFont.lfHeight));
-}
-
-void RenderThemeWin::systemFont(CSSValueID valueID, FontDescription& fontDescription) const
</del><ins>+void RenderThemeWin::updateCachedSystemFontDescription(CSSValueID valueID, FontDescription& fontDescription) const
</ins><span class="cx"> {
</span><del>- static FontDescription captionFont;
- static FontDescription controlFont;
- static FontDescription smallCaptionFont;
- static FontDescription menuFont;
- static FontDescription iconFont;
- static FontDescription messageBoxFont;
- static FontDescription statusBarFont;
- static FontDescription systemFont;
-
</del><span class="cx"> static bool initialized;
</span><span class="cx"> static NONCLIENTMETRICS ncm;
</span><span class="cx">
</span><span class="lines">@@ -354,66 +340,41 @@
</span><span class="cx"> ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ LOGFONT logFont;
+ bool shouldUseDefaultControlFontPixelSize = false;
</ins><span class="cx"> switch (valueID) {
</span><del>- case CSSValueIcon: {
- if (!iconFont.isAbsoluteSize()) {
- LOGFONT logFont;
- ::SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(logFont), &logFont, 0);
- fillFontDescription(iconFont, logFont);
- }
- fontDescription = iconFont;
</del><ins>+ case CSSValueIcon:
+ ::SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(logFont), &logFont, 0);
</ins><span class="cx"> break;
</span><del>- }
</del><span class="cx"> case CSSValueMenu:
</span><del>- if (!menuFont.isAbsoluteSize())
- fillFontDescription(menuFont, ncm.lfMenuFont);
- fontDescription = menuFont;
</del><ins>+ logFont = ncm.lfMenuFont;
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueMessageBox:
</span><del>- if (!messageBoxFont.isAbsoluteSize())
- fillFontDescription(messageBoxFont, ncm.lfMessageFont);
- fontDescription = messageBoxFont;
</del><ins>+ logFont = ncm.lfMessageFont;
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueStatusBar:
</span><del>- if (!statusBarFont.isAbsoluteSize())
- fillFontDescription(statusBarFont, ncm.lfStatusFont);
- fontDescription = statusBarFont;
</del><ins>+ logFont = ncm.lfStatusFont;
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueCaption:
</span><del>- if (!captionFont.isAbsoluteSize())
- fillFontDescription(captionFont, ncm.lfCaptionFont);
- fontDescription = captionFont;
</del><ins>+ logFont = ncm.lfCaptionFont;
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueSmallCaption:
</span><del>- if (!smallCaptionFont.isAbsoluteSize())
- fillFontDescription(smallCaptionFont, ncm.lfSmCaptionFont);
- fontDescription = smallCaptionFont;
</del><ins>+ logFont = ncm.lfSmCaptionFont;
</ins><span class="cx"> break;
</span><span class="cx"> case CSSValueWebkitSmallControl:
</span><span class="cx"> case CSSValueWebkitMiniControl: // Just map to small.
</span><span class="cx"> case CSSValueWebkitControl: // Just map to small.
</span><del>- if (!controlFont.isAbsoluteSize()) {
- HGDIOBJ hGDI = ::GetStockObject(DEFAULT_GUI_FONT);
- if (hGDI) {
- LOGFONT logFont;
- if (::GetObject(hGDI, sizeof(logFont), &logFont) > 0)
- fillFontDescription(controlFont, logFont, defaultControlFontPixelSize);
- }
- }
- fontDescription = controlFont;
- break;
</del><ins>+ shouldUseDefaultControlFontPixelSize = true;
+ FALLTHROUGH;
</ins><span class="cx"> default: { // Everything else uses the stock GUI font.
</span><del>- if (!systemFont.isAbsoluteSize()) {
- HGDIOBJ hGDI = ::GetStockObject(DEFAULT_GUI_FONT);
- if (hGDI) {
- LOGFONT logFont;
- if (::GetObject(hGDI, sizeof(logFont), &logFont) > 0)
- fillFontDescription(systemFont, logFont);
- }
- }
- fontDescription = systemFont;
</del><ins>+ HGDIOBJ hGDI = ::GetStockObject(DEFAULT_GUI_FONT);
+ if (!hGDI)
+ return;
+ if (::GetObject(hGDI, sizeof(logFont), &logFont) <= 0)
+ return;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><ins>+ fillFontDescription(fontDescription, logFont, shouldUseDefaultControlFontPixelSize ? defaultControlFontPixelSize : abs(logFont.lfHeight));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> bool RenderThemeWin::supportsFocus(ControlPart appearance) const
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderThemeWinh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderThemeWin.h (179049 => 179050)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderThemeWin.h        2015-01-24 01:38:10 UTC (rev 179049)
+++ trunk/Source/WebCore/rendering/RenderThemeWin.h        2015-01-24 01:41:30 UTC (rev 179050)
</span><span class="lines">@@ -62,8 +62,6 @@
</span><span class="cx"> virtual Color platformActiveSelectionForegroundColor() const override;
</span><span class="cx"> virtual Color platformInactiveSelectionForegroundColor() const override;
</span><span class="cx">
</span><del>- // System fonts.
- virtual void systemFont(CSSValueID, FontDescription&) const override;
</del><span class="cx"> virtual Color systemColor(CSSValueID) const override;
</span><span class="cx">
</span><span class="cx"> virtual bool paintCheckbox(const RenderObject& o, const PaintInfo& i, const IntRect& r) override
</span><span class="lines">@@ -148,6 +146,9 @@
</span><span class="cx"> RenderThemeWin();
</span><span class="cx"> virtual ~RenderThemeWin();
</span><span class="cx">
</span><ins>+ // System fonts.
+ virtual void updateCachedSystemFontDescription(CSSValueID, FontDescription&) const override;
+
</ins><span class="cx"> void addIntrinsicMargins(RenderStyle&) const;
</span><span class="cx"> void close();
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>