<!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>[181965] trunk</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/181965">181965</a></dd>
<dt>Author</dt> <dd>dino@apple.com</dd>
<dt>Date</dt> <dd>2015-03-25 10:43:56 -0700 (Wed, 25 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>MediaControls: Use font with fixed number width
https://bugs.webkit.org/show_bug.cgi?id=143018
&lt;rdar://problem/20245415&gt;

Reviewed by Eric Carlson.

Source/WebCore:

Add a new font-family, specific to Apple platforms,
called -apple-system-font-monospaced-numbers. This is
a special variant of the system font which uses monospaced
forms for the number glyphs - allowing a time reading that
doesn't bounce around as the time changes.

* Modules/mediacontrols/mediaControlsApple.css: Media controls should
use the new font.
(audio::-webkit-media-controls-time-remaining-display):
* Modules/mediacontrols/mediaControlsiOS.css:
(audio::-webkit-media-controls-time-remaining-display):

* platform/graphics/ios/FontCacheIOS.mm: Request a new CTFontRef with
the appropriate attributes.
(WebCore::createCTFontWithFamilyNameAndWeight):
* platform/graphics/mac/FontCacheMac.mm: Ditto, but NSFont.
(WebCore::fontWithFamily):
* platform/spi/cocoa/CoreTextSPI.h: Expose the constants for
the new form so that the public SDK can build.

LayoutTests:

Add some results for the new font family &quot;-apple-system-font-monospaced-numbers&quot;.

* platform/mac/fast/text/systemFont.html:
* platform/mac/fast/text/systemFont-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacfasttextsystemFontexpectedtxt">trunk/LayoutTests/platform/mac/fast/text/systemFont-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacfasttextsystemFonthtml">trunk/LayoutTests/platform/mac/fast/text/systemFont.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsmediaControlsApplecss">trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.css</a></li>
<li><a href="#trunkSourceWebCoreModulesmediacontrolsmediaControlsiOScss">trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsiosFontCacheIOSmm">trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsmacFontCacheMacmm">trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformspicocoaCoreTextSPIh">trunk/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (181964 => 181965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-03-25 17:31:52 UTC (rev 181964)
+++ trunk/LayoutTests/ChangeLog        2015-03-25 17:43:56 UTC (rev 181965)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-03-25  Dean Jackson  &lt;dino@apple.com&gt;
+
+        MediaControls: Use font with fixed number width
+        https://bugs.webkit.org/show_bug.cgi?id=143018
+        &lt;rdar://problem/20245415&gt;
+
+        Reviewed by Eric Carlson.
+
+        Add some results for the new font family &quot;-apple-system-font-monospaced-numbers&quot;.
+
+        * platform/mac/fast/text/systemFont.html:
+        * platform/mac/fast/text/systemFont-expected.txt:
+
</ins><span class="cx"> 2015-03-25  Marcos Chavarría Teijeiro  &lt;chavarria1991@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         GTK+ Gardening 24th March
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacfasttextsystemFontexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/fast/text/systemFont-expected.txt (181964 => 181965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/text/systemFont-expected.txt        2015-03-25 17:31:52 UTC (rev 181964)
+++ trunk/LayoutTests/platform/mac/fast/text/systemFont-expected.txt        2015-03-25 17:43:56 UTC (rev 181965)
</span><span class="lines">@@ -1,8 +1,8 @@
</span><del>-layer at (0,0) size 785x1810
</del><ins>+layer at (0,0) size 785x2092
</ins><span class="cx">   RenderView at (0,0) size 785x600
</span><del>-layer at (0,0) size 785x1810
-  RenderBlock {HTML} at (0,0) size 785x1810
-    RenderBody {BODY} at (8,8) size 769x1794
</del><ins>+layer at (0,0) size 785x2092
+  RenderBlock {HTML} at (0,0) size 785x2092
+    RenderBody {BODY} at (8,8) size 769x2076
</ins><span class="cx">       RenderBlock {DIV} at (0,0) size 769x897
</span><span class="cx">         RenderBlock {DIV} at (0,0) size 769x28
</span><span class="cx">           RenderText {#text} at (0,0) size 438x28
</span><span class="lines">@@ -79,3 +79,20 @@
</span><span class="cx">           RenderText {#text} at (0,0) size 756x170
</span><span class="cx">             text run at (0,0) width 756: &quot;This is a test for -apple-&quot;
</span><span class="cx">             text run at (0,85) width 525: &quot;system-font font&quot;
</span><ins>+      RenderBlock {DIV} at (0,1794) size 769x282
+        RenderBlock {DIV} at (0,0) size 769x56
+          RenderText {#text} at (0,0) size 695x56
+            text run at (0,0) width 695: &quot;This is a test for -apple-system-font-monospaced-numbers font -&quot;
+            text run at (0,28) width 126: &quot;00:11:22:33&quot;
+        RenderBlock {DIV} at (0,56) size 769x70
+          RenderText {#text} at (0,0) size 672x70
+            text run at (0,0) width 672: &quot;This is a test for -apple-system-font-monospaced-&quot;
+            text run at (0,35) width 362: &quot;numbers font - 00:11:22:33&quot;
+        RenderBlock {DIV} at (0,126) size 769x70
+          RenderText {#text} at (0,0) size 672x70
+            text run at (0,0) width 672: &quot;This is a test for -apple-system-font-monospaced-&quot;
+            text run at (0,35) width 362: &quot;numbers font - 00:11:22:33&quot;
+        RenderBlock {DIV} at (0,196) size 769x86
+          RenderText {#text} at (0,0) size 658x86
+            text run at (0,0) width 582: &quot;This is a test for -apple-system-font-&quot;
+            text run at (0,43) width 658: &quot;monospaced-numbers font - 00:11:22:33&quot;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacfasttextsystemFonthtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/fast/text/systemFont.html (181964 => 181965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/fast/text/systemFont.html        2015-03-25 17:31:52 UTC (rev 181964)
+++ trunk/LayoutTests/platform/mac/fast/text/systemFont.html        2015-03-25 17:43:56 UTC (rev 181965)
</span><span class="lines">@@ -23,4 +23,10 @@
</span><span class="cx">         &lt;div style=&quot;font-family: -apple-system-font; font-size: 66px&quot;&gt;This is a test for -apple-system-font font&lt;/div&gt;
</span><span class="cx">         &lt;div style=&quot;font-family: -apple-system-font; font-size: 72px&quot;&gt;This is a test for -apple-system-font font&lt;/div&gt;
</span><span class="cx">     &lt;/div&gt;
</span><ins>+    &lt;div&gt;
+        &lt;div style=&quot;font-family: -apple-system-font-monospaced-numbers; font-size: 24px&quot;&gt;This is a test for -apple-system-font-monospaced-numbers font - 00:11:22:33&lt;/div&gt;
+        &lt;div style=&quot;font: 30.0px '-apple-system-font-monospaced-numbers'&quot;&gt;This is a test for -apple-system-font-monospaced-numbers font - 00:11:22:33&lt;/div&gt;
+        &lt;div style=&quot;font-family: -apple-system-font-monospaced-numbers; font-size: 30px&quot;&gt;This is a test for -apple-system-font-monospaced-numbers font - 00:11:22:33&lt;/div&gt;
+        &lt;div style=&quot;font-family: -apple-system-font-monospaced-numbers; font-size: 36px&quot;&gt;This is a test for -apple-system-font-monospaced-numbers font - 00:11:22:33&lt;/div&gt;
+    &lt;/div&gt;
</ins><span class="cx"> &lt;/body&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (181964 => 181965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-25 17:31:52 UTC (rev 181964)
+++ trunk/Source/WebCore/ChangeLog        2015-03-25 17:43:56 UTC (rev 181965)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2015-03-25  Dean Jackson  &lt;dino@apple.com&gt;
+
+        MediaControls: Use font with fixed number width
+        https://bugs.webkit.org/show_bug.cgi?id=143018
+        &lt;rdar://problem/20245415&gt;
+
+        Reviewed by Eric Carlson.
+
+        Add a new font-family, specific to Apple platforms,
+        called -apple-system-font-monospaced-numbers. This is
+        a special variant of the system font which uses monospaced
+        forms for the number glyphs - allowing a time reading that
+        doesn't bounce around as the time changes.
+
+        * Modules/mediacontrols/mediaControlsApple.css: Media controls should
+        use the new font.
+        (audio::-webkit-media-controls-time-remaining-display):
+        * Modules/mediacontrols/mediaControlsiOS.css:
+        (audio::-webkit-media-controls-time-remaining-display):
+
+        * platform/graphics/ios/FontCacheIOS.mm: Request a new CTFontRef with
+        the appropriate attributes.
+        (WebCore::createCTFontWithFamilyNameAndWeight):
+        * platform/graphics/mac/FontCacheMac.mm: Ditto, but NSFont.
+        (WebCore::fontWithFamily):
+        * platform/spi/cocoa/CoreTextSPI.h: Expose the constants for
+        the new form so that the public SDK can build.
+
</ins><span class="cx"> 2015-03-25  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         [Content Extensions] Add multi-DFA compiling and interpreting.
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsmediaControlsApplecss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.css (181964 => 181965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.css        2015-03-25 17:31:52 UTC (rev 181964)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.css        2015-03-25 17:43:56 UTC (rev 181965)
</span><span class="lines">@@ -417,6 +417,7 @@
</span><span class="cx">     text-decoration: none;
</span><span class="cx">     position: relative;
</span><span class="cx">     bottom: 0.5px;
</span><ins>+    font-family: -apple-system-font-monospaced-numbers;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> video::-webkit-media-controls-current-time-display,
</span></span></pre></div>
<a id="trunkSourceWebCoreModulesmediacontrolsmediaControlsiOScss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css (181964 => 181965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css        2015-03-25 17:31:52 UTC (rev 181964)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css        2015-03-25 17:43:56 UTC (rev 181965)
</span><span class="lines">@@ -416,6 +416,7 @@
</span><span class="cx">     opacity: 0.55;
</span><span class="cx">     height: 50px;
</span><span class="cx">     font-size: 13px;
</span><ins>+    font-family: -apple-system-font-monospaced-numbers;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> audio::-webkit-media-controls-current-time-display,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsiosFontCacheIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm (181964 => 181965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm        2015-03-25 17:31:52 UTC (rev 181964)
+++ trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm        2015-03-25 17:43:56 UTC (rev 181965)
</span><span class="lines">@@ -613,6 +613,16 @@
</span><span class="cx">         return CTFontCreateWithFontDescriptor(fontDescriptor.get(), size, nullptr);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    static NeverDestroyed&lt;AtomicString&gt; systemUIMonospacedNumbersFontWithApplePrefix(&quot;-apple-system-font-monospaced-numbers&quot;, AtomicString::ConstructFromLiteral);
+    if (equalIgnoringCase(familyName, systemUIMonospacedNumbersFontWithApplePrefix)) {
+        NSDictionary *attributes = @{ (NSString *)kCTFontFeatureTypeIdentifierKey : @(kNumberSpacingType),
+            (NSString *)kCTFontFeatureSelectorIdentifierKey : @(kMonospacedNumbersSelector) };
+
+        RetainPtr&lt;CTFontDescriptorRef&gt; fontDescriptor = adoptCF(CTFontDescriptorCreateWithAttributesAndOptions((CFDictionaryRef)attributes, kCTFontDescriptorOptionSystemUIFont | kCTFontDescriptorOptionPreferAppleSystemFont));
+        return CTFontCreateWithFontDescriptor(fontDescriptor.get(), size, nullptr);
+    }
+
+
</ins><span class="cx">     RetainPtr&lt;CFStringRef&gt; familyNameStr = familyName.createCFString();
</span><span class="cx">     CTFontSymbolicTraits requestedTraits = (CTFontSymbolicTraits)(traits &amp; (kCTFontBoldTrait | kCTFontItalicTrait));
</span><span class="cx">     return CTFontCreateForCSS(familyNameStr.get(), weight, requestedTraits, size);
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsmacFontCacheMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm (181964 => 181965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm        2015-03-25 17:31:52 UTC (rev 181964)
+++ trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm        2015-03-25 17:43:56 UTC (rev 181965)
</span><span class="lines">@@ -158,6 +158,15 @@
</span><span class="cx">         return (desiredWeight &gt;= 7) ? [NSFont boldSystemFontOfSize:size] : [NSFont systemFontOfSize:size];
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (stringIsCaseInsensitiveEqualToString(desiredFamily, @&quot;-apple-system-font-monospaced-numbers&quot;)) {
+        NSArray *featureArray = @[ @{ NSFontFeatureTypeIdentifierKey : @(kNumberSpacingType),
+            NSFontFeatureSelectorIdentifierKey : @(kMonospacedNumbersSelector) } ];
+
+        NSFont* systemFont = [NSFont systemFontOfSize:size];
+        NSFontDescriptor* desc = [systemFont.fontDescriptor fontDescriptorByAddingAttributes:@{ NSFontFeatureSettingsAttribute : featureArray }];
+        return [NSFont fontWithDescriptor:desc size:size];
+    }
+
</ins><span class="cx">     id cachedAvailableFamily = [desiredFamilyToAvailableFamilyDictionary() objectForKey:desiredFamily];
</span><span class="cx">     if (cachedAvailableFamily == [NSNull null]) {
</span><span class="cx">         // We already know this font is not available.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformspicocoaCoreTextSPIh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h (181964 => 181965)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h        2015-03-25 17:31:52 UTC (rev 181964)
+++ trunk/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h        2015-03-25 17:43:56 UTC (rev 181965)
</span><span class="lines">@@ -71,6 +71,19 @@
</span><span class="cx"> 
</span><span class="cx"> CTFontDescriptorRef CTFontDescriptorCreateForUIType(CTFontUIFontType, CGFloat size, CFStringRef language);
</span><span class="cx"> CTFontDescriptorRef CTFontDescriptorCreateWithTextStyle(CFStringRef style, CFStringRef size, CFStringRef language);
</span><ins>+
+#if PLATFORM(COCOA)
+#if !USE(APPLE_INTERNAL_SDK)
+typedef CF_OPTIONS(uint32_t, CTFontDescriptorOptions)
+{
+    kCTFontDescriptorOptionSystemUIFont = 1 &lt;&lt; 1,
+    kCTFontDescriptorOptionPreferAppleSystemFont = kCTFontOptionsPreferSystemFont
+};
+
+CTFontDescriptorRef CTFontDescriptorCreateWithAttributesAndOptions(CFDictionaryRef attributes, CTFontDescriptorOptions);
+#endif
+#endif
+
</ins><span class="cx"> bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef);
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 10100
</span></span></pre>
</div>
</div>

</body>
</html>