[Cocoa] Add SPI to disallow user-installed fonts
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Dec 2017 20:29:03 +0000 (20:29 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Dec 2017 20:29:03 +0000 (20:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=180062
<rdar://problem/35042408>

Reviewed by Simon Fraser.

Source/WebCore:

This hooks up a WK2 preference, ShouldDisallowUserInstalledFonts, to our font selection
code. This preference works by specifying an attribute to our font selection code which
will prohibit user-installed fonts from ever being selected. This works both to disallow
newly installed fonts, as well as disallowing user-installed fonts which "shadow" (or
have the same name as) existing fonts, so that the existing font is selected instead.

The goal of this setting is to decrease the fingerprinting surface area which trackers
can use to identify users on the open Web.

Tests: fast/text/user-installed-font.html
       fast/text/user-installed-fonts/disable.html
       fast/text/user-installed-fonts/shadow-disable.html
       fast/text/user-installed-fonts/shadow-family-disable.html
       fast/text/user-installed-fonts/shadow-family.html
       fast/text/user-installed-fonts/shadow-postscript-disable.html
       fast/text/user-installed-fonts/shadow-postscript-family-disable.html
       fast/text/user-installed-fonts/shadow-postscript-family.html
       fast/text/user-installed-fonts/shadow-postscript.html
       fast/text/user-installed-fonts/shadow.html

* css/CSSFontFaceSet.cpp:
(WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::initializeFontStyle):
* page/Settings.yaml:
* platform/graphics/FontCache.h:
* platform/graphics/FontDescription.cpp:
(WebCore::FontDescription::FontDescription):
* platform/graphics/FontDescription.h:
(WebCore::FontDescription::mayRepresentUserInstalledFont const):
(WebCore::FontDescription::setMayRepresentUserInstalledFont):
(WebCore::FontDescription::operator== const):
* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::FontDatabase::singleton):
(WebCore::FontDatabase::singletonAllowingUserInstalledFonts):
(WebCore::FontDatabase::singletonDisallowingUserInstalledFonts):
(WebCore::FontDatabase::collectionForFamily):
(WebCore::FontDatabase::fontForPostScriptName):
(WebCore::FontDatabase::FontDatabase):
(WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
(WebCore::platformFontLookupWithFamily):
(WebCore::invalidateFontCache):
(WebCore::fontWithFamily):
* style/StyleResolveForDocument.cpp:
(WebCore::Style::resolveForDocument):
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::setShouldDisallowUserInstalledFonts):
* testing/InternalSettings.h:
* testing/InternalSettings.idl:

Source/WebCore/PAL:

* pal/spi/cocoa/CoreTextSPI.h:

Source/WebKit:

* Shared/WebPreferences.yaml:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetShouldDisallowUserInstalledFonts):
(WKPreferencesGetShouldDisallowUserInstalledFonts):
* UIProcess/API/C/WKPreferencesRefPrivate.h:
* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _shouldDisallowUserInstalledFonts]):
(-[WKPreferences _setShouldDisallowUserInstalledFonts:]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:

Tools:

* WebKitTestRunner/InjectedBundle/ActivateFonts.h:
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::resetAfterTest):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm:
(WTR::resourcesDirectoryURL):
(WTR::activateFonts):
(WTR::installFakeHelvetica):
(WTR::uninstallFakeHelvetica):
* WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm:
(WTR::TestRunner::installFakeHelvetica):
* WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
* WebKitTestRunner/fonts/FakeHelvetica-Helvetica-400.ttf: Added.
* WebKitTestRunner/fonts/FakeHelvetica-Helvetica-500.ttf: Added.
* WebKitTestRunner/fonts/FakeHelvetica-Helvetica2-400.ttf: Added.
* WebKitTestRunner/fonts/FakeHelvetica-Helvetica2-500.ttf: Added.

LayoutTests:

* fast/text/user-installed-font-expected.html: Added.
* fast/text/user-installed-font.html: Added.
* fast/text/user-installed-fonts/disable-expected-mismatch.html: Added.
* fast/text/user-installed-fonts/disable.html: Added.
* fast/text/user-installed-fonts/shadow-disable-expected-mismatch.html: Added.
* fast/text/user-installed-fonts/shadow-disable.html: Added.
* fast/text/user-installed-fonts/shadow-expected.html: Added.
* fast/text/user-installed-fonts/shadow-family-disable-expected-mismatch.html: Added.
* fast/text/user-installed-fonts/shadow-family-disable.html: Added.
* fast/text/user-installed-fonts/shadow-family-expected.html: Added.
* fast/text/user-installed-fonts/shadow-family.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-disable-expected-mismatch.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-disable.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-expected.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-family-disable-expected-mismatch.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-family-disable.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-family-expected.html: Added.
* fast/text/user-installed-fonts/shadow-postscript-family.html: Added.
* fast/text/user-installed-fonts/shadow-postscript.html: Added.
* fast/text/user-installed-fonts/shadow.html: Added.
* platform/gtk/TestExpectations:
* platform/ios-wk1/TestExpectations:
* platform/ios/TestExpectations:
* platform/mac-wk1/TestExpectations:
* platform/mac/TestExpectations:
* platform/win/TestExpectations:
* platform/wpe/TestExpectations:

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

59 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/text/user-installed-font-expected.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-font.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-fonts/disable-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-fonts/disable.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-fonts/shadow-disable-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-fonts/shadow-disable.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-fonts/shadow-expected.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-fonts/shadow-family-disable-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-fonts/shadow-family-disable.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-fonts/shadow-family-expected.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-fonts/shadow-family.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-fonts/shadow-postscript-disable-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-fonts/shadow-postscript-disable.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-fonts/shadow-postscript-expected.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-fonts/shadow-postscript-family-disable-expected-mismatch.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-fonts/shadow-postscript-family-disable.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-fonts/shadow-postscript-family-expected.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-fonts/shadow-postscript-family.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-fonts/shadow-postscript.html [new file with mode: 0644]
LayoutTests/fast/text/user-installed-fonts/shadow.html [new file with mode: 0644]
LayoutTests/platform/gtk/TestExpectations
LayoutTests/platform/ios-wk1/TestExpectations
LayoutTests/platform/ios/TestExpectations
LayoutTests/platform/mac-wk1/TestExpectations
LayoutTests/platform/mac/TestExpectations
LayoutTests/platform/win/TestExpectations
LayoutTests/platform/wpe/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h
Source/WebCore/css/CSSFontFaceSet.cpp
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/page/Settings.yaml
Source/WebCore/platform/graphics/FontCache.h
Source/WebCore/platform/graphics/FontDescription.cpp
Source/WebCore/platform/graphics/FontDescription.h
Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
Source/WebCore/platform/graphics/freetype/FontCacheFreeType.cpp
Source/WebCore/platform/graphics/win/FontCacheWin.cpp
Source/WebCore/style/StyleResolveForDocument.cpp
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKit/UIProcess/API/C/WKPreferences.cpp
Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm
Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h
Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/ActivateFonts.h
Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm
Tools/WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm
Tools/WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj
Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica-400.ttf [new file with mode: 0644]
Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica-500.ttf [new file with mode: 0644]
Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica2-400.ttf [new file with mode: 0644]
Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica2-500.ttf [new file with mode: 0644]

index ac19642..f37d9be 100644 (file)
@@ -1,3 +1,39 @@
+2017-12-07  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [Cocoa] Add SPI to disallow user-installed fonts
+        https://bugs.webkit.org/show_bug.cgi?id=180062
+        <rdar://problem/35042408>
+
+        Reviewed by Simon Fraser.
+
+        * fast/text/user-installed-font-expected.html: Added.
+        * fast/text/user-installed-font.html: Added.
+        * fast/text/user-installed-fonts/disable-expected-mismatch.html: Added.
+        * fast/text/user-installed-fonts/disable.html: Added.
+        * fast/text/user-installed-fonts/shadow-disable-expected-mismatch.html: Added.
+        * fast/text/user-installed-fonts/shadow-disable.html: Added.
+        * fast/text/user-installed-fonts/shadow-expected.html: Added.
+        * fast/text/user-installed-fonts/shadow-family-disable-expected-mismatch.html: Added.
+        * fast/text/user-installed-fonts/shadow-family-disable.html: Added.
+        * fast/text/user-installed-fonts/shadow-family-expected.html: Added.
+        * fast/text/user-installed-fonts/shadow-family.html: Added.
+        * fast/text/user-installed-fonts/shadow-postscript-disable-expected-mismatch.html: Added.
+        * fast/text/user-installed-fonts/shadow-postscript-disable.html: Added.
+        * fast/text/user-installed-fonts/shadow-postscript-expected.html: Added.
+        * fast/text/user-installed-fonts/shadow-postscript-family-disable-expected-mismatch.html: Added.
+        * fast/text/user-installed-fonts/shadow-postscript-family-disable.html: Added.
+        * fast/text/user-installed-fonts/shadow-postscript-family-expected.html: Added.
+        * fast/text/user-installed-fonts/shadow-postscript-family.html: Added.
+        * fast/text/user-installed-fonts/shadow-postscript.html: Added.
+        * fast/text/user-installed-fonts/shadow.html: Added.
+        * platform/gtk/TestExpectations:
+        * platform/ios-wk1/TestExpectations:
+        * platform/ios/TestExpectations:
+        * platform/mac-wk1/TestExpectations:
+        * platform/mac/TestExpectations:
+        * platform/win/TestExpectations:
+        * platform/wpe/TestExpectations:
+
 2017-12-07  John Wilander  <wilander@apple.com>
 
         Move all tests under http/tests/loading/resourceLoadStatistics/ to http/tests/resourceLoadStatistics/ and remove expected failures
diff --git a/LayoutTests/fast/text/user-installed-font-expected.html b/LayoutTests/fast/text/user-installed-font-expected.html
new file mode 100644 (file)
index 0000000..93cf259
--- /dev/null
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that user-installed fonts work in the general case. The test passes if you see a black square below.
+<div style="width: 96px; height: 96px; background: black;"></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-font.html b/LayoutTests/fast/text/user-installed-font.html
new file mode 100644 (file)
index 0000000..c88dfbb
--- /dev/null
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that user-installed fonts work in the general case. The test passes if you see a black square below.
+<div style="font: 100px 'Ahem'; width: 96px; height: 96px; overflow: hidden; position: relative;"><div style="position: relative; top: -2px; left: -2px;">e</div></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-fonts/disable-expected-mismatch.html b/LayoutTests/fast/text/user-installed-fonts/disable-expected-mismatch.html
new file mode 100644 (file)
index 0000000..3d4d99e
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="width: 96px; height: 96px; background: black;"></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-fonts/disable.html b/LayoutTests/fast/text/user-installed-fonts/disable.html
new file mode 100644 (file)
index 0000000..314ea61
--- /dev/null
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.internals)
+    internals.settings.setShouldDisallowUserInstalledFonts(true);
+</script>
+</head>
+<body>
+<div style="font: 100px 'Ahem'; width: 96px; height: 96px; overflow: hidden; position: relative;"><div style="position: relative; top: -2px; left: -2px;">e</div></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-fonts/shadow-disable-expected-mismatch.html b/LayoutTests/fast/text/user-installed-fonts/shadow-disable-expected-mismatch.html
new file mode 100644 (file)
index 0000000..3d4d99e
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="width: 96px; height: 96px; background: black;"></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-fonts/shadow-disable.html b/LayoutTests/fast/text/user-installed-fonts/shadow-disable.html
new file mode 100644 (file)
index 0000000..cc45779
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner)
+    testRunner.installFakeHelvetica("Helvetica-400");
+if (window.internals)
+    internals.settings.setShouldDisallowUserInstalledFonts(true);
+</script>
+</head>
+<body>
+<div style="font: 400 100px 'Helvetica'; width: 96px; height: 96px; overflow: hidden; position: relative;"><div style="position: relative; top: -2px; left: -2px;">e</div></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-fonts/shadow-expected.html b/LayoutTests/fast/text/user-installed-fonts/shadow-expected.html
new file mode 100644 (file)
index 0000000..508444d
--- /dev/null
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that user-installed fonts which have the same name as preinstalled fonts are used instead of the preinstalled fonts. The test passes if you see a black rectangle below.
+<div style="width: 96px; height: 50px; background: black;"></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-fonts/shadow-family-disable-expected-mismatch.html b/LayoutTests/fast/text/user-installed-fonts/shadow-family-disable-expected-mismatch.html
new file mode 100644 (file)
index 0000000..3d4d99e
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="width: 96px; height: 96px; background: black;"></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-fonts/shadow-family-disable.html b/LayoutTests/fast/text/user-installed-fonts/shadow-family-disable.html
new file mode 100644 (file)
index 0000000..beddaf5
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner)
+    testRunner.installFakeHelvetica("Helvetica-500");
+if (window.internals)
+    internals.settings.setShouldDisallowUserInstalledFonts(true);
+</script>
+</head>
+<body>
+<div style="font: 500 100px 'Helvetica'; width: 96px; height: 96px; overflow: hidden; position: relative;"><div style="position: relative; top: -2px; left: -2px;">e</div></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-fonts/shadow-family-expected.html b/LayoutTests/fast/text/user-installed-fonts/shadow-family-expected.html
new file mode 100644 (file)
index 0000000..508444d
--- /dev/null
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that user-installed fonts which have the same name as preinstalled fonts are used instead of the preinstalled fonts. The test passes if you see a black rectangle below.
+<div style="width: 96px; height: 50px; background: black;"></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-fonts/shadow-family.html b/LayoutTests/fast/text/user-installed-fonts/shadow-family.html
new file mode 100644 (file)
index 0000000..300934f
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner)
+    testRunner.installFakeHelvetica("Helvetica-500");
+</script>
+</head>
+<body>
+This test makes sure that user-installed fonts which have the same name as preinstalled fonts are used instead of the preinstalled fonts. The test passes if you see a black rectangle below.
+<div style="font: 500 100px 'Helvetica'; width: 96px; height: 50px; overflow: hidden; position: relative;"><div style="position: relative; top: -50px; left: -2px;">e</div></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-fonts/shadow-postscript-disable-expected-mismatch.html b/LayoutTests/fast/text/user-installed-fonts/shadow-postscript-disable-expected-mismatch.html
new file mode 100644 (file)
index 0000000..3d4d99e
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="width: 96px; height: 96px; background: black;"></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-fonts/shadow-postscript-disable.html b/LayoutTests/fast/text/user-installed-fonts/shadow-postscript-disable.html
new file mode 100644 (file)
index 0000000..1e44d5c
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner)
+    testRunner.installFakeHelvetica("Helvetica2-400");
+if (window.internals)
+    internals.settings.setShouldDisallowUserInstalledFonts(true);
+</script>
+</head>
+<body>
+<div style="font: 400 100px 'Helvetica'; width: 96px; height: 96px; overflow: hidden; position: relative;"><div style="position: relative; top: -2px; left: -2px;">e</div></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-fonts/shadow-postscript-expected.html b/LayoutTests/fast/text/user-installed-fonts/shadow-postscript-expected.html
new file mode 100644 (file)
index 0000000..508444d
--- /dev/null
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that user-installed fonts which have the same name as preinstalled fonts are used instead of the preinstalled fonts. The test passes if you see a black rectangle below.
+<div style="width: 96px; height: 50px; background: black;"></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-fonts/shadow-postscript-family-disable-expected-mismatch.html b/LayoutTests/fast/text/user-installed-fonts/shadow-postscript-family-disable-expected-mismatch.html
new file mode 100644 (file)
index 0000000..3d4d99e
--- /dev/null
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+<div style="width: 96px; height: 96px; background: black;"></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-fonts/shadow-postscript-family-disable.html b/LayoutTests/fast/text/user-installed-fonts/shadow-postscript-family-disable.html
new file mode 100644 (file)
index 0000000..f0a3ff4
--- /dev/null
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner)
+    testRunner.installFakeHelvetica("Helvetica2-500");
+if (window.internals)
+    internals.settings.setShouldDisallowUserInstalledFonts(true);
+</script>
+</head>
+<body>
+<div style="font: 500 100px 'Helvetica'; width: 96px; height: 96px; overflow: hidden; position: relative;"><div style="position: relative; top: -2px; left: -2px;">e</div></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-fonts/shadow-postscript-family-expected.html b/LayoutTests/fast/text/user-installed-fonts/shadow-postscript-family-expected.html
new file mode 100644 (file)
index 0000000..508444d
--- /dev/null
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+<head>
+</head>
+<body>
+This test makes sure that user-installed fonts which have the same name as preinstalled fonts are used instead of the preinstalled fonts. The test passes if you see a black rectangle below.
+<div style="width: 96px; height: 50px; background: black;"></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-fonts/shadow-postscript-family.html b/LayoutTests/fast/text/user-installed-fonts/shadow-postscript-family.html
new file mode 100644 (file)
index 0000000..6d61221
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner)
+    testRunner.installFakeHelvetica("Helvetica2-500");
+</script>
+</head>
+<body>
+This test makes sure that user-installed fonts which have the same name as preinstalled fonts are used instead of the preinstalled fonts. The test passes if you see a black rectangle below.
+<div style="font: 500 100px 'Helvetica'; width: 96px; height: 50px; overflow: hidden; position: relative;"><div style="position: relative; top: -50px; left: -2px;">e</div></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-fonts/shadow-postscript.html b/LayoutTests/fast/text/user-installed-fonts/shadow-postscript.html
new file mode 100644 (file)
index 0000000..c76f9ac
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner)
+    testRunner.installFakeHelvetica("Helvetica2-400");
+</script>
+</head>
+<body>
+This test makes sure that user-installed fonts which have the same name as preinstalled fonts are used instead of the preinstalled fonts. The test passes if you see a black rectangle below.
+<div style="font: 400 100px 'Helvetica'; width: 96px; height: 50px; overflow: hidden; position: relative;"><div style="position: relative; top: -50px; left: -2px;">e</div></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/user-installed-fonts/shadow.html b/LayoutTests/fast/text/user-installed-fonts/shadow.html
new file mode 100644 (file)
index 0000000..5f7b8e1
--- /dev/null
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+if (window.testRunner)
+    testRunner.installFakeHelvetica("Helvetica-400");
+</script>
+</head>
+<body>
+This test makes sure that user-installed fonts which have the same name as preinstalled fonts are used instead of the preinstalled fonts. The test passes if you see a black rectangle below.
+<div style="font: 400 100px 'Helvetica'; width: 96px; height: 50px; overflow: hidden; position: relative;"><div style="position: relative; top: -50px; left: -2px;">e</div></div>
+</body>
+</html>
index aeab78d..73606c2 100644 (file)
@@ -3357,6 +3357,8 @@ webkit.org/b/179052 compositing/contents-format/subpixel-antialiased-nested-laye
 
 webkit.org/b/180371 fast/attachment/attachment-without-appearance.html [ ImageOnlyFailure ]
 
+webkit.org/b/180062 fast/text/user-installed-fonts [ ImageOnlyFailure ]
+
 #////////////////////////////////////////////////////////////////////////////////////////
 # End of non-crashing, non-flaky tests failing
 #////////////////////////////////////////////////////////////////////////////////////////
index eb6d307..cf127a0 100644 (file)
@@ -1903,3 +1903,6 @@ webkit.org/b/172092 [ Release ] fast/parser/adoption-agency-unload-iframe-4.html
 
 # FIXME: For some reason EventSender.keyDown() does not work.
 webkit.org/b/178490 fast/text/scroll-text-overflow-ellipsis.html [ Skip ]
+
+# User-installed fonts test infrastructure is not present in WK1
+webkit.org/b/180062 fast/text/user-installed-fonts [ ImageOnlyFailure ]
index 6d177fe..a57799b 100644 (file)
@@ -3308,3 +3308,9 @@ media/modern-media-controls/time-labels-support/elapsed-time.html [ Skip ]
 
 # Requries AVFoundation support <rdar://problem/34502208>
 http/tests/images/image-supports-video.html
+
+# User-installed font infrastructure is ony present on certain OSes.
+webkit.org/b/180062 fast/text/user-installed-fonts/disable.html [ ImageOnlyFailure ]
+webkit.org/b/180062 fast/text/user-installed-fonts/shadow-family.html [ ImageOnlyFailure ]
+webkit.org/b/180062 fast/text/user-installed-fonts/shadow-postscript.html [ ImageOnlyFailure ]
+webkit.org/b/180062 fast/text/user-installed-fonts/shadow.html [ ImageOnlyFailure ]
index ccea05a..d30048b 100644 (file)
@@ -474,3 +474,6 @@ webkit.org/b/179775 imported/w3c/web-platform-tests/XMLHttpRequest/firing-events
 webkit.org/b/172044 [ Debug ] imported/w3c/web-platform-tests/IndexedDB/open-request-queue.html [ Pass Timeout ]
 
 webkit.org/b/179500 accessibility/mac/AOM-relation-property.html [ Skip ]
+
+# User-installed fonts test infrastructure is not present in WK1
+webkit.org/b/180062 fast/text/user-installed-fonts [ ImageOnlyFailure ]
index aa4f9fc..7b964b8 100644 (file)
@@ -1757,3 +1757,7 @@ webkit.org/b/165311 [ Sierra+ ] media/modern-media-controls/pip-support/pip-supp
 
 webkit.org/b/176693 storage/indexeddb/modern/idbtransaction-objectstore-failures-private.html [ Pass Failure ]
 
+# User-installed font infrastructure is ony present on certain OSes.
+webkit.org/b/180062 [ ElCapitan Sierra HighSierra ] fast/text/user-installed-fonts/disable.html [ ImageOnlyFailure ]
+webkit.org/b/180062 [ ElCapitan Sierra HighSierra ] fast/text/user-installed-fonts/shadow-postscript.html [ ImageOnlyFailure ]
+webkit.org/b/180062 [ ElCapitan Sierra HighSierra ] fast/text/user-installed-fonts/shadow.html [ ImageOnlyFailure ]
index 525e76c..d92be7e 100644 (file)
@@ -3832,3 +3832,6 @@ webkit.org/b/179613 editing/execCommand/underline-selection-containing-image.htm
 webkit.org/b/179766 accessibility/accessibility-object-model.html [ Failure ]
 
 webkit.org/b/179767 http/wpt/offscreen-canvas/getContext-webgl.html [ Failure ]
+
+# User-installed font infrastructure is ony present on certain OSes.
+webkit.org/b/180062 fast/text/user-installed-fonts [ ImageOnlyFailure ]
index b98b9aa..143382b 100644 (file)
@@ -1108,3 +1108,6 @@ webkit.org/b/179898 svg/animations/svglengthlist-animation-3.html [ Pass Failure
 webkit.org/b/180134 webanimations/left-and-opacity-animation-yields-no-compositing.html [ Failure ]
 webkit.org/b/180134 webanimations/opacity-animation-no-longer-composited-upon-completion.html [ Failure ]
 webkit.org/b/180134 webanimations/width-and-opacity-separate-animation-yields-no-compositing.html [ Failure ]
+
+# User-installed font infrastructure is ony present on certain OSes.
+webkit.org/b/180062 fast/text/user-installed-fonts/ [ ImageOnlyFailure ]
index 70d5cf8..d89d99b 100644 (file)
@@ -1,3 +1,61 @@
+2017-12-07  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [Cocoa] Add SPI to disallow user-installed fonts
+        https://bugs.webkit.org/show_bug.cgi?id=180062
+        <rdar://problem/35042408>
+
+        Reviewed by Simon Fraser.
+
+        This hooks up a WK2 preference, ShouldDisallowUserInstalledFonts, to our font selection
+        code. This preference works by specifying an attribute to our font selection code which
+        will prohibit user-installed fonts from ever being selected. This works both to disallow
+        newly installed fonts, as well as disallowing user-installed fonts which "shadow" (or
+        have the same name as) existing fonts, so that the existing font is selected instead.
+
+        The goal of this setting is to decrease the fingerprinting surface area which trackers
+        can use to identify users on the open Web.
+
+        Tests: fast/text/user-installed-font.html
+               fast/text/user-installed-fonts/disable.html
+               fast/text/user-installed-fonts/shadow-disable.html
+               fast/text/user-installed-fonts/shadow-family-disable.html
+               fast/text/user-installed-fonts/shadow-family.html
+               fast/text/user-installed-fonts/shadow-postscript-disable.html
+               fast/text/user-installed-fonts/shadow-postscript-family-disable.html
+               fast/text/user-installed-fonts/shadow-postscript-family.html
+               fast/text/user-installed-fonts/shadow-postscript.html
+               fast/text/user-installed-fonts/shadow.html
+
+        * css/CSSFontFaceSet.cpp:
+        (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::initializeFontStyle):
+        * page/Settings.yaml:
+        * platform/graphics/FontCache.h:
+        * platform/graphics/FontDescription.cpp:
+        (WebCore::FontDescription::FontDescription):
+        * platform/graphics/FontDescription.h:
+        (WebCore::FontDescription::mayRepresentUserInstalledFont const):
+        (WebCore::FontDescription::setMayRepresentUserInstalledFont):
+        (WebCore::FontDescription::operator== const):
+        * platform/graphics/cocoa/FontCacheCoreText.cpp:
+        (WebCore::FontDatabase::singleton):
+        (WebCore::FontDatabase::singletonAllowingUserInstalledFonts):
+        (WebCore::FontDatabase::singletonDisallowingUserInstalledFonts):
+        (WebCore::FontDatabase::collectionForFamily):
+        (WebCore::FontDatabase::fontForPostScriptName):
+        (WebCore::FontDatabase::FontDatabase):
+        (WebCore::FontCache::getFontSelectionCapabilitiesInFamily):
+        (WebCore::platformFontLookupWithFamily):
+        (WebCore::invalidateFontCache):
+        (WebCore::fontWithFamily):
+        * style/StyleResolveForDocument.cpp:
+        (WebCore::Style::resolveForDocument):
+        * testing/InternalSettings.cpp:
+        (WebCore::InternalSettings::setShouldDisallowUserInstalledFonts):
+        * testing/InternalSettings.h:
+        * testing/InternalSettings.idl:
+
 2017-12-07  David Quesada  <david_quesada@apple.com>
 
         [Web App Manifest] Support display-mode media feature
index 8d00b4b..664c562 100644 (file)
@@ -1,3 +1,13 @@
+2017-12-07  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [Cocoa] Add SPI to disallow user-installed fonts
+        https://bugs.webkit.org/show_bug.cgi?id=180062
+        <rdar://problem/35042408>
+
+        Reviewed by Simon Fraser.
+
+        * pal/spi/cocoa/CoreTextSPI.h:
+
 2017-12-02  Darin Adler  <darin@apple.com>
 
         Modernize some aspects of text codecs, eliminate WebKit use of strcasecmp
index de8040f..7dcfcde 100644 (file)
@@ -65,6 +65,7 @@ typedef void (*CTUniCharDisposeCallback)(const UniChar* chars, void* refCon);
 extern const CFStringRef kCTFontReferenceURLAttribute;
 extern const CFStringRef kCTFontOpticalSizeAttribute;
 extern const CFStringRef kCTFontPostScriptNameAttribute;
+extern const CFStringRef kCTFontUserInstalledAttribute;
 
 bool CTFontTransformGlyphs(CTFontRef, CGGlyph glyphs[], CGSize advances[], CFIndex count, CTFontTransformOptions);
 
index 68a93ba..5c40313 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "CSSFontFaceSource.h"
 #include "CSSFontFamily.h"
+#include "CSSFontSelector.h"
 #include "CSSFontStyleValue.h"
 #include "CSSParser.h"
 #include "CSSPrimitiveValue.h"
@@ -103,7 +104,10 @@ void CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered(const String& famil
     if (m_locallyInstalledFacesLookupTable.contains(familyName))
         return;
 
-    Vector<FontSelectionCapabilities> capabilities = FontCache::singleton().getFontSelectionCapabilitiesInFamily(familyName);
+    FontCache::AllowUserInstalledFonts allowUserInstalledFonts = FontCache::AllowUserInstalledFonts::Yes;
+    if (m_owningFontSelector->document() && m_owningFontSelector->document()->settings().shouldDisallowUserInstalledFonts())
+        allowUserInstalledFonts = FontCache::AllowUserInstalledFonts::No;
+    Vector<FontSelectionCapabilities> capabilities = FontCache::singleton().getFontSelectionCapabilitiesInFamily(familyName, allowUserInstalledFonts);
     if (capabilities.isEmpty())
         return;
 
index 5e28ad7..e6ec0aa 100644 (file)
@@ -1792,6 +1792,7 @@ void StyleResolver::initializeFontStyle()
     fontDescription.setOneFamily(standardFamily);
     fontDescription.setKeywordSizeFromIdentifier(CSSValueMedium);
     setFontSize(fontDescription, Style::fontSizeForKeyword(CSSValueMedium, false, document()));
+    fontDescription.setMayRepresentUserInstalledFont(!settings().shouldDisallowUserInstalledFonts());
     setFontDescription(fontDescription);
 }
 
index 1995f7b..995eb8d 100644 (file)
@@ -661,6 +661,10 @@ storageBlockingPolicy:
   initial: SecurityOrigin::AllowAllStorage
   onChange: storageBlockingPolicyChanged
 
+shouldDisallowUserInstalledFonts:
+  initial: false
+  onChange: setNeedsRecalcStyleInAllFrames
+
 # Only set by Layout Tests.
 mediaTypeOverride:
   type: String
index 890d6d7..4af47d4 100644 (file)
@@ -200,9 +200,13 @@ public:
     static IMultiLanguage* getMultiLanguageInterface();
 #endif
 
+    enum class AllowUserInstalledFonts {
+        Yes,
+        No
+    };
     // This function exists so CSSFontSelector can have a unified notion of preinstalled fonts and @font-face.
     // It comes into play when you create an @font-face which shares a family name as a preinstalled font.
-    Vector<FontSelectionCapabilities> getFontSelectionCapabilitiesInFamily(const AtomicString&);
+    Vector<FontSelectionCapabilities> getFontSelectionCapabilitiesInFamily(const AtomicString&, AllowUserInstalledFonts);
 
     WEBCORE_EXPORT RefPtr<Font> fontForFamily(const FontDescription&, const AtomicString&, const FontFeatureSettings* fontFaceFeatures = nullptr, const FontVariantSettings* fontFaceVariantSettings = nullptr, FontSelectionSpecifiedCapabilities fontFaceCapabilities = { }, bool checkingAlternateName = false);
     WEBCORE_EXPORT Ref<Font> lastResortFallbackFont(const FontDescription&);
index ac3a7f6..1d9d785 100644 (file)
@@ -80,6 +80,7 @@ FontDescription::FontDescription()
     , m_variantEastAsianRuby(static_cast<unsigned>(FontVariantEastAsianRuby::Normal))
     , m_opticalSizing(static_cast<unsigned>(FontOpticalSizing::Enabled))
     , m_fontStyleAxis(FontCascadeDescription::initialFontStyleAxis() == FontStyleAxis::ital)
+    , m_mayRepresentUserInstalledFont(true)
 {
 }
 
index c5eebf1..8b8fa22 100644 (file)
@@ -114,6 +114,7 @@ public:
     }
     FontOpticalSizing opticalSizing() const { return static_cast<FontOpticalSizing>(m_opticalSizing); }
     FontStyleAxis fontStyleAxis() const { return m_fontStyleAxis ? FontStyleAxis::ital : FontStyleAxis::slnt; }
+    bool mayRepresentUserInstalledFont() const { return m_mayRepresentUserInstalledFont; }
 
     void setComputedSize(float s) { m_computedSize = clampToFloat(s); }
     void setItalic(FontSelectionValue italic) { m_fontSelectionRequest.slope = italic; }
@@ -148,6 +149,7 @@ public:
     void setVariantEastAsianRuby(FontVariantEastAsianRuby variant) { m_variantEastAsianRuby = static_cast<unsigned>(variant); }
     void setOpticalSizing(FontOpticalSizing sizing) { m_opticalSizing = static_cast<unsigned>(sizing); }
     void setFontStyleAxis(FontStyleAxis axis) { m_fontStyleAxis = axis == FontStyleAxis::ital; }
+    void setMayRepresentUserInstalledFont(bool mayRepresentUserInstalledFont) { m_mayRepresentUserInstalledFont = mayRepresentUserInstalledFont; }
 
     static void invalidateCaches();
 
@@ -183,6 +185,7 @@ private:
     unsigned m_variantEastAsianRuby : 1; // FontVariantEastAsianRuby
     unsigned m_opticalSizing : 1; // FontOpticalSizing
     unsigned m_fontStyleAxis : 1; // Whether "font-style: italic" or "font-style: oblique 20deg" was specified
+    unsigned m_mayRepresentUserInstalledFont : 1; // If this description is allowed to match a user-installed font
 };
 
 inline bool FontDescription::operator==(const FontDescription& other) const
@@ -216,7 +219,8 @@ inline bool FontDescription::operator==(const FontDescription& other) const
         && m_variantEastAsianWidth == other.m_variantEastAsianWidth
         && m_variantEastAsianRuby == other.m_variantEastAsianRuby
         && m_opticalSizing == other.m_opticalSizing
-        && m_fontStyleAxis == other.m_fontStyleAxis;
+        && m_fontStyleAxis == other.m_fontStyleAxis
+        && m_mayRepresentUserInstalledFont == other.m_mayRepresentUserInstalledFont;
 }
 
 // FIXME: Move to a file of its own.
index 611edfb..ce70374 100644 (file)
@@ -37,6 +37,7 @@
 
 #define SHOULD_USE_CORE_TEXT_FONT_LOOKUP (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
 #define HAS_CORE_TEXT_WIDTH_ATTRIBUTE ((PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000))
+#define CAN_DISALLOW_USER_INSTALLED_FONTS ((PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 120000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400))
 
 namespace WebCore {
 
@@ -829,11 +830,33 @@ static float fontWeightFromCoreText(CGFloat weight)
 
 class FontDatabase {
 public:
+#if !CAN_DISALLOW_USER_INSTALLED_FONTS
     static FontDatabase& singleton()
     {
-        static NeverDestroyed<FontDatabase> database;
+        static NeverDestroyed<FontDatabase> database(FontCache::AllowUserInstalledFonts::Yes);
         return database;
     }
+#endif
+
+    static FontDatabase& singletonAllowingUserInstalledFonts()
+    {
+#if CAN_DISALLOW_USER_INSTALLED_FONTS
+        static NeverDestroyed<FontDatabase> database(FontCache::AllowUserInstalledFonts::Yes);
+        return database;
+#else
+        return singleton();
+#endif
+    }
+
+    static FontDatabase& singletonDisallowingUserInstalledFonts()
+    {
+#if CAN_DISALLOW_USER_INSTALLED_FONTS
+        static NeverDestroyed<FontDatabase> database(FontCache::AllowUserInstalledFonts::No);
+        return database;
+#else
+        return singleton();
+#endif
+    }
 
     FontDatabase(const FontDatabase&) = delete;
     FontDatabase& operator=(const FontDatabase&) = delete;
@@ -885,9 +908,19 @@ public:
         auto folded = familyName.foldCase();
         return m_familyNameToFontDescriptors.ensure(folded, [&] {
             auto familyNameString = folded.createCFString();
-            CFTypeRef keys[] = { kCTFontFamilyNameAttribute };
-            CFTypeRef values[] = { familyNameString.get() };
-            auto attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+            RetainPtr<CFDictionaryRef> attributes;
+#if CAN_DISALLOW_USER_INSTALLED_FONTS
+            if (m_allowUserInstalledFonts == FontCache::AllowUserInstalledFonts::No) {
+                CFTypeRef keys[] = { kCTFontFamilyNameAttribute, kCTFontUserInstalledAttribute };
+                CFTypeRef values[] = { familyNameString.get(), kCFBooleanFalse };
+                attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+            } else
+#endif
+            {
+                CFTypeRef keys[] = { kCTFontFamilyNameAttribute };
+                CFTypeRef values[] = { familyNameString.get() };
+                attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+            }
             auto fontDescriptorToMatch = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get()));
             if (auto matches = adoptCF(CTFontDescriptorCreateMatchingFontDescriptors(fontDescriptorToMatch.get(), nullptr))) {
                 auto count = CFArrayGetCount(matches.get());
@@ -913,9 +946,19 @@ public:
 #else
             CFStringRef nameAttribute = kCTFontNameAttribute;
 #endif
-            CFTypeRef keys[] = { kCTFontEnabledAttribute, nameAttribute };
-            CFTypeRef values[] = { kCFBooleanTrue, postScriptNameString.get() };
-            auto attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+            RetainPtr<CFDictionaryRef> attributes;
+#if CAN_DISALLOW_USER_INSTALLED_FONTS
+            if (m_allowUserInstalledFonts == FontCache::AllowUserInstalledFonts::No) {
+                CFTypeRef keys[] = { kCTFontEnabledAttribute, nameAttribute, kCTFontUserInstalledAttribute };
+                CFTypeRef values[] = { kCFBooleanTrue, postScriptNameString.get(), kCFBooleanFalse };
+                attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+            } else
+#endif
+            {
+                CFTypeRef keys[] = { kCTFontEnabledAttribute, nameAttribute };
+                CFTypeRef values[] = { kCFBooleanTrue, postScriptNameString.get() };
+                attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(keys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
+            }
             auto fontDescriptorToMatch = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get()));
             auto match = adoptCF(static_cast<CTFontDescriptorRef>(CTFontDescriptorCreateMatchingFontDescriptor(fontDescriptorToMatch.get(), nullptr)));
             return InstalledFont(match.get());
@@ -931,10 +974,14 @@ public:
 private:
     friend class NeverDestroyed<FontDatabase>;
 
-    FontDatabase() = default;
+    FontDatabase(FontCache::AllowUserInstalledFonts allowUserInstalledFonts)
+        : m_allowUserInstalledFonts(allowUserInstalledFonts)
+    {
+    }
 
     HashMap<String, InstalledFontFamily> m_familyNameToFontDescriptors;
     HashMap<String, InstalledFont> m_postScriptNameToFontDescriptors;
+    FontCache::AllowUserInstalledFonts m_allowUserInstalledFonts;
 };
 
 // Because this struct holds intermediate values which may be in the compressed -1 - 1 GX range, we don't want to use the relatively large
@@ -1124,9 +1171,10 @@ static const FontDatabase::InstalledFont* findClosestFont(const FontDatabase::In
 }
 #endif
 
-Vector<FontSelectionCapabilities> FontCache::getFontSelectionCapabilitiesInFamily(const AtomicString& familyName)
+Vector<FontSelectionCapabilities> FontCache::getFontSelectionCapabilitiesInFamily(const AtomicString& familyName, AllowUserInstalledFonts allowUserInstalledFonts)
 {
-    const auto& fonts = FontDatabase::singleton().collectionForFamily(familyName.string());
+    auto& fontDatabase = allowUserInstalledFonts == AllowUserInstalledFonts::Yes ? FontDatabase::singletonAllowingUserInstalledFonts() : FontDatabase::singletonDisallowingUserInstalledFonts();
+    const auto& fonts = fontDatabase.collectionForFamily(familyName.string());
     if (fonts.isEmpty())
         return { };
 
@@ -1142,17 +1190,19 @@ struct FontLookup {
     bool createdFromPostScriptName { false };
 };
 
-static FontLookup platformFontLookupWithFamily(const AtomicString& family, FontSelectionRequest request, float size)
+static FontLookup platformFontLookupWithFamily(const AtomicString& family, FontSelectionRequest request, float size, bool mayRepresentUserInstalledFont)
 {
     const auto& whitelist = fontWhitelist();
     if (!isSystemFont(family) && whitelist.size() && !whitelist.contains(family))
         return { nullptr };
 
 #if SHOULD_USE_CORE_TEXT_FONT_LOOKUP
+    UNUSED_PARAM(mayRepresentUserInstalledFont);
     CTFontSymbolicTraits traits = (isFontWeightBold(request.weight) ? kCTFontTraitBold : 0) | (isItalic(request.slope) ? kCTFontTraitItalic : 0);
     return { adoptCF(CTFontCreateForCSS(family.string().createCFString().get(), static_cast<float>(request.weight), traits, size)) };
 #else
-    const auto& familyFonts = FontDatabase::singleton().collectionForFamily(family.string());
+    auto& fontDatabase = mayRepresentUserInstalledFont ? FontDatabase::singletonAllowingUserInstalledFonts() : FontDatabase::singletonDisallowingUserInstalledFonts();
+    const auto& familyFonts = fontDatabase.collectionForFamily(family.string());
     if (familyFonts.isEmpty()) {
         // The CSS spec states that font-family only accepts a name of an actual font family. However, in WebKit, we claim to also
         // support supplying a PostScript name instead. However, this creates problems when the other properties (font-weight,
@@ -1161,7 +1211,7 @@ static FontLookup platformFontLookupWithFamily(const AtomicString& family, FontS
         // font-style specifies italic, then we run the regular matching algorithm on the family of the PostScript font. This way,
         // if content simply states "font-family: PostScriptName;" without specifying the other font properties, it will be honored,
         // but if a <b> appears as a descendent element, it will be honored too.
-        const auto& postScriptFont = FontDatabase::singleton().fontForPostScriptName(family);
+        const auto& postScriptFont = fontDatabase.fontForPostScriptName(family);
         if (!postScriptFont.fontDescriptor)
             return { nullptr };
         if ((isItalic(request.slope) && !isItalic(postScriptFont.capabilities.slope.maximum))
@@ -1169,7 +1219,7 @@ static FontLookup platformFontLookupWithFamily(const AtomicString& family, FontS
             auto postScriptFamilyName = adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(postScriptFont.fontDescriptor.get(), kCTFontFamilyNameAttribute)));
             if (!postScriptFamilyName)
                 return { nullptr };
-            const auto& familyFonts = FontDatabase::singleton().collectionForFamily(String(postScriptFamilyName.get()));
+            const auto& familyFonts = fontDatabase.collectionForFamily(String(postScriptFamilyName.get()));
             if (familyFonts.isEmpty())
                 return { nullptr };
             if (const auto* installedFont = findClosestFont(familyFonts, request)) {
@@ -1200,7 +1250,8 @@ static void invalidateFontCache()
 
     FontDescription::invalidateCaches();
 
-    FontDatabase::singleton().clear();
+    FontDatabase::singletonAllowingUserInstalledFonts().clear();
+    FontDatabase::singletonDisallowingUserInstalledFonts().clear();
 
     FontCache::singleton().invalidate();
 }
@@ -1214,7 +1265,7 @@ static RetainPtr<CTFontRef> fontWithFamily(const AtomicString& family, const Fon
     FontLookup fontLookup;
     fontLookup.result = platformFontWithFamilySpecialCase(family, request, size);
     if (!fontLookup.result)
-        fontLookup = platformFontLookupWithFamily(family, request, size);
+        fontLookup = platformFontLookupWithFamily(family, request, size, fontDescription.mayRepresentUserInstalledFont());
     return preparePlatformFont(fontLookup.result.get(), fontDescription, fontFaceFeatures, fontFaceVariantSettings, fontFaceCapabilities, size, !fontLookup.createdFromPostScriptName);
 }
 
index ae16d24..1d3e0df 100644 (file)
@@ -139,7 +139,7 @@ Ref<Font> FontCache::lastResortFallbackFont(const FontDescription& fontDescripti
     RELEASE_ASSERT_NOT_REACHED();
 }
 
-Vector<FontSelectionCapabilities> FontCache::getFontSelectionCapabilitiesInFamily(const AtomicString&)
+Vector<FontSelectionCapabilities> FontCache::getFontSelectionCapabilitiesInFamily(const AtomicString&, AllowUserInstalledFonts)
 {
     return { };
 }
index 527e3b6..b861a5c 100644 (file)
@@ -587,7 +587,7 @@ static int CALLBACK traitsInFamilyEnumProc(CONST LOGFONT* logFont, CONST TEXTMET
     return 1;
 }
 
-Vector<FontSelectionCapabilities> FontCache::getFontSelectionCapabilitiesInFamily(const AtomicString& familyName)
+Vector<FontSelectionCapabilities> FontCache::getFontSelectionCapabilitiesInFamily(const AtomicString& familyName, AllowUserInstalledFonts)
 {
     HWndDC hdc(0);
 
index 61b9c9e..cbf6723 100644 (file)
@@ -109,6 +109,7 @@ RenderStyle resolveForDocument(const Document& document)
     fontDescription.setLocale(document.contentLanguage());
     fontDescription.setRenderingMode(settings.fontRenderingMode());
     fontDescription.setOneFamily(standardFamily);
+    fontDescription.setMayRepresentUserInstalledFont(!settings.shouldDisallowUserInstalledFonts());
 
     fontDescription.setKeywordSizeFromIdentifier(CSSValueMedium);
     int size = fontSizeForKeyword(CSSValueMedium, false, document);
index 5cee2ed..046ffe9 100644 (file)
@@ -1,3 +1,21 @@
+2017-12-07  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [Cocoa] Add SPI to disallow user-installed fonts
+        https://bugs.webkit.org/show_bug.cgi?id=180062
+        <rdar://problem/35042408>
+
+        Reviewed by Simon Fraser.
+
+        * Shared/WebPreferences.yaml:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetShouldDisallowUserInstalledFonts):
+        (WKPreferencesGetShouldDisallowUserInstalledFonts):
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+        * UIProcess/API/Cocoa/WKPreferences.mm:
+        (-[WKPreferences _shouldDisallowUserInstalledFonts]):
+        (-[WKPreferences _setShouldDisallowUserInstalledFonts:]):
+        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
+
 2017-12-07  David Quesada  <david_quesada@apple.com>
 
         [Web App Manifest] Support display-mode media feature
index c532589..f0b5b8e 100644 (file)
@@ -1034,6 +1034,10 @@ VisibleDebugOverlayRegions:
   defaultValue: 0
   category: debug
 
+ShouldDisallowUserInstalledFonts:
+  type: bool
+  defaultValue: false
+
 
 # For experimental features:
 # The type should be boolean.
index c3daa7f..d303e49 100644 (file)
@@ -1919,3 +1919,13 @@ bool WKPreferencesGetAccessibilityObjectModelEnabled(WKPreferencesRef preference
 {
     return toImpl(preferencesRef)->accessibilityObjectModelEnabled();
 }
+
+void WKPreferencesSetShouldDisallowUserInstalledFonts(WKPreferencesRef preferencesRef, bool flag)
+{
+    toImpl(preferencesRef)->setShouldDisallowUserInstalledFonts(flag);
+}
+
+bool WKPreferencesGetShouldDisallowUserInstalledFonts(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->shouldDisallowUserInstalledFonts();
+}
index 78fa38b..6efcfe0 100644 (file)
@@ -544,6 +544,10 @@ WK_EXPORT bool WKPreferencesGetStorageAccessAPIEnabled(WKPreferencesRef);
 // Defaults to false
 WK_EXPORT void WKPreferencesSetAccessibilityObjectModelEnabled(WKPreferencesRef, bool flag);
 WK_EXPORT bool WKPreferencesGetAccessibilityObjectModelEnabled(WKPreferencesRef);
+
+// Defaults to false.
+WK_EXPORT void WKPreferencesSetShouldDisallowUserInstalledFonts(WKPreferencesRef, bool flag);
+WK_EXPORT bool WKPreferencesGetShouldDisallowUserInstalledFonts(WKPreferencesRef);
     
 #ifdef __cplusplus
 }
index b876b56..76f4044 100644 (file)
@@ -657,6 +657,16 @@ static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPo
     _preferences->setJavaScriptCanAccessClipboard(javaScriptCanAccessClipboard);
 }
 
+- (BOOL)_shouldDisallowUserInstalledFonts
+{
+    return _preferences->shouldDisallowUserInstalledFonts();
+}
+
+- (void)_setShouldDisallowUserInstalledFonts:(BOOL)_shouldDisallowUserInstalledFonts
+{
+    _preferences->setShouldDisallowUserInstalledFonts(_shouldDisallowUserInstalledFonts);
+}
+
 #if PLATFORM(MAC)
 - (void)_setJavaEnabledForLocalFiles:(BOOL)enabled
 {
index 2f88b9d..cb914fb 100644 (file)
@@ -115,6 +115,8 @@ typedef NS_OPTIONS(NSUInteger, _WKJavaScriptRuntimeFlags) {
 @property (nonatomic, setter=_setJavaScriptCanAccessClipboard:) BOOL _javaScriptCanAccessClipboard WK_API_AVAILABLE(macosx(10.13), ios(11.0));
 @property (nonatomic, setter=_setDOMPasteAllowed:) BOOL _domPasteAllowed WK_API_AVAILABLE(macosx(10.13), ios(11.0));
 
+@property (nonatomic, setter=_setShouldDisallowUserInstalledFonts:) BOOL _shouldDisallowUserInstalledFonts WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+
 + (NSArray<_WKExperimentalFeature *> *)_experimentalFeatures WK_API_AVAILABLE(macosx(10.12), ios(10.0));
 - (BOOL)_isEnabledForFeature:(_WKExperimentalFeature *)feature WK_API_AVAILABLE(macosx(10.12), ios(10.0));
 - (void)_setEnabled:(BOOL)value forFeature:(_WKExperimentalFeature *)feature WK_API_AVAILABLE(macosx(10.12), ios(10.0));
index 866074e..ec16948 100644 (file)
@@ -1,3 +1,29 @@
+2017-12-07  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        [Cocoa] Add SPI to disallow user-installed fonts
+        https://bugs.webkit.org/show_bug.cgi?id=180062
+        <rdar://problem/35042408>
+
+        Reviewed by Simon Fraser.
+
+        * WebKitTestRunner/InjectedBundle/ActivateFonts.h:
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
+        (WTR::InjectedBundlePage::resetAfterTest):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        * WebKitTestRunner/InjectedBundle/cocoa/ActivateFontsCocoa.mm:
+        (WTR::resourcesDirectoryURL):
+        (WTR::activateFonts):
+        (WTR::installFakeHelvetica):
+        (WTR::uninstallFakeHelvetica):
+        * WebKitTestRunner/InjectedBundle/mac/TestRunnerMac.mm:
+        (WTR::TestRunner::installFakeHelvetica):
+        * WebKitTestRunner/WebKitTestRunner.xcodeproj/project.pbxproj:
+        * WebKitTestRunner/fonts/FakeHelvetica-Helvetica-400.ttf: Added.
+        * WebKitTestRunner/fonts/FakeHelvetica-Helvetica-500.ttf: Added.
+        * WebKitTestRunner/fonts/FakeHelvetica-Helvetica2-400.ttf: Added.
+        * WebKitTestRunner/fonts/FakeHelvetica-Helvetica2-500.ttf: Added.
+
 2017-12-07  David Quesada  <david_quesada@apple.com>
 
         [Web App Manifest] Support display-mode media feature
index 5ee1276..5a0ae2c 100644 (file)
@@ -29,6 +29,8 @@
 namespace WTR {
 
 void activateFonts();
+void installFakeHelvetica(WKStringRef configuration);
+void uninstallFakeHelvetica();
 
 } // namespace WTR
 
index 4bbdec1..302f05e 100644 (file)
@@ -309,4 +309,6 @@ interface TestRunner {
     void removeAllSessionCredentials(object callback);
 
     void getApplicationManifestThen(object callback);
+
+    void installFakeHelvetica(DOMString configuration);
 };
index f130e00..dd64841 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "InjectedBundlePage.h"
 
+#include "ActivateFonts.h"
 #include "InjectedBundle.h"
 #include "StringFunctions.h"
 #include "WebCoreTestSupport.h"
@@ -435,6 +436,8 @@ void InjectedBundlePage::resetAfterTest()
 
     // User scripts need to be removed after the test and before loading about:blank, as otherwise they would run in about:blank, and potentially leak results into a subsequest test.
     WKBundlePageRemoveAllUserContent(m_page);
+
+    uninstallFakeHelvetica();
 }
 
 // Loader Client Callbacks
index 6040a1b..a755b57 100644 (file)
@@ -410,6 +410,8 @@ public:
     void getApplicationManifestThen(JSValueRef);
     void didGetApplicationManifest();
 
+    void installFakeHelvetica(JSStringRef configuration);
+
 private:
     TestRunner();
 
index 78b5beb..a73ca07 100644 (file)
@@ -28,6 +28,8 @@
 
 #import <CoreFoundation/CoreFoundation.h>
 #import <CoreText/CTFontManager.h>
+#import <WebKit/WKStringCF.h>
+#import <wtf/NeverDestroyed.h>
 #import <wtf/ObjcRuntimeExtras.h>
 #import <wtf/RetainPtr.h>
 
 
 namespace WTR {
 
+static NSURL *resourcesDirectoryURL()
+{
+    static NeverDestroyed<RetainPtr<NSURL *>> resourcesDirectory([[NSBundle bundleForClass:[WKTRFontActivatorDummyClass class]] resourceURL]);
+    return resourcesDirectory.get().get();
+}
+
 #if USE(APPKIT)
 
 // Activating system copies of these fonts overrides any others that could be preferred, such as ones
@@ -108,9 +116,8 @@ void activateFonts()
     };
 
     NSMutableArray *fontURLs = [NSMutableArray array];
-    NSURL *resourcesDirectory = [[NSBundle bundleForClass:[WKTRFontActivatorDummyClass class]] resourceURL];
     for (unsigned i = 0; fontFileNames[i]; ++i) {
-        NSURL *fontURL = [resourcesDirectory URLByAppendingPathComponent:[NSString stringWithUTF8String:fontFileNames[i]]];
+        NSURL *fontURL = [resourcesDirectoryURL() URLByAppendingPathComponent:[NSString stringWithUTF8String:fontFileNames[i]]];
         [fontURLs addObject:[fontURL absoluteURL]];
     }
 
@@ -126,5 +133,30 @@ void activateFonts()
 #endif // USE(APPKIT)
 }
 
+void installFakeHelvetica(WKStringRef configuration)
+{
+    RetainPtr<CFStringRef> configurationString = adoptCF(WKStringCopyCFString(kCFAllocatorDefault, configuration));
+    NSURL *resourceURL = [resourcesDirectoryURL() URLByAppendingPathComponent:[NSString stringWithFormat:@"FakeHelvetica-%@.ttf", configurationString.get()]];
+    CFErrorRef error = nullptr;
+    CTFontManagerRegisterFontsForURL(static_cast<CFURLRef>(resourceURL), kCTFontManagerScopeProcess, &error);
+}
+
+void uninstallFakeHelvetica()
+{
+    NSFileManager *defaultManager = [NSFileManager defaultManager];
+    NSError *nsError = nil;
+    NSArray *urls = [defaultManager contentsOfDirectoryAtURL:resourcesDirectoryURL() includingPropertiesForKeys:@[NSURLNameKey] options:NSDirectoryEnumerationSkipsSubdirectoryDescendants | NSDirectoryEnumerationSkipsPackageDescendants | NSDirectoryEnumerationSkipsHiddenFiles error:&nsError];
+    ASSERT(urls && !nsError);
+    if (!urls || nsError)
+        return;
+    NSMutableArray *fontsToRemove = [NSMutableArray array];
+    for (NSURL *url in urls) {
+        if ([[url lastPathComponent] hasPrefix:@"FakeHelvetica"])
+            [fontsToRemove addObject:url];
+    }
+    CFArrayRef errors = nullptr;
+    CTFontManagerUnregisterFontsForURLs(static_cast<CFArrayRef>(fontsToRemove), kCTFontManagerScopeProcess, &errors);
+}
+
 }
 
index 779451a..b4a7c4a 100644 (file)
@@ -26,6 +26,7 @@
 #import "config.h"
 #import "TestRunner.h"
 
+#import "ActivateFonts.h"
 #import "InjectedBundle.h"
 #import <JavaScriptCore/JSStringRefCF.h>
 
@@ -91,4 +92,9 @@ JSRetainPtr<JSStringRef> TestRunner::inspectorTestStubURL()
 #endif
 }
 
+void TestRunner::installFakeHelvetica(JSStringRef configuration)
+{
+    WTR::installFakeHelvetica(toWK(configuration).get());
+}
+
 } // namespace WTR
index a2ebb13..e97ffb1 100644 (file)
                0FEBF85A1BB61DF20028722D /* HIDEventGenerator.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0FEBF8591BB61DF20028722D /* HIDEventGenerator.mm */; };
                1CA211C91BCA107300B2101F /* FontWithFeatures.otf in Resources */ = {isa = PBXBuildFile; fileRef = 1CA211C71BCA107300B2101F /* FontWithFeatures.otf */; };
                1CA211CA1BCA107300B2101F /* FontWithFeatures.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1CA211C81BCA107300B2101F /* FontWithFeatures.ttf */; };
+               1CBA02961FD87DEC00179C7D /* FakeHelvetica-Helvetica2-500.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1CBA02951FD86EA100179C7D /* FakeHelvetica-Helvetica2-500.ttf */; };
+               1CBA02971FD87DEE00179C7D /* FakeHelvetica-Helvetica2-400.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1CBA02921FD86EA100179C7D /* FakeHelvetica-Helvetica2-400.ttf */; };
+               1CBA02981FD87DF000179C7D /* FakeHelvetica-Helvetica-500.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1CBA02931FD86EA100179C7D /* FakeHelvetica-Helvetica-500.ttf */; };
+               1CBA02991FD87DF300179C7D /* FakeHelvetica-Helvetica-400.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 1CBA02941FD86EA100179C7D /* FakeHelvetica-Helvetica-400.ttf */; };
                29210EAE144CACB700835BB5 /* AccessibilityUIElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29210EA9144CACB200835BB5 /* AccessibilityUIElement.cpp */; };
                29210EB0144CACBD00835BB5 /* AccessibilityController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29210EA2144CAAA500835BB5 /* AccessibilityController.cpp */; };
                29210EB4144CACD500835BB5 /* AccessibilityTextMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 29210EB1144CACD400835BB5 /* AccessibilityTextMarker.cpp */; };
                1A3326051B75396500F89F62 /* TestOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestOptions.h; sourceTree = "<group>"; };
                1CA211C71BCA107300B2101F /* FontWithFeatures.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = FontWithFeatures.otf; sourceTree = "<group>"; };
                1CA211C81BCA107300B2101F /* FontWithFeatures.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = FontWithFeatures.ttf; sourceTree = "<group>"; };
+               1CBA02921FD86EA100179C7D /* FakeHelvetica-Helvetica2-400.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "FakeHelvetica-Helvetica2-400.ttf"; path = "fonts/FakeHelvetica-Helvetica2-400.ttf"; sourceTree = "<group>"; };
+               1CBA02931FD86EA100179C7D /* FakeHelvetica-Helvetica-500.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "FakeHelvetica-Helvetica-500.ttf"; path = "fonts/FakeHelvetica-Helvetica-500.ttf"; sourceTree = "<group>"; };
+               1CBA02941FD86EA100179C7D /* FakeHelvetica-Helvetica-400.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "FakeHelvetica-Helvetica-400.ttf"; path = "fonts/FakeHelvetica-Helvetica-400.ttf"; sourceTree = "<group>"; };
+               1CBA02951FD86EA100179C7D /* FakeHelvetica-Helvetica2-500.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; name = "FakeHelvetica-Helvetica2-500.ttf"; path = "fonts/FakeHelvetica-Helvetica2-500.ttf"; sourceTree = "<group>"; };
                26D758E5160BECDC00268472 /* GeolocationProviderMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationProviderMock.cpp; sourceTree = "<group>"; };
                26D758E6160BECDD00268472 /* GeolocationProviderMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationProviderMock.h; sourceTree = "<group>"; };
                29210EA2144CAAA500835BB5 /* AccessibilityController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilityController.cpp; sourceTree = "<group>"; };
                        isa = PBXGroup;
                        children = (
                                6510A77711EC643800410867 /* AHEM____.TTF */,
+                               1CBA02941FD86EA100179C7D /* FakeHelvetica-Helvetica-400.ttf */,
+                               1CBA02931FD86EA100179C7D /* FakeHelvetica-Helvetica-500.ttf */,
+                               1CBA02921FD86EA100179C7D /* FakeHelvetica-Helvetica2-400.ttf */,
+                               1CBA02951FD86EA100179C7D /* FakeHelvetica-Helvetica2-500.ttf */,
                                1CA211C71BCA107300B2101F /* FontWithFeatures.otf */,
                                1CA211C81BCA107300B2101F /* FontWithFeatures.ttf */,
                                BC25186311D15D54002EBC01 /* InjectedBundle-Info.plist */,
                        buildActionMask = 2147483647;
                        files = (
                                6510A78211EC643800410867 /* AHEM____.TTF in Resources */,
+                               1CBA02991FD87DF300179C7D /* FakeHelvetica-Helvetica-400.ttf in Resources */,
+                               1CBA02981FD87DF000179C7D /* FakeHelvetica-Helvetica-500.ttf in Resources */,
+                               1CBA02971FD87DEE00179C7D /* FakeHelvetica-Helvetica2-400.ttf in Resources */,
+                               1CBA02961FD87DEC00179C7D /* FakeHelvetica-Helvetica2-500.ttf in Resources */,
                                1CA211C91BCA107300B2101F /* FontWithFeatures.otf in Resources */,
                                1CA211CA1BCA107300B2101F /* FontWithFeatures.ttf in Resources */,
                                6510A78411EC643800410867 /* WebKitWeightWatcher100.ttf in Resources */,
diff --git a/Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica-400.ttf b/Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica-400.ttf
new file mode 100644 (file)
index 0000000..0e5d3cd
Binary files /dev/null and b/Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica-400.ttf differ
diff --git a/Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica-500.ttf b/Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica-500.ttf
new file mode 100644 (file)
index 0000000..f1377dd
Binary files /dev/null and b/Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica-500.ttf differ
diff --git a/Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica2-400.ttf b/Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica2-400.ttf
new file mode 100644 (file)
index 0000000..341e0f2
Binary files /dev/null and b/Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica2-400.ttf differ
diff --git a/Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica2-500.ttf b/Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica2-500.ttf
new file mode 100644 (file)
index 0000000..2a9515a
Binary files /dev/null and b/Tools/WebKitTestRunner/fonts/FakeHelvetica-Helvetica2-500.ttf differ