Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 50a617392b54665ab539ee98ddb8c3ddef47b90e
      
https://github.com/WebKit/WebKit/commit/50a617392b54665ab539ee98ddb8c3ddef47b90e
  Author: Chris Dumez <[email protected]>
  Date:   2026-10-13 (Tue, 13 Oct 2026)

  Changed paths:
    M LayoutTests/ipc/serialized-type-info.html
    M Source/JavaScriptCore/parser/Lexer.cpp
    M Source/JavaScriptCore/parser/Lexer.h
    M Source/JavaScriptCore/runtime/IntlObject.cpp
    M Source/JavaScriptCore/runtime/LiteralParser.h
    M Source/WTF/wtf/FileSystem.cpp
    M Source/WTF/wtf/HexNumber.h
    M Source/WTF/wtf/SHA1.cpp
    M Source/WTF/wtf/StdLibExtras.h
    M Source/WTF/wtf/cocoa/SpanCocoa.h
    M Source/WTF/wtf/persistence/PersistentDecoder.h
    M Source/WTF/wtf/text/AdaptiveStringSearcher.h
    M Source/WTF/wtf/text/Base64.cpp
    M Source/WTF/wtf/text/IntegerToStringConversion.h
    M Source/WTF/wtf/text/Latin1Character.h
    M Source/WTF/wtf/text/ParsingUtilities.h
    M Source/WTF/wtf/text/StringBuilder.h
    M Source/WTF/wtf/text/StringCommon.h
    M Source/WTF/wtf/text/StringHasher.h
    M Source/WTF/wtf/text/StringImpl.h
    M Source/WTF/wtf/text/WTFString.cpp
    M Source/WTF/wtf/text/WTFString.h
    M Source/WebCore/Modules/websockets/WebSocketExtensionParser.cpp
    M Source/WebCore/PAL/pal/text/TextCodecCJK.cpp
    M Source/WebCore/PAL/pal/text/TextCodecSingleByte.cpp
    M Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp
    M Source/WebCore/platform/network/HTTPParsers.cpp
    M Source/WebCore/xml/XMLTreeViewer.cpp
    M Source/WebKit/Platform/IPC/DaemonDecoder.h
    M Source/WebKit/Platform/IPC/TransferString.cpp
    M Source/WebKit/Platform/IPC/TransferString.serialization.in
    M Source/WebKit/WPEPlatform/wpe/drm/WPEDisplayDRM.cpp
    M Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp
    M Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp
    M Tools/TestWebKitAPI/Tests/WebKit/WKPage/cocoa/FetchLocalFile.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/PermissionsAPI.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebTransport.mm
    M 
Tools/TestWebKitAPI/Tests/WebKitLegacy/cocoa/SubstituteDataLocalResourceAccess.mm

  Log Message:
  -----------
  Make Latin1Character a distinct type from uint8_t so it can imply character 
encoding as char8/16/32_t do
https://bugs.webkit.org/show_bug.cgi?id=296539
rdar://156856072

Reviewed by Sam Weinig.

Reland of Darin Adler's 300282@main (774c0dc407ae), rebased onto current trunk. 
The original
change was reverted in 300340@main because of a JetStream2 / JetStream3 
regression. However,
repeated testing shows there is no regression once PGO profiles are regenerated.

Latin1Character is now a struct so it can be a distinct type: Latin1Character 
means Latin-1,
char8_t means UTF-8, and uint8_t and char remain ambiguous about encoding.

Much of the preparatory work from the original patch has since landed 
separately (the LChar to
Latin1Character rename, SameSizeUnsignedInteger in the SIMD code paths, and 
many call site
updates), so this is smaller than the original.

* Source/WTF/wtf/text/Latin1Character.h: Make Latin1Character a struct in the 
WTF namespace, with
constexpr operators to smooth its use in code that treats it as an integer. 
Added the
IsStringStorageCharacter concept.

* Source/WTF/wtf/StdLibExtras.h: Include Latin1Character.h and allow 
Latin1Character in
CanBeConstByteType so byteCast and the byte-oriented find/equal helpers work 
with it.

* Source/WTF/wtf/text/StringCommon.h: Added IsFindableCharacter so the find() 
and contains()
templates accept Latin1Character. Without this, find(span<const 
Latin1Character>, char16_t)
recurses into itself.

* Source/WTF/wtf/text/StringImpl.h: Use IsStringStorageCharacter on 
tryCreateUninitialized, adopt,
and span. Reinterpret Latin1Character spans as uint8_t for the SIMD 
copyElements overloads.
Make conditional expression types explicit.
* Source/WTF/wtf/text/WTFString.h: Use IsStringStorageCharacter. Added 
span<const uint8_t>
overloads of fromUTF8, fromUTF8ReplacingInvalidSequences, and 
fromUTF8WithLatin1Fallback, since
uint8_t is no longer the same type as Latin1Character.
* Source/WTF/wtf/text/WTFString.cpp:
(WTF::String::latin1 const): Make conditional expression type explicit.

* Source/WTF/wtf/text/StringHasher.h:
(WTF::StringHasher::DefaultConverter::convert): Added Latin1Character overload.
* Source/WTF/wtf/text/ParsingUtilities.h:
(WTF::skipWhile): Added overload for uint8_t buffers parsed with a 
Latin1Character predicate.
* Source/WTF/wtf/HexNumber.h:
(WTF::Internal::appendHex): Added Latin1Character overload.
* Source/WTF/wtf/text/Base64.cpp:
(WTF::base64EncodeInternal): Pass char spans to simdutf.
(WTF::base64DecodeInternal): Take the vector type as the template parameter.
(WTF::base64DecodeToString): Decode into a Vector<Latin1Character>.
(WTF::fromBase64Impl): Pass char spans to simdutf.
(WTF::maxLengthFromBase64): Ditto.
* Source/WTF/wtf/SHA1.cpp:
(WTF::SHA1::addUTF8Bytes): Use asBytes.
* Source/WTF/wtf/cocoa/SpanCocoa.h:
(WTF::toNSData): Added Latin1Character overload.
(WTF::toNSDataNoCopy): Ditto.
* Source/WTF/wtf/persistence/PersistentDecoder.h:
(WTF::Persistence::Decoder::bufferIsLargeEnoughToContain const): Allow 
Latin1Character.

* Source/JavaScriptCore/parser/Lexer.cpp:
(JSC::Lexer<T>::peek const): Make conditional expression type explicit.
(JSC::Lexer<Latin1Character>::parseIdentifier): Ditto.
* Source/JavaScriptCore/parser/Lexer.h:
(JSC::Lexer<T>::scanSimpleArrayElementFollowedByComma): Ditto.
* Source/JavaScriptCore/runtime/LiteralParser.h: Ditto.
* Source/JavaScriptCore/runtime/IntlObject.cpp:
(JSC::parseVariantCode): Removed static assertion that Latin1Character is 
unsigned.

* Source/WebCore/Modules/websockets/WebSocketExtensionParser.cpp:
(WebCore::WebSocketExtensionParser::consumeToken): Cast to Latin1Character.
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::createStringByNormalizingSpaces): Make conditional expression type 
explicit.
* Source/WebCore/platform/network/HTTPParsers.cpp:
(WebCore::trimInputSample): Added uint8_t overload.
(WebCore::parseHTTPHeader): Cast to Latin1Character.
* Source/WebCore/xml/XMLTreeViewer.cpp:
(WebCore::XMLTreeViewer::transformDocumentToTreeView): Cast to Latin1Character.

* Source/WebKit/Platform/IPC/DaemonDecoder.h:
(WebKit::Daemon::Decoder::bufferIsLargeEnoughToContain const): Allow 
Latin1Character.
* Source/WebKit/Platform/IPC/TransferString.cpp:
(IPC::TransferString::createCopy): Cast to uint8_t.
* Source/WebKit/Platform/IPC/TransferString.serialization.in: Use span<const 
Latin1Character>.
* Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.cpp:
(WebKit::WebAutomationSessionProxy::scriptObjectForFrame): Cast to 
Latin1Character.

* Tools/TestWebKitAPI/Tests/WebCore/FileMonitor.cpp: Cast to Latin1Character.
* Tools/TestWebKitAPI/Tests/WebKit/WKPage/cocoa/FetchLocalFile.mm: Cast to 
uint8_t.
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WebTransport.mm: Ditto.
* 
Tools/TestWebKitAPI/Tests/WebKitLegacy/cocoa/SubstituteDataLocalResourceAccess.mm:
 Ditto.

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



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

Reply via email to