Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c1e16fd16e14611ae6f3afba50a0fde1ea4a8dde
      
https://github.com/WebKit/WebKit/commit/c1e16fd16e14611ae6f3afba50a0fde1ea4a8dde
  Author: Tim Horton <[email protected]>
  Date:   2026-04-21 (Tue, 21 Apr 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/editing/run/inserttext_2001-last-expected.txt
    M 
LayoutTests/platform/ios-simulator-18/imported/w3c/web-platform-tests/editing/run/inserttext_2001-last-expected.txt
    M 
LayoutTests/platform/ios/imported/w3c/web-platform-tests/editing/run/inserttext_2001-last-expected.txt
    M Source/WebCore/editing/ApplyStyleCommand.cpp
    M Source/WebCore/editing/EditingStyle.cpp
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/FontManagerTests.mm
    A Tools/TestWebKitAPI/Tests/WebKit/WebPage/EditingFontSizeTests.swift

  Log Message:
  -----------
  Setting font to a size that matches a legacy <font> size are not portable and 
are rendered incorrectly with different default font sizes
https://bugs.webkit.org/show_bug.cgi?id=312755
rdar://15292320

Reviewed by Wenson Hsieh and Ryosuke Niwa.

When applying a font change, if the new font size matches a legacy <font> 
integer size,
we'll apply that instead of an explicit point size. This is all well and good,
except that it's not portable, because the legacy sizes are relative to the web 
view's
default font size, which can (and does!) vary.

Fix this by leaving the explicit point size intact when possible. We still wrap
it in a <font> tag with a legacy size for compatibility's sake, but override
it with a proper point size for renderers that speak proper CSS.

Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/EditingFontSizeTests.swift

* 
LayoutTests/imported/w3c/web-platform-tests/editing/run/inserttext_2001-last-expected.txt:
* 
LayoutTests/platform/ios-simulator-18/imported/w3c/web-platform-tests/editing/run/inserttext_2001-last-expected.txt:
* 
LayoutTests/platform/ios/imported/w3c/web-platform-tests/editing/run/inserttext_2001-last-expected.txt:
* Source/WebCore/editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyInlineStyleChange):
* Source/WebCore/editing/EditingStyle.cpp:
(WebCore::StyleChange::extractTextStyles):
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/FontManagerTests.mm:
(TestWebKitAPI::TEST(FontManagerTests, ChangeFontWithPanel)):
* Tools/TestWebKitAPI/Tests/WebKit/WebPage/EditingFontSizeTests.swift: Added.
(EditingFontSizeTests.fontSizeMatchingLegacySizePreservesCSSValue):

Canonical link: https://commits.webkit.org/311700@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to