Diff
Modified: trunk/LayoutTests/ChangeLog (181964 => 181965)
--- trunk/LayoutTests/ChangeLog 2015-03-25 17:31:52 UTC (rev 181964)
+++ trunk/LayoutTests/ChangeLog 2015-03-25 17:43:56 UTC (rev 181965)
@@ -1,3 +1,16 @@
+2015-03-25 Dean Jackson <[email protected]>
+
+ MediaControls: Use font with fixed number width
+ https://bugs.webkit.org/show_bug.cgi?id=143018
+ <rdar://problem/20245415>
+
+ Reviewed by Eric Carlson.
+
+ Add some results for the new font family "-apple-system-font-monospaced-numbers".
+
+ * platform/mac/fast/text/systemFont.html:
+ * platform/mac/fast/text/systemFont-expected.txt:
+
2015-03-25 Marcos ChavarrÃa Teijeiro <[email protected]>
GTK+ Gardening 24th March
Modified: trunk/LayoutTests/platform/mac/fast/text/systemFont-expected.txt (181964 => 181965)
--- 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)
@@ -1,8 +1,8 @@
-layer at (0,0) size 785x1810
+layer at (0,0) size 785x2092
RenderView at (0,0) size 785x600
-layer at (0,0) size 785x1810
- RenderBlock {HTML} at (0,0) size 785x1810
- RenderBody {BODY} at (8,8) size 769x1794
+layer at (0,0) size 785x2092
+ RenderBlock {HTML} at (0,0) size 785x2092
+ RenderBody {BODY} at (8,8) size 769x2076
RenderBlock {DIV} at (0,0) size 769x897
RenderBlock {DIV} at (0,0) size 769x28
RenderText {#text} at (0,0) size 438x28
@@ -79,3 +79,20 @@
RenderText {#text} at (0,0) size 756x170
text run at (0,0) width 756: "This is a test for -apple-"
text run at (0,85) width 525: "system-font font"
+ 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: "This is a test for -apple-system-font-monospaced-numbers font -"
+ text run at (0,28) width 126: "00:11:22:33"
+ RenderBlock {DIV} at (0,56) size 769x70
+ RenderText {#text} at (0,0) size 672x70
+ text run at (0,0) width 672: "This is a test for -apple-system-font-monospaced-"
+ text run at (0,35) width 362: "numbers font - 00:11:22:33"
+ RenderBlock {DIV} at (0,126) size 769x70
+ RenderText {#text} at (0,0) size 672x70
+ text run at (0,0) width 672: "This is a test for -apple-system-font-monospaced-"
+ text run at (0,35) width 362: "numbers font - 00:11:22:33"
+ RenderBlock {DIV} at (0,196) size 769x86
+ RenderText {#text} at (0,0) size 658x86
+ text run at (0,0) width 582: "This is a test for -apple-system-font-"
+ text run at (0,43) width 658: "monospaced-numbers font - 00:11:22:33"
Modified: trunk/LayoutTests/platform/mac/fast/text/systemFont.html (181964 => 181965)
--- 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)
@@ -23,4 +23,10 @@
<div style="font-family: -apple-system-font; font-size: 66px">This is a test for -apple-system-font font</div>
<div style="font-family: -apple-system-font; font-size: 72px">This is a test for -apple-system-font font</div>
</div>
+ <div>
+ <div style="font-family: -apple-system-font-monospaced-numbers; font-size: 24px">This is a test for -apple-system-font-monospaced-numbers font - 00:11:22:33</div>
+ <div style="font: 30.0px '-apple-system-font-monospaced-numbers'">This is a test for -apple-system-font-monospaced-numbers font - 00:11:22:33</div>
+ <div style="font-family: -apple-system-font-monospaced-numbers; font-size: 30px">This is a test for -apple-system-font-monospaced-numbers font - 00:11:22:33</div>
+ <div style="font-family: -apple-system-font-monospaced-numbers; font-size: 36px">This is a test for -apple-system-font-monospaced-numbers font - 00:11:22:33</div>
+ </div>
</body>
Modified: trunk/Source/WebCore/ChangeLog (181964 => 181965)
--- 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)
@@ -1,3 +1,31 @@
+2015-03-25 Dean Jackson <[email protected]>
+
+ MediaControls: Use font with fixed number width
+ https://bugs.webkit.org/show_bug.cgi?id=143018
+ <rdar://problem/20245415>
+
+ 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.
+
2015-03-25 Alex Christensen <[email protected]>
[Content Extensions] Add multi-DFA compiling and interpreting.
Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.css (181964 => 181965)
--- 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)
@@ -417,6 +417,7 @@
text-decoration: none;
position: relative;
bottom: 0.5px;
+ font-family: -apple-system-font-monospaced-numbers;
}
video::-webkit-media-controls-current-time-display,
Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsiOS.css (181964 => 181965)
--- 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)
@@ -416,6 +416,7 @@
opacity: 0.55;
height: 50px;
font-size: 13px;
+ font-family: -apple-system-font-monospaced-numbers;
}
audio::-webkit-media-controls-current-time-display,
Modified: trunk/Source/WebCore/platform/graphics/ios/FontCacheIOS.mm (181964 => 181965)
--- 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)
@@ -613,6 +613,16 @@
return CTFontCreateWithFontDescriptor(fontDescriptor.get(), size, nullptr);
}
+ static NeverDestroyed<AtomicString> systemUIMonospacedNumbersFontWithApplePrefix("-apple-system-font-monospaced-numbers", AtomicString::ConstructFromLiteral);
+ if (equalIgnoringCase(familyName, systemUIMonospacedNumbersFontWithApplePrefix)) {
+ NSDictionary *attributes = @{ (NSString *)kCTFontFeatureTypeIdentifierKey : @(kNumberSpacingType),
+ (NSString *)kCTFontFeatureSelectorIdentifierKey : @(kMonospacedNumbersSelector) };
+
+ RetainPtr<CTFontDescriptorRef> fontDescriptor = adoptCF(CTFontDescriptorCreateWithAttributesAndOptions((CFDictionaryRef)attributes, kCTFontDescriptorOptionSystemUIFont | kCTFontDescriptorOptionPreferAppleSystemFont));
+ return CTFontCreateWithFontDescriptor(fontDescriptor.get(), size, nullptr);
+ }
+
+
RetainPtr<CFStringRef> familyNameStr = familyName.createCFString();
CTFontSymbolicTraits requestedTraits = (CTFontSymbolicTraits)(traits & (kCTFontBoldTrait | kCTFontItalicTrait));
return CTFontCreateForCSS(familyNameStr.get(), weight, requestedTraits, size);
Modified: trunk/Source/WebCore/platform/graphics/mac/FontCacheMac.mm (181964 => 181965)
--- 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)
@@ -158,6 +158,15 @@
return (desiredWeight >= 7) ? [NSFont boldSystemFontOfSize:size] : [NSFont systemFontOfSize:size];
}
+ if (stringIsCaseInsensitiveEqualToString(desiredFamily, @"-apple-system-font-monospaced-numbers")) {
+ NSArray *featureArray = @[ @{ NSFontFeatureTypeIdentifierKey : @(kNumberSpacingType),
+ NSFontFeatureSelectorIdentifierKey : @(kMonospacedNumbersSelector) } ];
+
+ NSFont* systemFont = [NSFont systemFontOfSize:size];
+ NSFontDescriptor* desc = [systemFont.fontDescriptor fontDescriptorByAddingAttributes:@{ NSFontFeatureSettingsAttribute : featureArray }];
+ return [NSFont fontWithDescriptor:desc size:size];
+ }
+
id cachedAvailableFamily = [desiredFamilyToAvailableFamilyDictionary() objectForKey:desiredFamily];
if (cachedAvailableFamily == [NSNull null]) {
// We already know this font is not available.
Modified: trunk/Source/WebCore/platform/spi/cocoa/CoreTextSPI.h (181964 => 181965)
--- 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)
@@ -71,6 +71,19 @@
CTFontDescriptorRef CTFontDescriptorCreateForUIType(CTFontUIFontType, CGFloat size, CFStringRef language);
CTFontDescriptorRef CTFontDescriptorCreateWithTextStyle(CFStringRef style, CFStringRef size, CFStringRef language);
+
+#if PLATFORM(COCOA)
+#if !USE(APPLE_INTERNAL_SDK)
+typedef CF_OPTIONS(uint32_t, CTFontDescriptorOptions)
+{
+ kCTFontDescriptorOptionSystemUIFont = 1 << 1,
+ kCTFontDescriptorOptionPreferAppleSystemFont = kCTFontOptionsPreferSystemFont
+};
+
+CTFontDescriptorRef CTFontDescriptorCreateWithAttributesAndOptions(CFDictionaryRef attributes, CTFontDescriptorOptions);
+#endif
+#endif
+
bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef);
#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 10100