[Cocoa] Support WOFF2
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Nov 2015 03:52:16 +0000 (03:52 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Nov 2015 03:52:16 +0000 (03:52 +0000)
https://bugs.webkit.org/show_bug.cgi?id=150830

Reviewed by Zalan Bujtas.

Source/WebCore:

On platforms which support it, WebKit only needs to recognize WOFF2.

Test: fast/text/woff2.html

* platform/graphics/mac/FontCustomPlatformData.cpp:
(WebCore::FontCustomPlatformData::supportsFormat):

LayoutTests:

* platform/mac/TestExpectations: Disable the test on Operating Systems which don't support WOFF2.
* fast/text/resources/ahem.woff2: Added.
* fast/text/woff2-expected.html: Added.
* fast/text/woff2.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/text/resources/ahem.woff2 [new file with mode: 0755]
LayoutTests/fast/text/woff2-expected.html [new file with mode: 0644]
LayoutTests/fast/text/woff2.html [new file with mode: 0644]
LayoutTests/platform/mac/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp

index ce7be86880323d24bc97dbe35b9824e04d7b5780..85bd13e4f880ecc43900672c7a6d1243204fae6c 100644 (file)
@@ -1,3 +1,15 @@
+2015-11-02  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [Cocoa] Support WOFF2
+        https://bugs.webkit.org/show_bug.cgi?id=150830
+
+        Reviewed by Zalan Bujtas.
+
+        * platform/mac/TestExpectations: Disable the test on Operating Systems which don't support WOFF2.
+        * fast/text/resources/ahem.woff2: Added.
+        * fast/text/woff2-expected.html: Added.
+        * fast/text/woff2.html: Added.
+
 2015-11-02  Nan Wang  <n_wang@apple.com>
 
         AX: Add support for ARIA 1.1 attribute 'aria-modal' for dialog and alertdialog
diff --git a/LayoutTests/fast/text/resources/ahem.woff2 b/LayoutTests/fast/text/resources/ahem.woff2
new file mode 100755 (executable)
index 0000000..b7451c8
Binary files /dev/null and b/LayoutTests/fast/text/resources/ahem.woff2 differ
diff --git a/LayoutTests/fast/text/woff2-expected.html b/LayoutTests/fast/text/woff2-expected.html
new file mode 100644 (file)
index 0000000..006429f
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+    font-family: "webfont";
+    src: url("../../resources/Ahem.ttf") format("truetype");
+}
+#test {
+    font: 40px "webfont";
+}
+</style>
+</head>
+<body>
+This test makes sure WOFF2 renders as expected. The test passes if you see a horizontal black rectangle below.
+<div id="test">Hello</div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/woff2.html b/LayoutTests/fast/text/woff2.html
new file mode 100644 (file)
index 0000000..5319d57
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+@font-face {
+    font-family: "webfont";
+    src: url("resources/ahem.woff2") format("woff2");
+}
+#test {
+    font: 40px "webfont";
+}
+</style>
+</head>
+<body>
+This test makes sure WOFF2 renders as expected. The test passes if you see a horizontal black rectangle below.
+<div id="test">Hello</div>
+</body>
+</html>
index eee4950758d0472a05c766a20f38850db7667ee5..f3110150d71d63a026236debd41f8fc63fb5c056 100644 (file)
@@ -1354,4 +1354,7 @@ webkit.org/b/147933 streams/reference-implementation/count-queuing-strategy.html
 webkit.org/b/147933 streams/reference-implementation/writable-stream-abort.html [ Pass Failure ]
 
 webkit.org/b/150806 imported/w3c/web-platform-tests/XMLHttpRequest/send-timeout-events.htm [ Pass Failure ]
-webkit.org/b/150823 imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-chunked-trailer.htm [ Pass Failure ]
\ No newline at end of file
+webkit.org/b/150823 imported/w3c/web-platform-tests/XMLHttpRequest/getresponseheader-chunked-trailer.htm [ Pass Failure ]
+
+# WOFF2 is only supported on certain Operating Systems.
+webkit.org/b/150830 [ Mavericks Yosemite ElCapitan ] fast/text/woff2.html [ Failure ]
index 61dc4cd200f081d34e8fdb3baff986cebb97dbe7..3ca7c12845e864b34ef758606fc4d926401bf89f 100644 (file)
@@ -1,3 +1,17 @@
+2015-11-02  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [Cocoa] Support WOFF2
+        https://bugs.webkit.org/show_bug.cgi?id=150830
+
+        Reviewed by Zalan Bujtas.
+
+        On platforms which support it, WebKit only needs to recognize WOFF2.
+
+        Test: fast/text/woff2.html
+
+        * platform/graphics/mac/FontCustomPlatformData.cpp:
+        (WebCore::FontCustomPlatformData::supportsFormat):
+
 2015-11-02  Nan Wang  <n_wang@apple.com>
 
         AX: Add support for ARIA 1.1 attribute 'aria-modal' for dialog and alertdialog
index 84c9f9c97d9cec6f49c2264d7c78ca2ea94bc04f..62ffc7f3245ace8dd2dcb77a2f3e4b06c194135f 100644 (file)
@@ -73,7 +73,11 @@ std::unique_ptr<FontCustomPlatformData> createFontCustomPlatformData(SharedBuffe
 
 bool FontCustomPlatformData::supportsFormat(const String& format)
 {
-    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") || equalIgnoringCase(format, "woff");
+    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype")
+#if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200)
+        || equalIgnoringCase(format, "woff2")
+#endif
+    || equalIgnoringCase(format, "woff");
 }
 
 }