Title: [149698] trunk
Revision
149698
Author
enr...@apple.com
Date
2013-05-07 15:41:43 -0700 (Tue, 07 May 2013)

Log Message

Support -webkit-system-font on OS X.
https://bugs.webkit.org/show_bug.cgi?id=115758
<rdar://problem/13433854>

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (149697 => 149698)


--- trunk/LayoutTests/ChangeLog	2013-05-07 22:26:16 UTC (rev 149697)
+++ trunk/LayoutTests/ChangeLog	2013-05-07 22:41:43 UTC (rev 149698)
@@ -1,3 +1,15 @@
+2013-05-06  Enrica Casucci  <enr...@apple.com>
+
+        Support -webkit-system-font on OS X.
+        https://bugs.webkit.org/show_bug.cgi?id=115758
+        <rdar://problem/13433854>
+
+        Reviewed by Dean Jackson.
+
+        * platform/mac/fast/text/systemFont.html: Added.
+        * platform/mac/platform/mac/fast/text/systemFont-expected.png: Added.
+        * platform/mac/platform/mac/fast/text/systemFont-expected.txt: Added.
+
 2013-05-07  Alexey Proskuryakov  <a...@apple.com>
 
         Combine html and js parts fast/url script-tests

Added: trunk/LayoutTests/platform/mac/fast/text/systemFont.html (0 => 149698)


--- trunk/LayoutTests/platform/mac/fast/text/systemFont.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/text/systemFont.html	2013-05-07 22:41:43 UTC (rev 149698)
@@ -0,0 +1,12 @@
+<body>
+    <div style="font-family: -webkit-system-font; font-size: 24px">This is a test for -webkit-system-font font</div>
+    <div style="font: 30.0px '-webkit-system-font'">This is a test for -webkit-system-font font</div>
+    <div style="font-family: -webkit-system-font; font-size: 30px">This is a test for -webkit-system-font font</div>
+    <div style="font-family: -webkit-system-font; font-size: 36px"><b>This is a test for -webkit-system-font font</b></div>
+    <div style="font-family: -webkit-system-font; font-size: 42px"><i>This is a test for -webkit-system-font font</i></div>
+    <div style="font-family: -webkit-system-font; font-size: 48px">This is a test for -webkit-system-font font</div>
+    <div style="font-family: -webkit-system-font; font-size: 54px">This is a test for -webkit-system-font font</div>
+    <div style="font-family: -webkit-system-font; font-size: 60px">This is a test for -webkit-system-font font</div>
+    <div style="font-family: -webkit-system-font; font-size: 66px">This is a test for -webkit-system-font font</div>
+    <div style="font-family: -webkit-system-font; font-size: 72px">This is a test for -webkit-system-font font</div>
+</body>

Added: trunk/LayoutTests/platform/mac/platform/mac/fast/text/systemFont-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/mac/platform/mac/fast/text/systemFont-expected.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/platform/mac/platform/mac/fast/text/systemFont-expected.txt (0 => 149698)


--- trunk/LayoutTests/platform/mac/platform/mac/fast/text/systemFont-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/platform/mac/fast/text/systemFont-expected.txt	2013-05-07 22:41:43 UTC (rev 149698)
@@ -0,0 +1,46 @@
+layer at (0,0) size 785x1169
+  RenderView at (0,0) size 785x600
+layer at (0,0) size 785x1169
+  RenderBlock {HTML} at (0,0) size 785x1169
+    RenderBody {BODY} at (8,8) size 769x1153
+      RenderBlock {DIV} at (0,0) size 769x28
+        RenderText {#text} at (0,0) size 500x28
+          text run at (0,0) width 500: "This is a test for -webkit-system-font font"
+      RenderBlock {DIV} at (0,28) size 769x35
+        RenderText {#text} at (0,0) size 625x35
+          text run at (0,0) width 625: "This is a test for -webkit-system-font font"
+      RenderBlock {DIV} at (0,63) size 769x35
+        RenderText {#text} at (0,0) size 625x35
+          text run at (0,0) width 625: "This is a test for -webkit-system-font font"
+      RenderBlock {DIV} at (0,98) size 769x86
+        RenderInline {B} at (0,0) size 721x86
+          RenderText {#text} at (0,0) size 721x86
+            text run at (0,0) width 721: "This is a test for -webkit-system-font"
+            text run at (0,43) width 77: "font"
+      RenderBlock {DIV} at (0,184) size 769x100
+        RenderInline {I} at (0,0) size 695x100
+          RenderText {#text} at (0,0) size 695x100
+            text run at (0,0) width 695: "This is a test for -webkit-system-"
+            text run at (0,50) width 180: "font font"
+      RenderBlock {DIV} at (0,284) size 769x112
+        RenderText {#text} at (0,0) size 603x112
+          text run at (0,0) width 603: "This is a test for -webkit-"
+          text run at (0,56) width 397: "system-font font"
+      RenderBlock {DIV} at (0,396) size 769x126
+        RenderText {#text} at (0,0) size 678x126
+          text run at (0,0) width 678: "This is a test for -webkit-"
+          text run at (0,63) width 446: "system-font font"
+      RenderBlock {DIV} at (0,522) size 769x142
+        RenderText {#text} at (0,0) size 754x142
+          text run at (0,0) width 754: "This is a test for -webkit-"
+          text run at (0,71) width 496: "system-font font"
+      RenderBlock {DIV} at (0,664) size 769x234
+        RenderText {#text} at (0,0) size 644x234
+          text run at (0,0) width 579: "This is a test for -"
+          text run at (0,78) width 644: "webkit-system-font"
+          text run at (0,156) width 131: "font"
+      RenderBlock {DIV} at (0,898) size 769x255
+        RenderText {#text} at (0,0) size 702x255
+          text run at (0,0) width 632: "This is a test for -"
+          text run at (0,85) width 702: "webkit-system-font"
+          text run at (0,170) width 143: "font"

Modified: trunk/Source/WebCore/ChangeLog (149697 => 149698)


--- trunk/Source/WebCore/ChangeLog	2013-05-07 22:26:16 UTC (rev 149697)
+++ trunk/Source/WebCore/ChangeLog	2013-05-07 22:41:43 UTC (rev 149698)
@@ -1,3 +1,16 @@
+2013-05-06  Enrica Casucci  <enr...@apple.com>
+
+        Support -webkit-system-font on OS X.
+        https://bugs.webkit.org/show_bug.cgi?id=115758
+        <rdar://problem/13433854>
+
+        Reviewed by Dean Jackson.
+
+        Test: platform/mac/fast/text/systemFont.html
+
+        * platform/mac/WebFontCache.mm:
+        (+[WebFontCache internalFontWithFamily:traits:weight:size:]):
+
 2013-05-07  Benjamin Poulain  <bpoul...@apple.com>
 
         Move CanvasGradient and CanvasPattern in the union of CanvasStyle

Modified: trunk/Source/WebCore/platform/mac/WebFontCache.mm (149697 => 149698)


--- trunk/Source/WebCore/platform/mac/WebFontCache.mm	2013-05-07 22:26:16 UTC (rev 149697)
+++ trunk/Source/WebCore/platform/mac/WebFontCache.mm	2013-05-07 22:41:43 UTC (rev 149698)
@@ -161,6 +161,12 @@
 // we then do a search based on the family names of the installed fonts.
 + (NSFont *)internalFontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits weight:(int)desiredWeight size:(float)size
 {
+
+    if ([desiredFamily compare:@"-webkit-system-font" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
+        // We ignore italic for system font.
+        return (desiredWeight >= 7) ? [NSFont boldSystemFontOfSize:size] : [NSFont systemFontOfSize:size];
+    }
+
     NSFontManager *fontManager = [NSFontManager sharedFontManager];
 
     // Do a simple case insensitive search for a matching font family.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to