[OSX] CJK characters styled with font-family: cursive are italicized
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Nov 2014 22:04:23 +0000 (22:04 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 4 Nov 2014 22:04:23 +0000 (22:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=138328
rdar://problem/18801907

Reviewed by Simon Fraser.

Source/WebCore:

FontCache::createFontPlatformData doesn’t set the oblique flag if
the requested font isn’t oblique, but
FontCache::systemFallbackForCharacters() does. This patch simply
adopts this behavior in both places.

Test: fast/text/font-cursive-italic-cjk.html

* platform/graphics/mac/FontCacheMac.mm:
(WebCore::FontCache::systemFallbackForCharacters):

LayoutTests:

Make sure that the text matches the output of a different codepath.

* platform/mac/fast/text/font-cursive-italic-cjk-expected.html: Added.
* platform/mac/fast/text/font-cursive-italic-cjk.html: Added.
* platform/mac/TestExpectations: Skipped test on non-Yosemite platforms.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@175579 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/mac/fast/text/font-cursive-italic-cjk-expected.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/text/font-cursive-italic-cjk.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/mac/FontCacheMac.mm

index b492586235511b604f51f9ce5d4efd9819e86a7e..a537ce189d61d62096902170ee2d1068123bcc37 100644 (file)
@@ -1,3 +1,17 @@
+2014-11-04  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [OSX] CJK characters styled with font-family: cursive are italicized
+        https://bugs.webkit.org/show_bug.cgi?id=138328
+        rdar://problem/18801907
+
+        Reviewed by Simon Fraser.
+
+        Make sure that the text matches the output of a different codepath.
+
+        * platform/mac/fast/text/font-cursive-italic-cjk-expected.html: Added.
+        * platform/mac/fast/text/font-cursive-italic-cjk.html: Added.
+        * platform/mac/TestExpectations: Skipped test on non-Yosemite platforms.
+
 2014-11-04  Benjamin Poulain  <bpoulain@apple.com>
 
         When computing the specificity of selectors, use saturated arithmetic per component
index ae25e7ceab4258833d4c4eb64fd1375bfd108de4..64d3161485dedd4850d4ef295de9e341c877ea3a 100644 (file)
@@ -1505,3 +1505,6 @@ webkit.org/b/136109 [ Yosemite ] fast/multicol/mixed-opacity-fixed-test.html  [
 webkit.org/b/137882 http/tests/media/hls/video-controls-live-stream.html [ Failure ]
 webkit.org/b/137882 http/tests/media/track-in-band-hls-metadata.html [ Failure ]
 webkit.org/b/137882 media/track/audio-track.html [ Pass Failure ]
+
+# Specific to Yosemite's font fallback
+webkit.org/b/138328 [ Mavericks MountainLion ] platform/mac/fast/text/font-cursive-italic-cjk.html [ Skip ]
diff --git a/LayoutTests/platform/mac/fast/text/font-cursive-italic-cjk-expected.html b/LayoutTests/platform/mac/fast/text/font-cursive-italic-cjk-expected.html
new file mode 100644 (file)
index 0000000..e88cddd
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+This test makes sure that CJK characters styled with font-family: cursive aren't italicized.
+<div>
+<span style="font-size: 50px;">Look at this character: </span><span style="font-family: STKaiti;">年</span>
+</div>
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/fast/text/font-cursive-italic-cjk.html b/LayoutTests/platform/mac/fast/text/font-cursive-italic-cjk.html
new file mode 100644 (file)
index 0000000..67070f1
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+</head>
+<body>
+This test makes sure that CJK characters styled with font-family: cursive aren't italicized.
+<div>
+<span style="font-size: 50px;">Look at this character: </span><span style="font-family: cursive;">年</span>
+</div>
+</body>
+</html>
index 6e2119c862c08a944442eb1daec811d259ff42b4..d67f933fdfa2246f97b2da7414f215c18004f345 100644 (file)
@@ -1,3 +1,21 @@
+2014-11-04  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [OSX] CJK characters styled with font-family: cursive are italicized
+        https://bugs.webkit.org/show_bug.cgi?id=138328
+        rdar://problem/18801907
+
+        Reviewed by Simon Fraser.
+
+        FontCache::createFontPlatformData doesn’t set the oblique flag if
+        the requested font isn’t oblique, but
+        FontCache::systemFallbackForCharacters() does. This patch simply
+        adopts this behavior in both places.
+
+        Test: fast/text/font-cursive-italic-cjk.html
+
+        * platform/graphics/mac/FontCacheMac.mm:
+        (WebCore::FontCache::systemFallbackForCharacters):
+
 2014-11-04  Benjamin Poulain  <bpoulain@apple.com>
 
         When computing the specificity of selectors, use saturated arithmetic per component
index 4de541c4a08c0ad083c582f1e1de4d7427dbe132..5d3df59e0b52e6f657b894698f19dc76e1ce7e86 100644 (file)
@@ -134,12 +134,13 @@ PassRefPtr<SimpleFontData> FontCache::systemFallbackForCharacters(const FontDesc
 
     NSFontManager *fontManager = [NSFontManager sharedFontManager];
 
-    NSFontTraitMask traits;
+    NSFontTraitMask traits = 0;
     NSInteger weight;
     CGFloat size;
 
     if (nsFont) {
-        traits = [fontManager traitsOfFont:nsFont];
+        if (description.italic())
+            traits = [fontManager traitsOfFont:nsFont];
         if (platformData.m_syntheticBold)
             traits |= NSBoldFontMask;
         if (platformData.m_syntheticOblique)