Diff
Modified: trunk/Source/WebCore/ChangeLog (279300 => 279301)
--- trunk/Source/WebCore/ChangeLog 2021-06-25 23:17:15 UTC (rev 279300)
+++ trunk/Source/WebCore/ChangeLog 2021-06-26 00:09:16 UTC (rev 279301)
@@ -1,3 +1,19 @@
+2021-06-25 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [macOS] -[NSString _web_widthWithFont:] returns 0
+ https://bugs.webkit.org/show_bug.cgi?id=227385
+ <rdar://problem/79430938>
+
+ Reviewed by Simon Fraser.
+
+ Simply take the iOS codepath on macOS.
+
+ Test: WebKitLegacyStringWidth.ThaiWidthForWeb
+
+ * platform/graphics/FontCascade.cpp:
+ * platform/graphics/coretext/FontCascadeCoreText.cpp:
+ (WebCore::FontCascade::FontCascade):
+
2021-06-22 Dean Jackson <d...@apple.com>
Add support for MTLSharedTextures in WebXR
Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (279300 => 279301)
--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp 2021-06-25 23:17:15 UTC (rev 279300)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp 2021-06-26 00:09:16 UTC (rev 279301)
@@ -89,21 +89,6 @@
{
}
-// FIXME: We should make this constructor platform-independent.
-FontCascade::FontCascade(const FontPlatformData& fontData, FontSmoothingMode fontSmoothingMode)
- : m_fonts(FontCascadeFonts::createForPlatformFont(fontData))
- , m_enableKerning(computeEnableKerning())
- , m_requiresShaping(computeRequiresShaping())
-{
- m_fontDescription.setFontSmoothing(fontSmoothingMode);
-#if PLATFORM(IOS_FAMILY)
- m_fontDescription.setSpecifiedSize(CTFontGetSize(fontData.font()));
- m_fontDescription.setComputedSize(CTFontGetSize(fontData.font()));
- m_fontDescription.setIsItalic(CTFontGetSymbolicTraits(fontData.font()) & kCTFontTraitItalic);
- m_fontDescription.setWeight((CTFontGetSymbolicTraits(fontData.font()) & kCTFontTraitBold) ? boldWeightValue() : normalWeightValue());
-#endif
-}
-
FontCascade::FontCascade(const FontCascade& other)
: m_fontDescription(other.m_fontDescription)
, m_fonts(other.m_fonts)
Modified: trunk/Source/WebCore/platform/graphics/coretext/FontCascadeCoreText.cpp (279300 => 279301)
--- trunk/Source/WebCore/platform/graphics/coretext/FontCascadeCoreText.cpp 2021-06-25 23:17:15 UTC (rev 279300)
+++ trunk/Source/WebCore/platform/graphics/coretext/FontCascadeCoreText.cpp 2021-06-26 00:09:16 UTC (rev 279301)
@@ -42,6 +42,18 @@
namespace WebCore {
+FontCascade::FontCascade(const FontPlatformData& fontData, FontSmoothingMode fontSmoothingMode)
+ : m_fonts(FontCascadeFonts::createForPlatformFont(fontData))
+ , m_enableKerning(computeEnableKerning())
+ , m_requiresShaping(computeRequiresShaping())
+{
+ m_fontDescription.setFontSmoothing(fontSmoothingMode);
+ m_fontDescription.setSpecifiedSize(CTFontGetSize(fontData.ctFont()));
+ m_fontDescription.setComputedSize(CTFontGetSize(fontData.ctFont()));
+ m_fontDescription.setIsItalic(CTFontGetSymbolicTraits(fontData.ctFont()) & kCTFontTraitItalic);
+ m_fontDescription.setWeight((CTFontGetSymbolicTraits(fontData.ctFont()) & kCTFontTraitBold) ? boldWeightValue() : normalWeightValue());
+}
+
static const AffineTransform& rotateLeftTransform()
{
static AffineTransform result(0, -1, 1, 0, 0, 0);
Modified: trunk/Tools/ChangeLog (279300 => 279301)
--- trunk/Tools/ChangeLog 2021-06-25 23:17:15 UTC (rev 279300)
+++ trunk/Tools/ChangeLog 2021-06-26 00:09:16 UTC (rev 279301)
@@ -1,3 +1,15 @@
+2021-06-25 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [macOS] -[NSString _web_widthWithFont:] returns 0
+ https://bugs.webkit.org/show_bug.cgi?id=227385
+ <rdar://problem/79430938>
+
+ Reviewed by Simon Fraser.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/mac/StringWidth.mm: Added.
+ (TEST):
+
2021-06-25 Ziran Sun <z...@igalia.com>
Add myself to contributor list
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (279300 => 279301)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2021-06-25 23:17:15 UTC (rev 279300)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2021-06-26 00:09:16 UTC (rev 279301)
@@ -117,6 +117,7 @@
1C79201C234BDD9B001EAF23 /* CopyRTF.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C79201B234BDD9B001EAF23 /* CopyRTF.mm */; };
1C7FEB20207C0F2E00D23278 /* BackgroundColor.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C7FEB1F207C0F2D00D23278 /* BackgroundColor.mm */; };
1C81802725FB09E200608B3E /* FontRegistrySandboxCheck.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C81802625FB09E200608B3E /* FontRegistrySandboxCheck.mm */; };
+ 1C8FA53A2685A6D500B7E49E /* StringWidth.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C8FA5392685A6D500B7E49E /* StringWidth.mm */; };
1C90420C2326E03C00BEF91E /* SelectionByWord.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1C90420B2326E03C00BEF91E /* SelectionByWord.mm */; };
1C9EB8411E380DA1005C6442 /* ComplexTextController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C9EB8401E380DA1005C6442 /* ComplexTextController.cpp */; };
1CACADA1230620AE0007D54C /* WKWebViewOpaque.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1CACADA0230620AD0007D54C /* WKWebViewOpaque.mm */; };
@@ -1873,6 +1874,7 @@
1C79201B234BDD9B001EAF23 /* CopyRTF.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CopyRTF.mm; sourceTree = "<group>"; };
1C7FEB1F207C0F2D00D23278 /* BackgroundColor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = BackgroundColor.mm; sourceTree = "<group>"; };
1C81802625FB09E200608B3E /* FontRegistrySandboxCheck.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FontRegistrySandboxCheck.mm; sourceTree = "<group>"; };
+ 1C8FA5392685A6D500B7E49E /* StringWidth.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = StringWidth.mm; sourceTree = "<group>"; };
1C90420B2326E03C00BEF91E /* SelectionByWord.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SelectionByWord.mm; sourceTree = "<group>"; };
1C9EB8401E380DA1005C6442 /* ComplexTextController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ComplexTextController.cpp; sourceTree = "<group>"; };
1CACADA0230620AD0007D54C /* WKWebViewOpaque.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewOpaque.mm; sourceTree = "<group>"; };
@@ -4762,6 +4764,7 @@
E194E1BA177E5145009C4D4E /* StopLoadingFromDidReceiveResponse.mm */,
3799AD3914120A43005EB0C6 /* StringByEvaluatingJavaScriptFromString.mm */,
939BFE3918E5548900883275 /* StringTruncator.mm */,
+ 1C8FA5392685A6D500B7E49E /* StringWidth.mm */,
37A6895D148A9B50005100FA /* SubresourceErrorCrash.mm */,
E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */,
536770331CC8022800D425B1 /* WebScriptObjectDescription.mm */,
@@ -5767,6 +5770,7 @@
7CCE7ED01A411A7E00447C4C /* StringByEvaluatingJavaScriptFromString.mm in Sources */,
7CCE7ED11A411A7E00447C4C /* StringTruncator.mm in Sources */,
ECA680CE1E68CC0900731D20 /* StringUtilities.mm in Sources */,
+ 1C8FA53A2685A6D500B7E49E /* StringWidth.mm in Sources */,
CE4D5DE71F6743BA0072CFC6 /* StringWithDirection.cpp in Sources */,
41E67A8525D16E83007B0A4C /* STUNMessageParsingTest.cpp in Sources */,
7CCE7ED21A411A7E00447C4C /* SubresourceErrorCrash.mm in Sources */,
Added: trunk/Tools/TestWebKitAPI/Tests/mac/StringWidth.mm (0 => 279301)
--- trunk/Tools/TestWebKitAPI/Tests/mac/StringWidth.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/StringWidth.mm 2021-06-26 00:09:16 UTC (rev 279301)
@@ -0,0 +1,41 @@
+/*
+ * 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.
+ */
+
+#import "config.h"
+
+#if PLATFORM(MAC)
+
+#import <AppKit/AppKit.h>
+#import <Foundation/Foundation.h>
+#import <WebKit/WebKitNSStringExtras.h>
+
+TEST(WebKitLegacyStringWidth, ThaiWidthForWeb)
+{
+ NSString *testString = @"ค้นหาใน";
+ float result = [testString _web_widthWithFont:[NSFont systemFontOfSize:16]];
+ EXPECT_GE(result, 20);
+}
+
+#endif