[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

mitz at apple.com mitz at apple.com
Wed Dec 22 11:37:54 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 41030b964cc9a9ddbb12ff033cc011fe53b02364
Author: mitz at apple.com <mitz at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Aug 1 05:04:57 2010 +0000

    <rdar://problem/8234766> Add WOFF support for @font-face
    https://bugs.webkit.org/show_bug.cgi?id=31302
    
    Reviewed by Darin Adler.
    
    WebCore:
    
    * WebCore.vcproj/WebCore.vcproj: Added WOFFFileFormat.{cpp,h}.
    * WebCore.vcproj/WebCoreCommon.vsprops: Added $(WebKitLibraries)\include\zlib to the header search path.
    * WebCore.xcodeproj/project.pbxproj: Added WOFFFileFormat.{cpp,h} and linking against libz.
    * css/CSSFontFaceSrcValue.cpp:
    (WebCore::CSSFontFaceSrcValue::isSupportedFormat): Replaced hard-coded list of supported formats with
    call to FontCustomPlatformData::supportsFormat().
    * platform/graphics/WOFFFileFormat.cpp: Added.
    (WebCore::isWOFF): Checks if the buffer has the WOFF signature.
    (WebCore::convertWOFFToSfnt): Extracts the sfnt payload of a WOFF package.
    * platform/graphics/WOFFFileFormat.h: Added.
    * platform/graphics/cairo/FontCustomPlatformData.cpp:
    (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype.
    * platform/graphics/cairo/FontCustomPlatformData.h:
    * platform/graphics/chromium/FontCustomPlatformData.cpp:
    (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype,
    and also for woff if the OpenType sanitizer is enabled.
    * platform/graphics/chromium/FontCustomPlatformData.h:
    * platform/graphics/gtk/FontCustomPlatformDataPango.cpp:
    (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns false.
    * platform/graphics/haiku/FontCustomPlatformData.cpp:
    (WebCore::FontCustomPlatformData::supportsFormat): Ditto.
    * platform/graphics/haiku/FontCustomPlatformData.h:
    * platform/graphics/mac/FontCustomPlatformData.cpp:
    (WebCore::freeSfntData):
    (WebCore::createFontCustomPlatformData): If the OpenType font sanitizer is not enabled, use convertWOFFToSfnt().
    (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype, opentype and woff.
    * platform/graphics/mac/FontCustomPlatformData.h:
    * platform/graphics/qt/FontCustomPlatformData.h:
    * platform/graphics/qt/FontCustomPlatformDataQt.cpp:
    (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype.
    * platform/graphics/win/FontCustomPlatformData.cpp:
    (WebCore::createFontCustomPlatformData): If the OpenType font sanitizer is not enabled, use convertWOFFToSfnt().
    (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype, opentype and woff.
    * platform/graphics/win/FontCustomPlatformData.h:
    * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
    (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype.
    * platform/graphics/win/FontCustomPlatformDataCairo.h:
    * platform/graphics/wince/FontCustomPlatformData.cpp:
    (WebCore::FontCustomPlatformData::supportsFormat): Ditto.
    * platform/graphics/wince/FontCustomPlatformData.h:
    
    LayoutTests:
    
    * platform/mac/Skipped: Enabled fast/css/font-face-woff.html.
    * platform/mac/fast/css/font-face-woff-expected.checksum: Added.
    * platform/mac/fast/css/font-face-woff-expected.png: Added.
    * platform/mac/fast/css/font-face-woff-expected.txt: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64434 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 0041675..2210ab8 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-07-31  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Darin Adler.
+
+        <rdar://problem/8234766> Add WOFF support for @font-face
+        https://bugs.webkit.org/show_bug.cgi?id=31302
+
+        * platform/mac/Skipped: Enabled fast/css/font-face-woff.html.
+        * platform/mac/fast/css/font-face-woff-expected.checksum: Added.
+        * platform/mac/fast/css/font-face-woff-expected.png: Added.
+        * platform/mac/fast/css/font-face-woff-expected.txt: Added.
+
 2010-07-31  Sam Weinig  <sam at webkit.org>
 
         Rubber-stamped by Dan Bernstein.
diff --git a/LayoutTests/platform/mac/Skipped b/LayoutTests/platform/mac/Skipped
index 18c6e95..197d497 100644
--- a/LayoutTests/platform/mac/Skipped
+++ b/LayoutTests/platform/mac/Skipped
@@ -156,9 +156,6 @@ fast/events/ondrop-text-html.html
 # https://bugs.webkit.org/show_bug.cgi?id=33812
 fast/dom/icon-url-property.html
 
-# Doesn't support WOFF yet.
-fast/css/font-face-woff.html
-
 # EventSendingController does not send events on areas outside the WebView.
 scrollbars/scrollbar-click-does-not-blur-content.html
 
diff --git a/LayoutTests/platform/chromium-mac/fast/css/font-face-woff-expected.checksum b/LayoutTests/platform/mac/fast/css/font-face-woff-expected.checksum
similarity index 100%
copy from LayoutTests/platform/chromium-mac/fast/css/font-face-woff-expected.checksum
copy to LayoutTests/platform/mac/fast/css/font-face-woff-expected.checksum
diff --git a/LayoutTests/platform/mac/fast/css/font-face-woff-expected.png b/LayoutTests/platform/mac/fast/css/font-face-woff-expected.png
new file mode 100644
index 0000000..1894604
Binary files /dev/null and b/LayoutTests/platform/mac/fast/css/font-face-woff-expected.png differ
diff --git a/LayoutTests/platform/chromium-mac/fast/css/font-face-woff-expected.txt b/LayoutTests/platform/mac/fast/css/font-face-woff-expected.txt
similarity index 100%
copy from LayoutTests/platform/chromium-mac/fast/css/font-face-woff-expected.txt
copy to LayoutTests/platform/mac/fast/css/font-face-woff-expected.txt
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4135443..a2f3827 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,51 @@
+2010-07-31  Dan Bernstein  <mitz at apple.com>
+
+        Reviewed by Darin Adler.
+
+        <rdar://problem/8234766> Add WOFF support for @font-face
+        https://bugs.webkit.org/show_bug.cgi?id=31302
+
+        * WebCore.vcproj/WebCore.vcproj: Added WOFFFileFormat.{cpp,h}.
+        * WebCore.vcproj/WebCoreCommon.vsprops: Added $(WebKitLibraries)\include\zlib to the header search path.
+        * WebCore.xcodeproj/project.pbxproj: Added WOFFFileFormat.{cpp,h} and linking against libz.
+        * css/CSSFontFaceSrcValue.cpp:
+        (WebCore::CSSFontFaceSrcValue::isSupportedFormat): Replaced hard-coded list of supported formats with
+        call to FontCustomPlatformData::supportsFormat().
+        * platform/graphics/WOFFFileFormat.cpp: Added.
+        (WebCore::isWOFF): Checks if the buffer has the WOFF signature.
+        (WebCore::convertWOFFToSfnt): Extracts the sfnt payload of a WOFF package.
+        * platform/graphics/WOFFFileFormat.h: Added.
+        * platform/graphics/cairo/FontCustomPlatformData.cpp:
+        (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype.
+        * platform/graphics/cairo/FontCustomPlatformData.h:
+        * platform/graphics/chromium/FontCustomPlatformData.cpp:
+        (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype,
+        and also for woff if the OpenType sanitizer is enabled.
+        * platform/graphics/chromium/FontCustomPlatformData.h:
+        * platform/graphics/gtk/FontCustomPlatformDataPango.cpp:
+        (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns false.
+        * platform/graphics/haiku/FontCustomPlatformData.cpp:
+        (WebCore::FontCustomPlatformData::supportsFormat): Ditto.
+        * platform/graphics/haiku/FontCustomPlatformData.h:
+        * platform/graphics/mac/FontCustomPlatformData.cpp:
+        (WebCore::freeSfntData):
+        (WebCore::createFontCustomPlatformData): If the OpenType font sanitizer is not enabled, use convertWOFFToSfnt().
+        (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype, opentype and woff.
+        * platform/graphics/mac/FontCustomPlatformData.h:
+        * platform/graphics/qt/FontCustomPlatformData.h:
+        * platform/graphics/qt/FontCustomPlatformDataQt.cpp:
+        (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype.
+        * platform/graphics/win/FontCustomPlatformData.cpp:
+        (WebCore::createFontCustomPlatformData): If the OpenType font sanitizer is not enabled, use convertWOFFToSfnt().
+        (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype, opentype and woff.
+        * platform/graphics/win/FontCustomPlatformData.h:
+        * platform/graphics/win/FontCustomPlatformDataCairo.cpp:
+        (WebCore::FontCustomPlatformData::supportsFormat): Added. Returns true for truetype and opentype.
+        * platform/graphics/win/FontCustomPlatformDataCairo.h:
+        * platform/graphics/wince/FontCustomPlatformData.cpp:
+        (WebCore::FontCustomPlatformData::supportsFormat): Ditto.
+        * platform/graphics/wince/FontCustomPlatformData.h:
+
 2010-07-31  Ryosuke Niwa  <rniwa at webkit.org>
 
         Reviewed by Ojan Vafai.
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 006a70e..817746f 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -24360,6 +24360,14 @@
 					>
 				</File>
 				<File
+					RelativePath="..\platform\graphics\WOFFFileFormat.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\platform\graphics\WOFFFileFormat.h"
+					>
+				</File>
+				<File
 					RelativePath="..\platform\graphics\UnitBezier.h"
 					>
 				</File>
diff --git a/WebCore/WebCore.vcproj/WebCoreCommon.vsprops b/WebCore/WebCore.vcproj/WebCoreCommon.vsprops
index 537e129..25fa58e 100644
--- a/WebCore/WebCore.vcproj/WebCoreCommon.vsprops
+++ b/WebCore/WebCore.vcproj/WebCoreCommon.vsprops
@@ -7,7 +7,7 @@
 	>
 	<Tool
 		Name="VCCLCompilerTool"
-		AdditionalIncludeDirectories="&quot;$(ProjectDir)..&quot;;&quot;$(ProjectDir)..\accessibility&quot;;&quot;$(ProjectDir)..\accessibility\win&quot;;&quot;$(ProjectDir)..\bridge&quot;;&quot;$(ProjectDir)..\bridge\c&quot;;&quot;$(ProjectDir)..\bridge\jsc&quot;;&quot;$(ProjectDir)..\css&quot;;&quot;$(ProjectDir)..\editing&quot;;&quot;$(ProjectDir)..\rendering&quot;;&quot;$(ProjectDir)..\rendering\style&quot;;&quot;$(ProjectDir)..\bindings&quot;;&quot;$(ProjectDir)..\bindings\generic&quot;;&quot;$(ProjectDir)..\bindings\js&quot;;&quot;$(ProjectDir)..\dom&quot;;&quot;$(ProjectDir)..\dom\default&quot;;&quot;$(ProjectDir)..\history&quot;;&quot;$(ProjectDir)..\html&quot;;&quot;$(ProjectDir)..\html\canvas&quot;;&quot;$(ProjectDir)..\inspector&quot;;&quot;$(ProjectDir)..\loader&quot;;&quot;$(ProjectDir)..\loader\appcache&quot;;&quot;$(ProjectDir)..\loader\archive&quot;;&quot;$(ProjectDir)..\loader\archive\cf&quot;;&quot;$(ProjectDir)..\loader\icon&quot;;&quot;$(ProjectDir)..\notifications&quot;;&quot;$(ProjectDir)..\page&quot;;&quot;$(ProjectDir)..\page\animation&quot;;&quot;$(ProjectDir)..\page\win&quot;;&quot;$(ProjectDir)..\platform&quot;;&quot;$(ProjectDir)..\platform\animation&quot;;&quot;$(ProjectDir)..\platform\mock&quot;;&quot;$(ProjectDir)..\platform\sql&quot;;&quot;$(ProjectDir)..\platform\win&quot;;&quot;$(ProjectDir)..\platform\network&quot;;&quot;$(ProjectDir)..\platform\network\win&quot;;&quot;$(ProjectDir)..\platform\cf&quot;;&quot;$(ProjectDir)..\platform\graphics&quot;;&quot;$(ProjectDir)..\platform\graphics\filters&quot;;&quot;$(ProjectDir)..\platform\graphics\opentype&quot;;&quot;$(ProjectDir)..\platform\graphics\transforms&quot;;&quot;$(ProjectDir)..\platform\text&quot;;&quot;$(ProjectDir)..\platform\text\transcoder&quot;;&quot;$(ProjectDir)..\platform\graphics\win&quot;;&quot;$(ProjectDir)..\xml&quot;;&quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources&quot;;&quot;$(ProjectDir)..\plugins&quot;;&quot;$(ProjectDir)..\plugins\win&quot;;&quot;$(ProjectDir)..\svg\animation&quot;;&quot;$(ProjectDir)..\svg\graphics&quot;;&quot;$(ProjectDir)..\svg\graphics\filters&quot;;&quot;$(ProjectDir)..\svg&quot;;&quot;$(ProjectDir)..\wml&quot;;&quot;$(ProjectDir)..\storage&quot;;&quot;$(ProjectDir)..\websockets&quot;;&quot;$(ProjectDir)..\workers&quot;;&quot;$(WebKitOutputDir)\include&quot;;&quot;$(WebKitOutputDir)\include\private&quot;;&quot;$(WebKitOutputDir)\include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\include\private\JavaScriptCore&quot;;&quot;$(ProjectDir)..\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;;&quot;$(WebKitLibrariesDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitLibrariesDir)\include\sqlite&quot;;&quot;$(WebKitLibrariesDir)\include\JavaScriptCore&quot;"
+		AdditionalIncludeDirectories="&quot;$(ProjectDir)..&quot;;&quot;$(ProjectDir)..\accessibility&quot;;&quot;$(ProjectDir)..\accessibility\win&quot;;&quot;$(ProjectDir)..\bridge&quot;;&quot;$(ProjectDir)..\bridge\c&quot;;&quot;$(ProjectDir)..\bridge\jsc&quot;;&quot;$(ProjectDir)..\css&quot;;&quot;$(ProjectDir)..\editing&quot;;&quot;$(ProjectDir)..\rendering&quot;;&quot;$(ProjectDir)..\rendering\style&quot;;&quot;$(ProjectDir)..\bindings&quot;;&quot;$(ProjectDir)..\bindings\generic&quot;;&quot;$(ProjectDir)..\bindings\js&quot;;&quot;$(ProjectDir)..\dom&quot;;&quot;$(ProjectDir)..\dom\default&quot;;&quot;$(ProjectDir)..\history&quot;;&quot;$(ProjectDir)..\html&quot;;&quot;$(ProjectDir)..\html\canvas&quot;;&quot;$(ProjectDir)..\inspector&quot;;&quot;$(ProjectDir)..\loader&quot;;&quot;$(ProjectDir)..\loader\appcache&quot;;&quot;$(ProjectDir)..\loader\archive&quot;;&quot;$(ProjectDir)..\loader\archive\cf&quot;;&quot;$(ProjectDir)..\loader\icon&quot;;&quot;$(ProjectDir)..\notifications&quot;;&quot;$(ProjectDir)..\page&quot;;&quot;$(ProjectDir)..\page\animation&quot;;&quot;$(ProjectDir)..\page\win&quot;;&quot;$(ProjectDir)..\platform&quot;;&quot;$(ProjectDir)..\platform\animation&quot;;&quot;$(ProjectDir)..\platform\mock&quot;;&quot;$(ProjectDir)..\platform\sql&quot;;&quot;$(ProjectDir)..\platform\win&quot;;&quot;$(ProjectDir)..\platform\network&quot;;&quot;$(ProjectDir)..\platform\network\win&quot;;&quot;$(ProjectDir)..\platform\cf&quot;;&quot;$(ProjectDir)..\platform\graphics&quot;;&quot;$(ProjectDir)..\platform\graphics\filters&quot;;&quot;$(ProjectDir)..\platform\graphics\opentype&quot;;&quot;$(ProjectDir)..\platform\graphics\transforms&quot;;&quot;$(ProjectDir)..\platform\text&quot;;&quot;$(ProjectDir)..\platform\text\transcoder&quot;;&quot;$(ProjectDir)..\platform\graphics\win&quot;;&quot;$(ProjectDir)..\xml&quot;;&quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources&quot;;&quot;$(ProjectDir)..\plugins&quot;;&quot;$(ProjectDir)..\plugins\win&quot;;&quot;$(ProjectDir)..\svg\animation&quot;;&quot;$(ProjectDir)..\svg\graphics&quot;;&quot;$(ProjectDir)..\svg\graphics\filters&quot;;&quot;$(ProjectDir)..\svg&quot;;&quot;$(ProjectDir)..\wml&quot;;&quot;$(ProjectDir)..\storage&quot;;&quot;$(ProjectDir)..\websockets&quot;;&quot;$(ProjectDir)..\workers&quot;;&quot;$(WebKitOutputDir)\include&quot;;&quot;$(WebKitOutputDir)\include\private&quot;;&quot;$(WebKitOutputDir)\include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\include\private\JavaScriptCore&quot;;&quot;$(ProjectDir)..\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;;&quot;$(WebKitLibrariesDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitLibrariesDir)\include\sqlite&quot;;&quot;$(WebKitLibrariesDir)\include\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\zlib&quot;"
 		PreprocessorDefinitions="__WIN32__;DISABLE_3D_RENDERING;WEBCORE_CONTEXT_MENUS"
 		UsePrecompiledHeader="2"
 		PrecompiledHeaderThrough="WebCorePrefix.h"
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 602c296..cb02ab3 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -783,6 +783,9 @@
 		3784C34B0E11AA34007D8D48 /* FontTraitsMask.h in Headers */ = {isa = PBXBuildFile; fileRef = 3784C34A0E11AA34007D8D48 /* FontTraitsMask.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		37919C230B7D188600A56998 /* PositionIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37919C210B7D188600A56998 /* PositionIterator.cpp */; };
 		37919C240B7D188600A56998 /* PositionIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 37919C220B7D188600A56998 /* PositionIterator.h */; settings = {ATTRIBUTES = (); }; };
+		379919961200DDF400EA041C /* WOFFFileFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 379919941200DDF400EA041C /* WOFFFileFormat.cpp */; };
+		379919971200DDF400EA041C /* WOFFFileFormat.h in Headers */ = {isa = PBXBuildFile; fileRef = 379919951200DDF400EA041C /* WOFFFileFormat.h */; };
+		379919B21200DE5000EA041C /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 379919B11200DE5000EA041C /* libz.dylib */; };
 		37ACCE420DA2980F0089E602 /* FontRenderingMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 37ACCE410DA2980F0089E602 /* FontRenderingMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		37ACCF690DA414E70089E602 /* FontDescription.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37ACCE620DA2AA960089E602 /* FontDescription.cpp */; };
 		37C2360B1097EDED00EF9F72 /* FontComplexTextMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37C2360A1097EDED00EF9F72 /* FontComplexTextMac.cpp */; };
@@ -6523,6 +6526,9 @@
 		3784C34A0E11AA34007D8D48 /* FontTraitsMask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontTraitsMask.h; sourceTree = "<group>"; };
 		37919C210B7D188600A56998 /* PositionIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PositionIterator.cpp; sourceTree = "<group>"; };
 		37919C220B7D188600A56998 /* PositionIterator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PositionIterator.h; sourceTree = "<group>"; };
+		379919941200DDF400EA041C /* WOFFFileFormat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WOFFFileFormat.cpp; sourceTree = "<group>"; };
+		379919951200DDF400EA041C /* WOFFFileFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WOFFFileFormat.h; sourceTree = "<group>"; };
+		379919B11200DE5000EA041C /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; };
 		37ACCE410DA2980F0089E602 /* FontRenderingMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontRenderingMode.h; sourceTree = "<group>"; };
 		37ACCE620DA2AA960089E602 /* FontDescription.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontDescription.cpp; sourceTree = "<group>"; };
 		37C2360A1097EDED00EF9F72 /* FontComplexTextMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontComplexTextMac.cpp; sourceTree = "<group>"; };
@@ -11071,6 +11077,7 @@
 				49C7BA791042EFAE0009D447 /* OpenGL.framework in Frameworks */,
 				A88AD52F09524B92001DD196 /* QuartzCore.framework in Frameworks */,
 				1A7FA7CC0DDA4B770028F8A5 /* SystemConfiguration.framework in Frameworks */,
+				379919B21200DE5000EA041C /* libz.dylib in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -11137,6 +11144,7 @@
 				93F1D31A0558CC5C00821BC0 /* libicucore.dylib */,
 				1CFAE3220A6D6A3F0032593D /* libobjc.dylib */,
 				DD763BB10992C2C900740B8E /* libxml2.dylib */,
+				379919B11200DE5000EA041C /* libz.dylib */,
 				49C7BA781042EFAE0009D447 /* OpenGL.framework */,
 				A85D7A2F0879EBA9006A9172 /* QuartzCore.framework */,
 				1A7FA7CB0DDA4B770028F8A5 /* SystemConfiguration.framework */,
@@ -15625,6 +15633,8 @@
 				E4AFCFA40DAF29A300F5F55C /* UnitBezier.h */,
 				939B02EC0EA2DBC400C54570 /* WidthIterator.cpp */,
 				939B02ED0EA2DBC400C54570 /* WidthIterator.h */,
+				379919941200DDF400EA041C /* WOFFFileFormat.cpp */,
+				379919951200DDF400EA041C /* WOFFFileFormat.h */,
 			);
 			path = graphics;
 			sourceTree = "<group>";
@@ -19983,6 +19993,7 @@
 				C572EE1F1201C9BC007D8F82 /* JSIDBIndex.h in Headers */,
 				D39D006D11F8E308006041F2 /* PopupMenuMac.h in Headers */,
 				D39D009D11F907E6006041F2 /* SearchPopupMenuMac.h in Headers */,
+				379919971200DDF400EA041C /* WOFFFileFormat.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -22384,6 +22395,7 @@
 				C572EE0A1201C736007D8F82 /* IDBIndex.cpp in Sources */,
 				C572EE0D1201C736007D8F82 /* IDBIndexBackendImpl.cpp in Sources */,
 				C572EE1E1201C9BC007D8F82 /* JSIDBIndex.cpp in Sources */,
+				379919961200DDF400EA041C /* WOFFFileFormat.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebCore/css/CSSFontFaceSrcValue.cpp b/WebCore/css/CSSFontFaceSrcValue.cpp
index 21eea04..5b204d7 100644
--- a/WebCore/css/CSSFontFaceSrcValue.cpp
+++ b/WebCore/css/CSSFontFaceSrcValue.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2010 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "CSSFontFaceSrcValue.h"
 #include "CSSStyleSheet.h"
+#include "FontCustomPlatformData.h"
 #include "Node.h"
 
 namespace WebCore {
@@ -48,10 +49,7 @@ bool CSSFontFaceSrcValue::isSupportedFormat() const
         return true;
     }
 
-    return equalIgnoringCase(m_format, "truetype") || equalIgnoringCase(m_format, "opentype")
-#if ENABLE(OPENTYPE_SANITIZER)
-           || equalIgnoringCase(m_format, "woff")
-#endif
+    return FontCustomPlatformData::supportsFormat(m_format)
 #if ENABLE(SVG_FONTS)
            || isSVGFontFaceSrc()
 #endif
diff --git a/WebCore/platform/graphics/WOFFFileFormat.cpp b/WebCore/platform/graphics/WOFFFileFormat.cpp
new file mode 100644
index 0000000..8342428
--- /dev/null
+++ b/WebCore/platform/graphics/WOFFFileFormat.cpp
@@ -0,0 +1,252 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WOFFFileFormat.h"
+
+#if !ENABLE(OPENTYPE_SANITIZER)
+
+#include "SharedBuffer.h"
+#include "SoftLinking.h"
+#include <zlib.h>
+
+#if PLATFORM(WIN)
+
+SOFT_LINK_LIBRARY(zlib1);
+SOFT_LINK(zlib1, uncompress, int, __cdecl, (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen), (dest, destLen, source, sourceLen));
+
+#if CPU(BIG_ENDIAN)
+#define ntohs(x) ((uint16_t)(x))
+#define htons(x) ((uint16_t)(x))
+#define ntohl(x) ((uint32_t)(x))
+#define htonl(x) ((uint32_t)(x))
+#elif CPU(MIDDLE_ENDIAN)
+#define ntohs(x) ((unit16_t)(x))
+#define htons(x) ((uint16_t)(x))
+#define ntohl(x) ((uint32_t)((((uint32_t)(x) & 0xffff0000) >> 16) | (((uint32_t)(x) & 0xffff) << 16))
+#define htonl(x) ntohl(x)
+#else
+#define ntohs(x) ((uint16_t)((((uint16_t)(x) & 0xff00) >> 8) | (((uint16_t)(x) & 0x00ff) << 8)))
+#define htons(x) ntohs(x)
+#define ntohl(x) ((uint32_t)((((uint32_t)(x) & 0xff000000) >> 24) | (((uint32_t)(x) & 0x00ff0000) >>  8) | \
+                 (((uint32_t)(x) & 0x0000ff00) <<  8) | (((uint32_t)(x) & 0x000000ff) << 24)))
+#define htonl(x) ntohl(x)
+#endif
+
+#endif // PLATFORM(WIN)
+
+namespace WebCore {
+
+static bool readUInt32(SharedBuffer* buffer, size_t& offset, uint32_t& value)
+{
+    ASSERT_ARG(offset, offset <= buffer->size());
+    if (buffer->size() - offset < sizeof(value))
+        return false;
+
+    value = ntohl(*reinterpret_cast<const uint32_t*>(buffer->data() + offset));
+    offset += sizeof(value);
+
+    return true;
+}
+
+static bool readUInt16(SharedBuffer* buffer, size_t& offset, uint16_t& value)
+{
+    ASSERT_ARG(offset, offset <= buffer->size());
+    if (buffer->size() - offset < sizeof(value))
+        return false;
+
+    value = ntohs(*reinterpret_cast<const uint16_t*>(buffer->data() + offset));
+    offset += sizeof(value);
+
+    return true;
+}
+
+static bool writeUInt32(Vector<char>& vector, uint32_t value)
+{
+    uint32_t bigEndianValue = htonl(value);
+    return vector.tryAppend(reinterpret_cast<char*>(&bigEndianValue), sizeof(bigEndianValue));
+}
+
+static bool writeUInt16(Vector<char>& vector, uint16_t value)
+{
+    uint16_t bigEndianValue = htons(value);
+    return vector.tryAppend(reinterpret_cast<char*>(&bigEndianValue), sizeof(bigEndianValue));
+}
+
+static const uint32_t woffSignature = 0x774f4646; /* 'wOFF' */
+
+bool isWOFF(SharedBuffer* buffer)
+{
+    size_t offset = 0;
+    uint32_t signature;
+
+    return readUInt32(buffer, offset, signature) && signature == woffSignature;
+}
+
+bool convertWOFFToSfnt(SharedBuffer* woff, Vector<char>& sfnt)
+{
+#if PLATFORM(WINDOWS)
+    if (!zlib1Library())
+        return false;
+#endif
+    ASSERT_ARG(sfnt, sfnt.isEmpty());
+
+    size_t offset = 0;
+
+    // Read the WOFF header.
+    uint32_t signature;
+    if (!readUInt32(woff, offset, signature) || signature != woffSignature) {
+        ASSERT_NOT_REACHED();
+        return false;
+    }
+
+    uint32_t flavor;
+    if (!readUInt32(woff, offset, flavor))
+        return false;
+
+    uint32_t length;
+    if (!readUInt32(woff, offset, length) || length != woff->size())
+        return false;
+
+    uint16_t numTables;
+    if (!readUInt16(woff, offset, numTables))
+        return false;
+
+    if (!numTables || numTables > 0x0fff)
+        return false;
+
+    uint16_t reserved;
+    if (!readUInt16(woff, offset, reserved) || reserved)
+        return false;
+
+    uint32_t totalSfntSize;
+    if (!readUInt32(woff, offset, totalSfntSize))
+        return false;
+
+    if (woff->size() - offset < sizeof(uint16_t) + sizeof(uint16_t) + sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t) + sizeof(uint32_t))
+        return false;
+
+    offset += sizeof(uint16_t); // majorVersion
+    offset += sizeof(uint16_t); // minorVersion
+    offset += sizeof(uint32_t); // metaOffset
+    offset += sizeof(uint32_t); // metaLength
+    offset += sizeof(uint32_t); // metaOrigLength
+    offset += sizeof(uint32_t); // privOffset
+    offset += sizeof(uint32_t); // privLength
+
+    // Check if the WOFF can supply as many tables as it claims it has.
+    if (woff->size() - offset < numTables * 5 * sizeof(uint32_t))
+        return false;
+
+    // Write the sfnt offset subtable.
+    uint16_t entrySelector = 0;
+    uint16_t searchRange = 1;
+    while (searchRange < numTables >> 1) {
+        entrySelector++;
+        searchRange <<= 1;
+    }
+    searchRange <<= 4;
+    uint16_t rangeShift = (numTables << 4) - searchRange;
+
+    if (!writeUInt32(sfnt, flavor)
+        || !writeUInt16(sfnt, numTables)
+        || !writeUInt16(sfnt, searchRange)
+        || !writeUInt16(sfnt, entrySelector)
+        || !writeUInt16(sfnt, rangeShift))
+        return false;
+
+    if (sfnt.size() > totalSfntSize)
+        return false;
+
+    if (totalSfntSize - sfnt.size() < numTables * 4 * sizeof(uint32_t))
+        return false;
+
+    size_t sfntTableDirectoryCursor = sfnt.size();
+    sfnt.grow(sfnt.size() + numTables * 4 * sizeof(uint32_t));
+
+    // Process tables.
+    for (uint16_t i = 0; i < numTables; ++i) {
+        // Read a WOFF table directory entry.
+        uint32_t tableTag;
+        if (!readUInt32(woff, offset, tableTag))
+            return false;
+
+        uint32_t tableOffset;
+        if (!readUInt32(woff, offset, tableOffset))
+            return false;
+
+        uint32_t tableCompLength;
+        if (!readUInt32(woff, offset, tableCompLength))
+            return false;
+
+        if (tableOffset > woff->size() || tableCompLength > woff->size() - tableOffset)
+            return false;
+
+        uint32_t tableOrigLength;
+        if (!readUInt32(woff, offset, tableOrigLength) || tableCompLength > tableOrigLength)
+            return false;
+
+        if (tableOrigLength > totalSfntSize || sfnt.size() > totalSfntSize - tableOrigLength)
+            return false;
+
+        uint32_t tableOrigChecksum;
+        if (!readUInt32(woff, offset, tableOrigChecksum))
+            return false;
+
+        // Write an sfnt table directory entry.
+        uint32_t* sfntTableDirectoryPtr = reinterpret_cast<uint32_t*>(sfnt.data() + sfntTableDirectoryCursor);
+        *sfntTableDirectoryPtr++ = htonl(tableTag);
+        *sfntTableDirectoryPtr++ = htonl(tableOrigChecksum);
+        *sfntTableDirectoryPtr++ = htonl(sfnt.size());
+        *sfntTableDirectoryPtr++ = htonl(tableOrigLength);
+        sfntTableDirectoryCursor += 4 * sizeof(uint32_t);
+
+        if (tableCompLength == tableOrigLength) {
+            // The table is not compressed.
+            if (!sfnt.tryAppend(woff->data() + tableOffset, tableCompLength))
+                return false;
+        } else {
+            uLongf destLen = tableOrigLength;
+            if (!sfnt.tryReserveCapacity(sfnt.size() + tableOrigLength))
+                return false;
+            Bytef* dest = reinterpret_cast<Bytef*>(sfnt.end());
+            sfnt.grow(sfnt.size() + tableOrigLength);
+            if (uncompress(dest, &destLen, reinterpret_cast<const Bytef*>(woff->data() + tableOffset), tableCompLength) != Z_OK)
+                return false;
+            if (destLen != tableOrigLength)
+                return false;
+        }
+
+        // Pad to a multiple of 4 bytes.
+        while (sfnt.size() % 4)
+            sfnt.append(0);
+    }
+
+    return sfnt.size() == totalSfntSize;
+}
+
+#endif // !ENABLE(OPENTYPE_SANITIZER)
+
+} // namespace WebCore
diff --git a/WebCore/platform/graphics/WOFFFileFormat.h b/WebCore/platform/graphics/WOFFFileFormat.h
new file mode 100644
index 0000000..9351d0e
--- /dev/null
+++ b/WebCore/platform/graphics/WOFFFileFormat.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WOFFFileFormat_h
+#define WOFFFileFormat_h
+
+#if !ENABLE(OPENTYPE_SANITIZER)
+
+#include <wtf/Vector.h>
+
+namespace WebCore {
+
+class SharedBuffer;
+
+// Returns whether the buffer is a WOFF file.
+bool isWOFF(SharedBuffer* buffer);
+
+// Returns false if the WOFF file woff is invalid or could not be converted to sfnt (for example,
+// if conversion ran out of memory). Otherwise returns true and writes the sfnt payload into sfnt.
+bool convertWOFFToSfnt(SharedBuffer* woff, Vector<char>& sfnt);
+
+} // namespace WebCore
+
+#endif // !ENABLE(OPENTYPE_SANITIZER)
+
+#endif // WOFFFileFormat_h
diff --git a/WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp b/WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp
index bb2e064..6b76c2a 100644
--- a/WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp
+++ b/WebCore/platform/graphics/cairo/FontCustomPlatformData.cpp
@@ -21,8 +21,8 @@
 #include "config.h"
 #include "FontCustomPlatformData.h"
 
-#include "SharedBuffer.h"
 #include "FontPlatformData.h"
+#include "SharedBuffer.h"
 
 namespace WebCore {
 
@@ -70,4 +70,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
     return new FontCustomPlatformData(fontFace);
 }
 
+bool FontCustomPlatformData::supportsFormat(const String& format)
+{
+    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype");
+}
+
 }
diff --git a/WebCore/platform/graphics/cairo/FontCustomPlatformData.h b/WebCore/platform/graphics/cairo/FontCustomPlatformData.h
index b36cc79..2816427 100644
--- a/WebCore/platform/graphics/cairo/FontCustomPlatformData.h
+++ b/WebCore/platform/graphics/cairo/FontCustomPlatformData.h
@@ -30,6 +30,7 @@ namespace WebCore {
 
 class FontPlatformData;
 class SharedBuffer;
+class String;
 
 struct FontCustomPlatformData : Noncopyable {
     FontCustomPlatformData(cairo_font_face_t* fontFace)
@@ -40,6 +41,8 @@ struct FontCustomPlatformData : Noncopyable {
 
     FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode);
 
+    static bool supportsFormat(const String&);
+
     cairo_font_face_t* m_fontFace;
 };
 
diff --git a/WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp b/WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp
index 74f1e26..b6d6e65 100644
--- a/WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp
+++ b/WebCore/platform/graphics/chromium/FontCustomPlatformData.cpp
@@ -201,4 +201,13 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
 #endif
 }
 
+bool FontCustomPlatformData::supportsFormat(const String& format)
+{
+    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype")
+#if ENABLE(OPENTYPE_SANITIZER)
+        || equalIgnoringCase(format, "woff")
+#endif
+    ;
+}
+
 }
diff --git a/WebCore/platform/graphics/chromium/FontCustomPlatformData.h b/WebCore/platform/graphics/chromium/FontCustomPlatformData.h
index e1fbd48..03e1b8c 100644
--- a/WebCore/platform/graphics/chromium/FontCustomPlatformData.h
+++ b/WebCore/platform/graphics/chromium/FontCustomPlatformData.h
@@ -46,6 +46,7 @@ namespace WebCore {
 
 class FontPlatformData;
 class SharedBuffer;
+class String;
 
 struct FontCustomPlatformData : Noncopyable {
 #if OS(WINDOWS)
@@ -64,6 +65,8 @@ struct FontCustomPlatformData : Noncopyable {
     FontPlatformData fontPlatformData(int size, bool bold, bool italic,
                                       FontRenderingMode = NormalRenderingMode);
 
+    static bool supportsFormat(const String&);
+
 #if OS(WINDOWS)
     HANDLE m_fontReference;
     String m_name;
diff --git a/WebCore/platform/graphics/gtk/FontCustomPlatformDataPango.cpp b/WebCore/platform/graphics/gtk/FontCustomPlatformDataPango.cpp
index 4f2f2bb..d5f3173 100644
--- a/WebCore/platform/graphics/gtk/FontCustomPlatformDataPango.cpp
+++ b/WebCore/platform/graphics/gtk/FontCustomPlatformDataPango.cpp
@@ -46,4 +46,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
     return 0;
 }
 
+bool FontCustomPlatformData::supportsFormat(const String& /* format */)
+{
+    return false;
+}
+
 }
diff --git a/WebCore/platform/graphics/haiku/FontCustomPlatformData.cpp b/WebCore/platform/graphics/haiku/FontCustomPlatformData.cpp
index 6008bb1..4b39fdd 100644
--- a/WebCore/platform/graphics/haiku/FontCustomPlatformData.cpp
+++ b/WebCore/platform/graphics/haiku/FontCustomPlatformData.cpp
@@ -42,4 +42,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
     return 0;
 }
 
+bool FontCustomPlatformData::supportsFormat(const String& /* format */)
+{
+    return false;
+}
+
 }
diff --git a/WebCore/platform/graphics/haiku/FontCustomPlatformData.h b/WebCore/platform/graphics/haiku/FontCustomPlatformData.h
index c5a814e..9db6cc6 100644
--- a/WebCore/platform/graphics/haiku/FontCustomPlatformData.h
+++ b/WebCore/platform/graphics/haiku/FontCustomPlatformData.h
@@ -28,12 +28,15 @@ namespace WebCore {
 
     class FontPlatformData;
     class SharedBuffer;
+    class String;
 
     struct FontCustomPlatformData : Noncopyable {
     public:
         FontCustomPlatformData() { }
         ~FontCustomPlatformData();
 
+        static bool supportsFormat(const String&);
+
         FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode);
     };
 
diff --git a/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp b/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
index 256b5a4..c591ddc 100644
--- a/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
+++ b/WebCore/platform/graphics/mac/FontCustomPlatformData.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Apple Computer, Inc.
+ * Copyright (C) 2007, 2008, 2010 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -21,10 +21,11 @@
 #include "config.h"
 #include "FontCustomPlatformData.h"
 
-#include <ApplicationServices/ApplicationServices.h>
-#include "SharedBuffer.h"
 #include "FontPlatformData.h"
 #include "OpenTypeSanitizer.h"
+#include "SharedBuffer.h"
+#include "WOFFFileFormat.h"
+#include <ApplicationServices/ApplicationServices.h>
 
 namespace WebCore {
 
@@ -50,6 +51,16 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
     if (!transcodeBuffer)
         return 0; // validation failed.
     buffer = transcodeBuffer.get();
+#else
+    RefPtr<SharedBuffer> sfntBuffer;
+    if (isWOFF(buffer)) {
+        Vector<char> sfnt;
+        if (!convertWOFFToSfnt(buffer, sfnt))
+            return 0;
+
+        sfntBuffer = SharedBuffer::adoptVector(sfnt);
+        buffer = sfntBuffer.get();
+    }
 #endif
 
     ATSFontContainerRef containerRef = 0;
@@ -60,7 +71,7 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD)
     RetainPtr<CFDataRef> bufferData(AdoptCF, buffer->createCFData());
     RetainPtr<CGDataProviderRef> dataProvider(AdoptCF, CGDataProviderCreateWithCFData(bufferData.get()));
-    
+
     cgFontRef.adoptCF(CGFontCreateWithDataProvider(dataProvider.get()));
     if (!cgFontRef)
         return 0;
@@ -101,4 +112,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
     return new FontCustomPlatformData(containerRef, fontRef, cgFontRef.releaseRef());
 }
 
+bool FontCustomPlatformData::supportsFormat(const String& format)
+{
+    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") || equalIgnoringCase(format, "woff");
+}
+
 }
diff --git a/WebCore/platform/graphics/mac/FontCustomPlatformData.h b/WebCore/platform/graphics/mac/FontCustomPlatformData.h
index 2c1222f..f2cd2cc 100644
--- a/WebCore/platform/graphics/mac/FontCustomPlatformData.h
+++ b/WebCore/platform/graphics/mac/FontCustomPlatformData.h
@@ -33,6 +33,7 @@ namespace WebCore {
 
 class FontPlatformData;
 class SharedBuffer;
+class String;
 
 struct FontCustomPlatformData : Noncopyable {
     FontCustomPlatformData(ATSFontContainerRef container, ATSFontRef atsFont, CGFontRef cgFont)
@@ -42,6 +43,8 @@ struct FontCustomPlatformData : Noncopyable {
 
     FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode);
 
+    static bool supportsFormat(const String&);
+
     ATSFontContainerRef m_atsContainer;
     ATSFontRef m_atsFont;
     CGFontRef m_cgFont;
diff --git a/WebCore/platform/graphics/qt/FontCustomPlatformData.h b/WebCore/platform/graphics/qt/FontCustomPlatformData.h
index 0f2a6ce..6837059 100644
--- a/WebCore/platform/graphics/qt/FontCustomPlatformData.h
+++ b/WebCore/platform/graphics/qt/FontCustomPlatformData.h
@@ -27,8 +27,9 @@
 
 namespace WebCore {
 
-class SharedBuffer;
 class FontPlatformData;
+class SharedBuffer;
+class String;
 
 struct FontCustomPlatformData : Noncopyable {
     ~FontCustomPlatformData();
@@ -37,6 +38,8 @@ struct FontCustomPlatformData : Noncopyable {
     int m_handle;
 
     FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode);
+
+    static bool supportsFormat(const String&);
 };
 
 FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer);
diff --git a/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp b/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
index 6e9d053..dbf0b16 100644
--- a/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
+++ b/WebCore/platform/graphics/qt/FontCustomPlatformDataQt.cpp
@@ -61,5 +61,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
     return data;
 }
 
+bool FontCustomPlatformData::supportsFormat(const String& format)
+{
+    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype");
 }
 
+}
diff --git a/WebCore/platform/graphics/win/FontCustomPlatformData.cpp b/WebCore/platform/graphics/win/FontCustomPlatformData.cpp
index e9f83ab..6e59ad7 100644
--- a/WebCore/platform/graphics/win/FontCustomPlatformData.cpp
+++ b/WebCore/platform/graphics/win/FontCustomPlatformData.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -26,6 +26,7 @@
 #include "OpenTypeUtilities.h"
 #include "SharedBuffer.h"
 #include "SoftLinking.h"
+#include "WOFFFileFormat.h"
 #include <ApplicationServices/ApplicationServices.h>
 #include <WebKitSystemInterface/WebKitSystemInterface.h>
 #include <wtf/RetainPtr.h>
@@ -167,6 +168,16 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
     ASSERT_ARG(buffer, buffer);
     ASSERT(T2embedLibrary());
 
+    RefPtr<SharedBuffer> sfntBuffer;
+    if (isWOFF(buffer)) {
+        Vector<char> sfnt;
+        if (!convertWOFFToSfnt(buffer, sfnt))
+            return 0;
+
+        sfntBuffer = SharedBuffer::adoptVector(sfnt);
+        buffer = sfntBuffer.get();
+    }
+
     // Introduce the font to GDI. AddFontMemResourceEx cannot be used, because it will pollute the process's
     // font namespace (Windows has no API for creating an HFONT from data without exposing the font to the
     // entire process first). TTLoadEmbeddedFont lets us override the font family name, so using a unique name
@@ -200,4 +211,9 @@ FontCustomPlatformData* createFontCustomPlatformData(SharedBuffer* buffer)
     return new FontCustomPlatformData(fontReference, fontName);
 }
 
+bool FontCustomPlatformData::supportsFormat(const String& format)
+{
+    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype") || equalIgnoringCase(format, "woff");
+}
+
 }
diff --git a/WebCore/platform/graphics/win/FontCustomPlatformData.h b/WebCore/platform/graphics/win/FontCustomPlatformData.h
index f75f12a..46ddbb5 100644
--- a/WebCore/platform/graphics/win/FontCustomPlatformData.h
+++ b/WebCore/platform/graphics/win/FontCustomPlatformData.h
@@ -31,6 +31,7 @@ namespace WebCore {
 
 class FontPlatformData;
 class SharedBuffer;
+class String;
 
 struct FontCustomPlatformData : Noncopyable {
     FontCustomPlatformData(HANDLE fontReference, const String& name)
@@ -43,6 +44,8 @@ struct FontCustomPlatformData : Noncopyable {
 
     FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode);
 
+    static bool supportsFormat(const String&);
+
     HANDLE m_fontReference;
     String m_name;
 };
diff --git a/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp b/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp
index e54d85a..35839f5 100644
--- a/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp
+++ b/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.cpp
@@ -58,4 +58,9 @@ FontCustomPlatformDataCairo* createFontCustomPlatformData(SharedBuffer* buffer)
     return new FontCustomPlatformDataCairo(fontFace);
 }
 
+bool FontCustomPlatformData::supportsFormat(const String& format)
+{
+    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype");
+}
+
 }
diff --git a/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h b/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h
index 87794b5..75fe3d1 100644
--- a/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h
+++ b/WebCore/platform/graphics/win/FontCustomPlatformDataCairo.h
@@ -29,6 +29,7 @@ namespace WebCore {
 
 class FontPlatformData;
 class SharedBuffer;
+class String;
 
 struct FontCustomPlatformDataCairo : Noncopyable {
     FontCustomPlatformDataCairo(cairo_font_face_t* fontFace)
@@ -39,6 +40,8 @@ struct FontCustomPlatformDataCairo : Noncopyable {
 
     FontPlatformData fontPlatformData(int size, bool bold, bool italic);
 
+    static bool supportsFormat(const String&);
+
     cairo_font_face_t* m_fontFace;
 };
 
diff --git a/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp b/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp
index f8a1e26..3605c72 100644
--- a/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp
+++ b/WebCore/platform/graphics/wince/FontCustomPlatformData.cpp
@@ -83,4 +83,9 @@ FontCustomPlatformData* createFontCustomPlatformData(const SharedBuffer* buffer)
     return 0;
 }
 
+bool FontCustomPlatformData::supportsFormat(const String& format)
+{
+    return equalIgnoringCase(format, "truetype") || equalIgnoringCase(format, "opentype");
+}
+
 }
diff --git a/WebCore/platform/graphics/wince/FontCustomPlatformData.h b/WebCore/platform/graphics/wince/FontCustomPlatformData.h
index 89d1fdd..5ce0ea6 100644
--- a/WebCore/platform/graphics/wince/FontCustomPlatformData.h
+++ b/WebCore/platform/graphics/wince/FontCustomPlatformData.h
@@ -45,6 +45,9 @@ namespace WebCore {
         ~FontCustomPlatformData();
 
         FontPlatformData fontPlatformData(int size, bool bold, bool italic, FontRenderingMode = NormalRenderingMode);
+
+        static bool supportsFormat(const String&);
+
         String m_name;
     };
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list