Skip to content

Commit c58996c

Browse files
committed
CSS Font Loading API: Remove FontFaceSet constructor
https://bugs.webkit.org/show_bug.cgi?id=276794 rdar://132031306 Reviewed by Simon Fraser. The FontFaceSet constructor was considered not useful and is to be removed from the FontFaceSet interface as per [1] resolution. [1] w3c/csswg-drafts#10390 * LayoutTests/fast/text/font-face-api-preinstalled.html: * LayoutTests/fast/text/font-face-set-document-expected.txt: * LayoutTests/fast/text/font-face-set-document.html: * LayoutTests/fast/text/font-face-set-javascript.html: * LayoutTests/fast/text/font-loading-multiple-sets.html: * LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-add-css-connected-expected.txt: Removed. * LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-add-css-connected.html: Removed. Remove fontfaceset-add-css-connected.html as it fundamentally requires the FontFaceSet constructor to function. The test verifies that CSS-connected FontFace objects cannot be added to a separate FontFaceSet instance, but without the constructor, there is no way to create such a separate instance in a document context. This test scenario becomes impossible once the constructor is removed per the CSSWG resolution mentioned above [1]. * Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: * Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.h: * Source/WebCore/css/FontFaceSet.idl: * Source/WebKit/Shared/WebPreferencesDefaultValues.cpp: (WebKit::defaultFontFaceSetConstructorEnabled): * Source/WebKit/Shared/WebPreferencesDefaultValues.h: * Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.h: * Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.mm: (WebKit::defaultFontFaceSetConstructorEnabled): Canonical link: https://commits.webkit.org/304912@main
1 parent b7cff56 commit c58996c

File tree

13 files changed

+39
-42
lines changed

13 files changed

+39
-42
lines changed

LayoutTests/fast/text/font-face-api-preinstalled.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!DOCTYPE html><!-- webkit-test-runner [ FontFaceSetConstructorEnabled=true ] -->
22
<html>
33
<head>
44
<script src="../../resources/js-test-pre.js"></script>

LayoutTests/fast/text/font-face-set-document.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!DOCTYPE html><!-- webkit-test-runner [ FontFaceSetConstructorEnabled=true ] -->
22
<html>
33
<head>
44
<script src="../../resources/js-test-pre.js"></script>

LayoutTests/fast/text/font-face-set-javascript.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!DOCTYPE html><!-- webkit-test-runner [ FontFaceSetConstructorEnabled=true ] -->
22
<head>
33
<script src="../../resources/js-test-pre.js"></script>
44
</head>

LayoutTests/fast/text/font-loading-multiple-sets.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!DOCTYPE html><!-- webkit-test-runner [ FontFaceSetConstructorEnabled=true ] -->
22
<html>
33
<head>
44
<script src="../../resources/js-test-pre.js"></script>

LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-add-css-connected-expected.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.

LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-add-css-connected.html

Lines changed: 0 additions & 28 deletions
This file was deleted.

Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3154,6 +3154,20 @@ FlexFormattingContextIntegrationEnabled:
31543154
WebCore:
31553155
default: true
31563156

3157+
FontFaceSetConstructorEnabled:
3158+
type: bool
3159+
status: developer
3160+
category: dom
3161+
humanReadableName: "Legacy FontFaceSet Constructor API"
3162+
humanReadableDescription: "Legacy FontFaceSet Constructor API"
3163+
defaultValue:
3164+
WebKitLegacy:
3165+
default: WebKit::defaultFontFaceSetConstructorEnabled()
3166+
WebKit:
3167+
default: WebKit::defaultFontFaceSetConstructorEnabled()
3168+
WebCore:
3169+
default: false
3170+
31573171
ForceAlwaysUserScalable:
31583172
type: bool
31593173
status: internal

Source/WTF/wtf/cocoa/RuntimeApplicationChecksCocoa.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ enum class SDKAlignedBehavior {
133133
ExecutionTimingChangeOfModuleScripts,
134134
GetBoundingClientRectZoomed,
135135
CrashWhenMutatingProcessAssertionsFromBackgroundThread,
136+
NoFontFaceSetConstructor,
136137

137138
NumberOfBehaviors
138139
};

Source/WebCore/css/FontFaceSet.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ enum FontFaceSetLoadStatus {
3434
ActiveDOMObject,
3535
Exposed=(Window,Worker)
3636
] interface FontFaceSet : EventTarget {
37-
[CallWith=CurrentScriptExecutionContext] constructor(sequence<FontFace> initialFaces);
37+
[EnabledBySetting=FontFaceSetConstructorEnabled, CallWith=CurrentScriptExecutionContext] constructor(sequence<FontFace> initialFaces);
3838

3939
boolean has(FontFace font);
4040

Source/WebKit/Shared/WebPreferencesDefaultValues.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,16 @@ bool defaultFacebookLiveRecordingQuirkEnabled()
454454
#endif
455455
}
456456

457+
bool defaultFontFaceSetConstructorEnabled()
458+
{
459+
#if PLATFORM(COCOA)
460+
static bool newSDK = linkedOnOrAfterSDKWithBehavior(SDKAlignedBehavior::NoFontFaceSetConstructor);
461+
return !newSDK;
462+
#else
463+
return false;
464+
#endif
465+
}
466+
457467
#if !PLATFORM(COCOA)
458468
bool defaultContentInsetBackgroundFillEnabled()
459469
{

0 commit comments

Comments
 (0)