Diff
Modified: branches/safari-612-branch/Source/WebCore/ChangeLog (285556 => 285557)
--- branches/safari-612-branch/Source/WebCore/ChangeLog 2021-11-10 03:28:57 UTC (rev 285556)
+++ branches/safari-612-branch/Source/WebCore/ChangeLog 2021-11-10 03:29:02 UTC (rev 285557)
@@ -1,5 +1,57 @@
2021-11-09 Alan Coon <[email protected]>
+ Cherry-pick r285318. rdar://problem/85168068
+
+ [Cocoa] Migrate from CTFontCopyVariationAxes() to CTFontCopyVariationAxesInternal() if possible
+ https://bugs.webkit.org/show_bug.cgi?id=232690
+
+ Reviewed by Simon Fraser and Cameron McCormack.
+
+ Source/WebCore:
+
+ CTFontCopyVariationAxesInternal() is faster than CTFontCopyVariationAxes(), but the strings
+ it provides are not localized. Luckily, we don't actually use the strings in the common case,
+ so we can migrate to CTFontCopyVariationAxesInternal() safely.
+
+ No new tests because there is no behavior change.
+
+ * platform/graphics/cocoa/FontCacheCoreText.cpp:
+ (WebCore::variationAxes):
+ (WebCore::defaultVariationValues):
+ (WebCore::preparePlatformFont):
+ * platform/graphics/cocoa/FontCacheCoreText.h:
+ * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+ (WebCore::FontPlatformData::variationAxes const):
+
+ Source/WebCore/PAL:
+
+ * pal/spi/cf/CoreTextSPI.h:
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285318 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-11-04 Myles C. Maxfield <[email protected]>
+
+ [Cocoa] Migrate from CTFontCopyVariationAxes() to CTFontCopyVariationAxesInternal() if possible
+ https://bugs.webkit.org/show_bug.cgi?id=232690
+
+ Reviewed by Simon Fraser and Cameron McCormack.
+
+ CTFontCopyVariationAxesInternal() is faster than CTFontCopyVariationAxes(), but the strings
+ it provides are not localized. Luckily, we don't actually use the strings in the common case,
+ so we can migrate to CTFontCopyVariationAxesInternal() safely.
+
+ No new tests because there is no behavior change.
+
+ * platform/graphics/cocoa/FontCacheCoreText.cpp:
+ (WebCore::variationAxes):
+ (WebCore::defaultVariationValues):
+ (WebCore::preparePlatformFont):
+ * platform/graphics/cocoa/FontCacheCoreText.h:
+ * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+ (WebCore::FontPlatformData::variationAxes const):
+
+2021-11-09 Alan Coon <[email protected]>
+
Cherry-pick r285169. rdar://problem/83950623
AX: WebKit needs to include NSAccessibilityChildrenInNavigationOrderAttribute in accessibilityAttributeNames
Modified: branches/safari-612-branch/Source/WebCore/Headers.cmake (285556 => 285557)
--- branches/safari-612-branch/Source/WebCore/Headers.cmake 2021-11-10 03:28:57 UTC (rev 285556)
+++ branches/safari-612-branch/Source/WebCore/Headers.cmake 2021-11-10 03:29:02 UTC (rev 285557)
@@ -1340,6 +1340,7 @@
platform/graphics/RenderingResourceIdentifier.h
platform/graphics/RenderingMode.h
platform/graphics/RoundedRect.h
+ platform/graphics/ShouldLocalizeAxisNames.h
platform/graphics/SourceBufferPrivate.h
platform/graphics/SourceBufferPrivateClient.h
platform/graphics/StringTruncator.h
Modified: branches/safari-612-branch/Source/WebCore/PAL/ChangeLog (285556 => 285557)
--- branches/safari-612-branch/Source/WebCore/PAL/ChangeLog 2021-11-10 03:28:57 UTC (rev 285556)
+++ branches/safari-612-branch/Source/WebCore/PAL/ChangeLog 2021-11-10 03:29:02 UTC (rev 285557)
@@ -1,3 +1,43 @@
+2021-11-09 Alan Coon <[email protected]>
+
+ Cherry-pick r285318. rdar://problem/85168068
+
+ [Cocoa] Migrate from CTFontCopyVariationAxes() to CTFontCopyVariationAxesInternal() if possible
+ https://bugs.webkit.org/show_bug.cgi?id=232690
+
+ Reviewed by Simon Fraser and Cameron McCormack.
+
+ Source/WebCore:
+
+ CTFontCopyVariationAxesInternal() is faster than CTFontCopyVariationAxes(), but the strings
+ it provides are not localized. Luckily, we don't actually use the strings in the common case,
+ so we can migrate to CTFontCopyVariationAxesInternal() safely.
+
+ No new tests because there is no behavior change.
+
+ * platform/graphics/cocoa/FontCacheCoreText.cpp:
+ (WebCore::variationAxes):
+ (WebCore::defaultVariationValues):
+ (WebCore::preparePlatformFont):
+ * platform/graphics/cocoa/FontCacheCoreText.h:
+ * platform/graphics/cocoa/FontPlatformDataCocoa.mm:
+ (WebCore::FontPlatformData::variationAxes const):
+
+ Source/WebCore/PAL:
+
+ * pal/spi/cf/CoreTextSPI.h:
+
+ git-svn-id: https://svn.webkit.org/repository/webkit/trunk@285318 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+ 2021-11-04 Myles C. Maxfield <[email protected]>
+
+ [Cocoa] Migrate from CTFontCopyVariationAxes() to CTFontCopyVariationAxesInternal() if possible
+ https://bugs.webkit.org/show_bug.cgi?id=232690
+
+ Reviewed by Simon Fraser and Cameron McCormack.
+
+ * pal/spi/cf/CoreTextSPI.h:
+
2021-11-04 Russell Epstein <[email protected]>
Cherry-pick r283480. rdar://problem/83732537
Modified: branches/safari-612-branch/Source/WebCore/PAL/pal/spi/cf/CoreTextSPI.h (285556 => 285557)
--- branches/safari-612-branch/Source/WebCore/PAL/pal/spi/cf/CoreTextSPI.h 2021-11-10 03:28:57 UTC (rev 285556)
+++ branches/safari-612-branch/Source/WebCore/PAL/pal/spi/cf/CoreTextSPI.h 2021-11-10 03:29:02 UTC (rev 285557)
@@ -158,6 +158,7 @@
CTFontRef CTFontCreateForCharactersWithLanguageAndOption(CTFontRef currentFont, const UTF16Char *characters, CFIndex length, CFStringRef language, CTFontFallbackOption, CFIndex *coveredLength);
CTFontRef CTFontCopyPhysicalFont(CTFontRef);
CTFontSymbolicTraits CTFontGetPhysicalSymbolicTraits(CTFontRef);
+CFArrayRef CTFontCopyVariationAxesInternal(CTFontRef);
extern const CFStringRef kCTUIFontTextStyleShortHeadline;
extern const CFStringRef kCTUIFontTextStyleShortBody;
Modified: branches/safari-612-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (285556 => 285557)
--- branches/safari-612-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-11-10 03:28:57 UTC (rev 285556)
+++ branches/safari-612-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-11-10 03:29:02 UTC (rev 285557)
@@ -636,6 +636,7 @@
1C24EEA91C72A7B40080F8FC /* JSFontFaceSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C24EEA71C72A7B40080F8FC /* JSFontFaceSet.h */; };
1C43DE6B22AB4B8A001527D9 /* LocalCurrentTraitCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C43DE6822AB4B8A001527D9 /* LocalCurrentTraitCollection.h */; settings = {ATTRIBUTES = (Private, ); }; };
1C4D0DD324D9F10D003D7498 /* GlyphBufferMembers.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C4D0DD124D9F0DB003D7498 /* GlyphBufferMembers.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 1C4DB02627339FE0007B0AD1 /* ShouldLocalizeAxisNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C4DB02427339E5E007B0AD1 /* ShouldLocalizeAxisNames.h */; settings = {ATTRIBUTES = (Private, ); }; };
1C6626111C6E7CA600AB527C /* FontFace.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C66260F1C6E7CA600AB527C /* FontFace.h */; };
1C73A7132185757E004CCEA5 /* TextUnderlineOffset.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CB6B4FB217B83940093B9CD /* TextUnderlineOffset.h */; settings = {ATTRIBUTES = (Private, ); }; };
1C73A71521857587004CCEA5 /* TextDecorationThickness.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CB6B4F8217B83930093B9CD /* TextDecorationThickness.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -6968,6 +6969,7 @@
1C43DE6822AB4B8A001527D9 /* LocalCurrentTraitCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalCurrentTraitCollection.h; sourceTree = "<group>"; };
1C43DE6A22AB4B8A001527D9 /* LocalCurrentTraitCollection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalCurrentTraitCollection.mm; sourceTree = "<group>"; };
1C4D0DD124D9F0DB003D7498 /* GlyphBufferMembers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GlyphBufferMembers.h; sourceTree = "<group>"; };
+ 1C4DB02427339E5E007B0AD1 /* ShouldLocalizeAxisNames.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShouldLocalizeAxisNames.h; sourceTree = "<group>"; };
1C50C49522C84F2400A6E4BE /* WHLSLStandardLibraryFunctionMap.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WHLSLStandardLibraryFunctionMap.cpp; sourceTree = "<group>"; };
1C66260E1C6E7CA600AB527C /* FontFace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontFace.cpp; sourceTree = "<group>"; };
1C66260F1C6E7CA600AB527C /* FontFace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontFace.h; sourceTree = "<group>"; };
@@ -18245,8 +18247,6 @@
isa = PBXGroup;
children = (
1A569CC50D7E2B82007C3983 /* c */,
- 59B5977111086556007159E8 /* jsc */,
- 1A569CE20D7E2B82007C3983 /* objc */,
599E758F11055A1F00D904FA /* Bridge.h */,
1A71D5790F33819000F9CE4E /* IdentifierRep.cpp */,
1A71D57A0F33819000F9CE4E /* IdentifierRep.h */,
@@ -18256,6 +18256,8 @@
1A569CDF0D7E2B82007C3983 /* npruntime_impl.h */,
1A569CE00D7E2B82007C3983 /* npruntime_internal.h */,
1A569CE10D7E2B82007C3983 /* npruntime_priv.h */,
+ 59B5977111086556007159E8 /* jsc */,
+ 1A569CE20D7E2B82007C3983 /* objc */,
1A569CEF0D7E2B82007C3983 /* runtime_array.cpp */,
1A569CF00D7E2B82007C3983 /* runtime_array.h */,
1A569CF10D7E2B82007C3983 /* runtime_method.cpp */,
@@ -26816,6 +26818,7 @@
A73F95FD12C97BFE0031AAF9 /* RoundedRect.h */,
0F3DD44D12F5EA1B000D9190 /* ShadowBlur.cpp */,
0F3DD44E12F5EA1B000D9190 /* ShadowBlur.h */,
+ 1C4DB02427339E5E007B0AD1 /* ShouldLocalizeAxisNames.h */,
1DD127AC256E3A8700B227D7 /* SourceBufferPrivate.cpp */,
CD641EB21818F5ED00EE4C41 /* SourceBufferPrivate.h */,
CDC8B5AC1804AE5D0016E685 /* SourceBufferPrivateClient.h */,
@@ -34675,6 +34678,7 @@
CD36C16B260A65CC00C8C529 /* SharedRoutingArbitrator.h in Headers */,
834DFAD01F7DAE5D00C2725B /* SharedStringHash.h in Headers */,
93309EA3099EB78C0056E581 /* SharedTimer.h in Headers */,
+ 1C4DB02627339FE0007B0AD1 /* ShouldLocalizeAxisNames.h in Headers */,
DF19E2AC24772BC1007BDACB /* ShouldRelaxThirdPartyCookieBlocking.h in Headers */,
8362E8C120CEF9CB00245886 /* ShouldTreatAsContinuingLoad.h in Headers */,
9316DDFB240C64B4009340AA /* SimpleRange.h in Headers */,
Modified: branches/safari-612-branch/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp (285556 => 285557)
--- branches/safari-612-branch/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp 2021-11-10 03:28:57 UTC (rev 285556)
+++ branches/safari-612-branch/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp 2021-11-10 03:29:02 UTC (rev 285557)
@@ -573,7 +573,7 @@
static Ref<Protocol::CSS::Font> buildObjectForFont(const Font& font)
{
auto resultVariationAxes = JSON::ArrayOf<Protocol::CSS::FontVariationAxis>::create();
- for (auto& variationAxis : font.platformData().variationAxes()) {
+ for (auto& variationAxis : font.platformData().variationAxes(ShouldLocalizeAxisNames::Yes)) {
auto axis = Protocol::CSS::FontVariationAxis::create()
.setTag(variationAxis.tag())
.setMinimumValue(variationAxis.minimumValue())
Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/FontPlatformData.cpp (285556 => 285557)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/FontPlatformData.cpp 2021-11-10 03:28:57 UTC (rev 285556)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/FontPlatformData.cpp 2021-11-10 03:29:02 UTC (rev 285557)
@@ -82,7 +82,7 @@
#endif
#if !PLATFORM(COCOA)
-Vector<FontPlatformData::FontVariationAxis> FontPlatformData::variationAxes() const
+Vector<FontPlatformData::FontVariationAxis> FontPlatformData::variationAxes(ShouldLocalizeAxisNames) const
{
// FIXME: <webkit.org/b/219614> Not implemented yet.
return { };
Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/FontPlatformData.h (285556 => 285557)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/FontPlatformData.h 2021-11-10 03:28:57 UTC (rev 285556)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/FontPlatformData.h 2021-11-10 03:29:02 UTC (rev 285557)
@@ -25,6 +25,7 @@
#pragma once
#include "SharedBuffer.h"
+#include "ShouldLocalizeAxisNames.h"
#include "TextFlags.h"
#include <wtf/Forward.h>
#include <wtf/RetainPtr.h>
@@ -179,7 +180,7 @@
bool isForTextCombine() const { return widthVariant() != FontWidthVariant::RegularWidth; } // Keep in sync with callers of FontDescription::setWidthVariant().
String familyName() const;
- Vector<FontVariationAxis> variationAxes() const;
+ Vector<FontVariationAxis> variationAxes(ShouldLocalizeAxisNames) const;
#if USE(CAIRO)
cairo_scaled_font_t* scaledFont() const { return m_scaledFont.get(); }
Added: branches/safari-612-branch/Source/WebCore/platform/graphics/ShouldLocalizeAxisNames.h (0 => 285557)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/ShouldLocalizeAxisNames.h (rev 0)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/ShouldLocalizeAxisNames.h 2021-11-10 03:29:02 UTC (rev 285557)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#pragma once
+
+#include <cstdint>
+
+namespace WebCore {
+
+enum class ShouldLocalizeAxisNames : uint8_t {
+ No,
+ Yes
+};
+
+}
Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (285556 => 285557)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2021-11-10 03:28:57 UTC (rev 285556)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2021-11-10 03:29:02 UTC (rev 285557)
@@ -297,10 +297,22 @@
return CFStringGetLength(fontName) > 0 && CFStringGetCharacterAtIndex(fontName, 0) == '.';
}
-VariationDefaultsMap defaultVariationValues(CTFontRef font)
+static RetainPtr<CFArrayRef> variationAxes(CTFontRef font, ShouldLocalizeAxisNames shouldLocalizeAxisNames)
{
+#if defined(HAVE_CTFontCopyVariationAxesInternal) // This macro is defined inside CoreText, not WebKit.
+ if (shouldLocalizeAxisNames == ShouldLocalizeAxisNames::Yes)
+ return adoptCF(CTFontCopyVariationAxes(font));
+ return adoptCF(CTFontCopyVariationAxesInternal(font));
+#else
+ UNUSED_PARAM(shouldLocalizeAxisNames);
+ return adoptCF(CTFontCopyVariationAxes(font));
+#endif
+}
+
+VariationDefaultsMap defaultVariationValues(CTFontRef font, ShouldLocalizeAxisNames shouldLocalizeAxisNames)
+{
VariationDefaultsMap result;
- auto axes = adoptCF(CTFontCopyVariationAxes(font));
+ auto axes = variationAxes(font, shouldLocalizeAxisNames);
if (!axes)
return result;
auto size = CFArrayGetCount(axes.get());
@@ -447,7 +459,7 @@
auto fontOpticalSizing = fontDescription.opticalSizing();
- auto defaultValues = defaultVariationValues(originalFont);
+ auto defaultValues = defaultVariationValues(originalFont, ShouldLocalizeAxisNames::No);
auto fontSelectionRequest = fontDescription.fontSelectionRequest();
auto fontStyleAxis = fontDescription.fontStyleAxis();
@@ -950,7 +962,7 @@
return result;
auto font = adoptCF(CTFontCreateWithFontDescriptor(fontDescriptor, 0, nullptr));
- auto variations = adoptCF(CTFontCopyVariationAxes(font.get()));
+ auto variations = variationAxes(font.get(), ShouldLocalizeAxisNames::No);
if (!variations)
return result;
Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h (285556 => 285557)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h 2021-11-10 03:28:57 UTC (rev 285556)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.h 2021-11-10 03:29:02 UTC (rev 285557)
@@ -29,6 +29,7 @@
#pragma once
#include "FontDescription.h"
+#include "ShouldLocalizeAxisNames.h"
#include <CoreText/CTFont.h>
@@ -70,5 +71,5 @@
void addAttributesForWebFonts(CFMutableDictionaryRef attributes, AllowUserInstalledFonts);
RetainPtr<CFSetRef> installedFontMandatoryAttributes(AllowUserInstalledFonts);
-VariationDefaultsMap defaultVariationValues(CTFontRef);
+VariationDefaultsMap defaultVariationValues(CTFontRef, ShouldLocalizeAxisNames);
}
Modified: branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm (285556 => 285557)
--- branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm 2021-11-10 03:28:57 UTC (rev 285556)
+++ branches/safari-612-branch/Source/WebCore/platform/graphics/cocoa/FontPlatformDataCocoa.mm 2021-11-10 03:29:02 UTC (rev 285557)
@@ -62,7 +62,7 @@
return nullptr;
}
-Vector<FontPlatformData::FontVariationAxis> FontPlatformData::variationAxes() const
+Vector<FontPlatformData::FontVariationAxis> FontPlatformData::variationAxes(ShouldLocalizeAxisNames shouldLocalizeAxisNames) const
{
auto platformFont = ctFont();
if (!platformFont)
@@ -69,7 +69,7 @@
return { };
Vector<FontVariationAxis> results;
- for (auto& [tag, values] : defaultVariationValues(platformFont))
+ for (auto& [tag, values] : defaultVariationValues(platformFont, shouldLocalizeAxisNames))
results.append(FontPlatformData::FontVariationAxis(values.axisName, String(tag.data(), tag.size()), values.defaultValue, values.minimumValue, values.maximumValue));
return results;