Title: [169474] trunk
Revision
169474
Author
mmaxfi...@apple.com
Date
2014-05-29 16:41:15 -0700 (Thu, 29 May 2014)

Log Message

Support -apple-system-font on OS X
https://bugs.webkit.org/show_bug.cgi?id=133382

Source/WebCore:
Reviewed by Simon Fraser.

Guard on both family names: "-apple-system-font" and "-webkit-system-font"

Test: platform/mac/fast/text/systemFont.html

* platform/mac/WebFontCache.mm:
(+[WebFontCache internalFontWithFamily:traits:weight:size:]):

LayoutTests:
This test makes sure that -apple-system-font is rendered the same way as -webkit-system-font.

Reviewed by Simon Fraser.

* platform/mac-mountainlion/platform/mac/fast/text/systemFont-expected.txt: Updated.
* platform/mac/fast/text/systemFont.html: Tests -apple-system-font in addition to -webkit-system-font.
* platform/mac/platform/mac/fast/text/systemFont-expected.txt: Updated.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (169473 => 169474)


--- trunk/LayoutTests/ChangeLog	2014-05-29 23:24:16 UTC (rev 169473)
+++ trunk/LayoutTests/ChangeLog	2014-05-29 23:41:15 UTC (rev 169474)
@@ -1,3 +1,16 @@
+2014-05-29  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Support -apple-system-font on OS X
+        https://bugs.webkit.org/show_bug.cgi?id=133382
+
+        This test makes sure that -apple-system-font is rendered the same way as -webkit-system-font.
+
+        Reviewed by Simon Fraser.
+
+        * platform/mac-mountainlion/platform/mac/fast/text/systemFont-expected.txt: Updated.
+        * platform/mac/fast/text/systemFont.html: Tests -apple-system-font in addition to -webkit-system-font.
+        * platform/mac/platform/mac/fast/text/systemFont-expected.txt: Updated.
+
 2014-05-29  Alexey Proskuryakov  <a...@apple.com>
 
         Loading <object> from WebArchive crashes

Modified: trunk/LayoutTests/platform/mac/fast/text/systemFont.html (169473 => 169474)


--- trunk/LayoutTests/platform/mac/fast/text/systemFont.html	2014-05-29 23:24:16 UTC (rev 169473)
+++ trunk/LayoutTests/platform/mac/fast/text/systemFont.html	2014-05-29 23:41:15 UTC (rev 169474)
@@ -1,12 +1,26 @@
 <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>
+    <div>
+        <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>
+    </div>
+    <div>
+        <div style="font-family: -apple-system-font; font-size: 24px">This is a test for -apple-system-font font</div>
+        <div style="font: 30.0px '-apple-system-font'">This is a test for -apple-system-font font</div>
+        <div style="font-family: -apple-system-font; font-size: 30px">This is a test for -apple-system-font font</div>
+        <div style="font-family: -apple-system-font; font-size: 36px"><b>This is a test for -apple-system-font font</b></div>
+        <div style="font-family: -apple-system-font; font-size: 42px"><i>This is a test for -apple-system-font font</i></div>
+        <div style="font-family: -apple-system-font; font-size: 48px">This is a test for -apple-system-font font</div>
+        <div style="font-family: -apple-system-font; font-size: 54px">This is a test for -apple-system-font font</div>
+        <div style="font-family: -apple-system-font; font-size: 60px">This is a test for -apple-system-font font</div>
+        <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>
 </body>

Modified: trunk/LayoutTests/platform/mac/platform/mac/fast/text/systemFont-expected.txt (169473 => 169474)


--- trunk/LayoutTests/platform/mac/platform/mac/fast/text/systemFont-expected.txt	2014-05-29 23:24:16 UTC (rev 169473)
+++ trunk/LayoutTests/platform/mac/platform/mac/fast/text/systemFont-expected.txt	2014-05-29 23:41:15 UTC (rev 169474)
@@ -1,46 +1,88 @@
-layer at (0,0) size 785x1169
+layer at (0,0) size 785x2244
   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 493x28
-          text run at (0,0) width 493: "This is a test for -webkit-system-font font"
-      RenderBlock {DIV} at (0,28) size 769x35
-        RenderText {#text} at (0,0) size 616x35
-          text run at (0,0) width 616: "This is a test for -webkit-system-font font"
-      RenderBlock {DIV} at (0,63) size 769x35
-        RenderText {#text} at (0,0) size 616x35
-          text run at (0,0) width 616: "This is a test for -webkit-system-font font"
-      RenderBlock {DIV} at (0,98) size 769x86
-        RenderInline {B} at (0,0) size 726x86
-          RenderText {#text} at (0,0) size 726x86
-            text run at (0,0) width 726: "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 766x100
-          RenderText {#text} at (0,0) size 766x100
-            text run at (0,0) width 766: "This is a test for -webkit-system-font"
-            text run at (0,50) width 84: "font"
-      RenderBlock {DIV} at (0,284) size 769x112
-        RenderText {#text} at (0,0) size 594x112
-          text run at (0,0) width 594: "This is a test for -webkit-"
-          text run at (0,56) width 392: "system-font font"
-      RenderBlock {DIV} at (0,396) size 769x126
-        RenderText {#text} at (0,0) size 669x126
-          text run at (0,0) width 669: "This is a test for -webkit-"
-          text run at (0,63) width 441: "system-font font"
-      RenderBlock {DIV} at (0,522) size 769x142
-        RenderText {#text} at (0,0) size 743x142
-          text run at (0,0) width 743: "This is a test for -webkit-"
-          text run at (0,71) width 490: "system-font font"
-      RenderBlock {DIV} at (0,664) size 769x234
-        RenderText {#text} at (0,0) size 636x234
-          text run at (0,0) width 568: "This is a test for -"
-          text run at (0,78) width 636: "webkit-system-font"
-          text run at (0,156) width 131: "font"
-      RenderBlock {DIV} at (0,898) size 769x255
-        RenderText {#text} at (0,0) size 694x255
-          text run at (0,0) width 619: "This is a test for -"
-          text run at (0,85) width 694: "webkit-system-font"
-          text run at (0,170) width 143: "font"
+layer at (0,0) size 785x2244
+  RenderBlock {HTML} at (0,0) size 785x2244
+    RenderBody {BODY} at (8,8) size 769x2228
+      RenderBlock {DIV} at (0,0) size 769x1153
+        RenderBlock {DIV} at (0,0) size 769x28
+          RenderText {#text} at (0,0) size 493x28
+            text run at (0,0) width 493: "This is a test for -webkit-system-font font"
+        RenderBlock {DIV} at (0,28) size 769x35
+          RenderText {#text} at (0,0) size 616x35
+            text run at (0,0) width 616: "This is a test for -webkit-system-font font"
+        RenderBlock {DIV} at (0,63) size 769x35
+          RenderText {#text} at (0,0) size 616x35
+            text run at (0,0) width 616: "This is a test for -webkit-system-font font"
+        RenderBlock {DIV} at (0,98) size 769x86
+          RenderInline {B} at (0,0) size 726x86
+            RenderText {#text} at (0,0) size 726x86
+              text run at (0,0) width 726: "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 766x100
+            RenderText {#text} at (0,0) size 766x100
+              text run at (0,0) width 766: "This is a test for -webkit-system-font"
+              text run at (0,50) width 84: "font"
+        RenderBlock {DIV} at (0,284) size 769x112
+          RenderText {#text} at (0,0) size 594x112
+            text run at (0,0) width 594: "This is a test for -webkit-"
+            text run at (0,56) width 392: "system-font font"
+        RenderBlock {DIV} at (0,396) size 769x126
+          RenderText {#text} at (0,0) size 669x126
+            text run at (0,0) width 669: "This is a test for -webkit-"
+            text run at (0,63) width 441: "system-font font"
+        RenderBlock {DIV} at (0,522) size 769x142
+          RenderText {#text} at (0,0) size 743x142
+            text run at (0,0) width 743: "This is a test for -webkit-"
+            text run at (0,71) width 490: "system-font font"
+        RenderBlock {DIV} at (0,664) size 769x234
+          RenderText {#text} at (0,0) size 636x234
+            text run at (0,0) width 568: "This is a test for -"
+            text run at (0,78) width 636: "webkit-system-font"
+            text run at (0,156) width 131: "font"
+        RenderBlock {DIV} at (0,898) size 769x255
+          RenderText {#text} at (0,0) size 694x255
+            text run at (0,0) width 619: "This is a test for -"
+            text run at (0,85) width 694: "webkit-system-font"
+            text run at (0,170) width 143: "font"
+      RenderBlock {DIV} at (0,1153) size 769x1075
+        RenderBlock {DIV} at (0,0) size 769x28
+          RenderText {#text} at (0,0) size 480x28
+            text run at (0,0) width 480: "This is a test for -apple-system-font font"
+        RenderBlock {DIV} at (0,28) size 769x35
+          RenderText {#text} at (0,0) size 600x35
+            text run at (0,0) width 600: "This is a test for -apple-system-font font"
+        RenderBlock {DIV} at (0,63) size 769x35
+          RenderText {#text} at (0,0) size 600x35
+            text run at (0,0) width 600: "This is a test for -apple-system-font font"
+        RenderBlock {DIV} at (0,98) size 769x86
+          RenderInline {B} at (0,0) size 703x86
+            RenderText {#text} at (0,0) size 703x86
+              text run at (0,0) width 703: "This is a test for -apple-system-font"
+              text run at (0,43) width 77: "font"
+        RenderBlock {DIV} at (0,184) size 769x100
+          RenderInline {I} at (0,0) size 743x100
+            RenderText {#text} at (0,0) size 743x100
+              text run at (0,0) width 743: "This is a test for -apple-system-font"
+              text run at (0,50) width 84: "font"
+        RenderBlock {DIV} at (0,284) size 769x112
+          RenderText {#text} at (0,0) size 755x112
+            text run at (0,0) width 755: "This is a test for -apple-system-"
+            text run at (0,56) width 205: "font font"
+        RenderBlock {DIV} at (0,396) size 769x126
+          RenderText {#text} at (0,0) size 639x126
+            text run at (0,0) width 639: "This is a test for -apple-"
+            text run at (0,63) width 441: "system-font font"
+        RenderBlock {DIV} at (0,522) size 769x142
+          RenderText {#text} at (0,0) size 710x142
+            text run at (0,0) width 710: "This is a test for -apple-"
+            text run at (0,71) width 490: "system-font font"
+        RenderBlock {DIV} at (0,664) size 769x156
+          RenderText {#text} at (0,0) size 752x156
+            text run at (0,0) width 568: "This is a test for -"
+            text run at (0,78) width 752: "apple-system-font font"
+        RenderBlock {DIV} at (0,820) size 769x255
+          RenderText {#text} at (0,0) size 655x255
+            text run at (0,0) width 619: "This is a test for -"
+            text run at (0,85) width 655: "apple-system-font"
+            text run at (0,170) width 143: "font"

Modified: trunk/LayoutTests/platform/mac-mountainlion/platform/mac/fast/text/systemFont-expected.txt (169473 => 169474)


--- trunk/LayoutTests/platform/mac-mountainlion/platform/mac/fast/text/systemFont-expected.txt	2014-05-29 23:24:16 UTC (rev 169473)
+++ trunk/LayoutTests/platform/mac-mountainlion/platform/mac/fast/text/systemFont-expected.txt	2014-05-29 23:41:15 UTC (rev 169474)
@@ -1,46 +1,88 @@
-layer at (0,0) size 785x1169
+layer at (0,0) size 785x2244
   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"
+layer at (0,0) size 785x2244
+  RenderBlock {HTML} at (0,0) size 785x2244
+    RenderBody {BODY} at (8,8) size 769x2228
+      RenderBlock {DIV} at (0,0) 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"
+      RenderBlock {DIV} at (0,1153) size 769x1075
+        RenderBlock {DIV} at (0,0) size 769x28
+          RenderText {#text} at (0,0) size 487x28
+            text run at (0,0) width 487: "This is a test for -apple-system-font font"
+        RenderBlock {DIV} at (0,28) size 769x35
+          RenderText {#text} at (0,0) size 608x35
+            text run at (0,0) width 608: "This is a test for -apple-system-font font"
+        RenderBlock {DIV} at (0,63) size 769x35
+          RenderText {#text} at (0,0) size 608x35
+            text run at (0,0) width 608: "This is a test for -apple-system-font font"
+        RenderBlock {DIV} at (0,98) size 769x86
+          RenderInline {B} at (0,0) size 698x86
+            RenderText {#text} at (0,0) size 698x86
+              text run at (0,0) width 698: "This is a test for -apple-system-font"
+              text run at (0,43) width 77: "font"
+        RenderBlock {DIV} at (0,184) size 769x100
+          RenderInline {I} at (0,0) size 755x100
+            RenderText {#text} at (0,0) size 755x100
+              text run at (0,0) width 755: "This is a test for -apple-system-font"
+              text run at (0,50) width 84: "font"
+        RenderBlock {DIV} at (0,284) size 769x112
+          RenderText {#text} at (0,0) size 768x112
+            text run at (0,0) width 768: "This is a test for -apple-system-"
+            text run at (0,56) width 205: "font font"
+        RenderBlock {DIV} at (0,396) size 769x126
+          RenderText {#text} at (0,0) size 649x126
+            text run at (0,0) width 649: "This is a test for -apple-"
+            text run at (0,63) width 446: "system-font font"
+        RenderBlock {DIV} at (0,522) size 769x142
+          RenderText {#text} at (0,0) size 721x142
+            text run at (0,0) width 721: "This is a test for -apple-"
+            text run at (0,71) width 496: "system-font font"
+        RenderBlock {DIV} at (0,664) size 769x156
+          RenderText {#text} at (0,0) size 759x156
+            text run at (0,0) width 579: "This is a test for -"
+            text run at (0,78) width 759: "apple-system-font font"
+        RenderBlock {DIV} at (0,820) size 769x255
+          RenderText {#text} at (0,0) size 663x255
+            text run at (0,0) width 632: "This is a test for -"
+            text run at (0,85) width 663: "apple-system-font"
+            text run at (0,170) width 143: "font"

Modified: trunk/Source/WebCore/ChangeLog (169473 => 169474)


--- trunk/Source/WebCore/ChangeLog	2014-05-29 23:24:16 UTC (rev 169473)
+++ trunk/Source/WebCore/ChangeLog	2014-05-29 23:41:15 UTC (rev 169474)
@@ -1,3 +1,17 @@
+2014-05-29  Myles C. Maxfield  <mmaxfi...@apple.com>
+
+        Support -apple-system-font on OS X
+        https://bugs.webkit.org/show_bug.cgi?id=133382
+
+        Reviewed by Simon Fraser.
+
+        Guard on both family names: "-apple-system-font" and "-webkit-system-font"
+
+        Test: platform/mac/fast/text/systemFont.html
+
+        * platform/mac/WebFontCache.mm:
+        (+[WebFontCache internalFontWithFamily:traits:weight:size:]):
+
 2014-05-29  Alexey Proskuryakov  <a...@apple.com>
 
         Loading <object> from WebArchive crashes

Modified: trunk/Source/WebCore/platform/mac/WebFontCache.mm (169473 => 169474)


--- trunk/Source/WebCore/platform/mac/WebFontCache.mm	2014-05-29 23:24:16 UTC (rev 169473)
+++ trunk/Source/WebCore/platform/mac/WebFontCache.mm	2014-05-29 23:41:15 UTC (rev 169474)
@@ -160,7 +160,8 @@
 + (NSFont *)internalFontWithFamily:(NSString *)desiredFamily traits:(NSFontTraitMask)desiredTraits weight:(int)desiredWeight size:(float)size
 {
 
-    if ([desiredFamily compare:@"-webkit-system-font" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
+    if ([desiredFamily compare:@"-webkit-system-font" options:NSCaseInsensitiveSearch] == NSOrderedSame
+        || [desiredFamily compare:@"-apple-system-font" options:NSCaseInsensitiveSearch] == NSOrderedSame) {
         // We ignore italic for system font.
         return (desiredWeight >= 7) ? [NSFont boldSystemFontOfSize:size] : [NSFont systemFontOfSize:size];
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to