Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f6491e12ca0be45502268e4cb24a105e0d274d76
      
https://github.com/WebKit/WebKit/commit/f6491e12ca0be45502268e4cb24a105e0d274d76
  Author: Richard Robinson <[email protected]>
  Date:   2025-11-29 (Sat, 29 Nov 2025)

  Changed paths:
    M Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
    M Source/WebCore/PAL/pal/CMakeLists.txt
    M Source/WebCore/PAL/pal/PALSwift.h
    M Source/WebCore/PAL/pal/PALSwift/CryptoKitShim.swift
    R Source/WebCore/PAL/pal/PALSwiftUtils.h
    M Source/WebCore/PAL/pal/crypto/CryptoDigest.h
    A Source/WebCore/PAL/pal/crypto/CryptoDigestHashFunction.h
    M Source/WebCore/PAL/pal/module.modulemap
    M Source/WebCore/PAL/pal/spi/cocoa/AVStreamDataParserSPI.h
    M Source/WebCore/PAL/pal/spi/cocoa/NSAccessibilitySPI.h
    M Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h
    M Source/WebCore/PAL/pal/spi/cocoa/URLFormattingSPI.h
    M Source/WebCore/PAL/pal/spi/ios/MediaPlayerSPI.h
    M Source/WebCore/PAL/pal/spi/ios/OpenGLESSPI.h
    M Source/WebCore/PAL/pal/spi/ios/QuickLookSPI.h
    M Source/WebCore/PAL/pal/spi/ios/SBSStatusBarSPI.h
    M Source/WebCore/PAL/pal/spi/mac/NSCellSPI.h
    M Source/WebCore/PAL/pal/spi/mac/NSImmediateActionGestureRecognizerSPI.h
    M Source/WebCore/PAL/pal/spi/mac/NSPasteboardSPI.h
    M Source/WebCore/PAL/pal/spi/mac/NSPopoverColorWellSPI.h
    M Source/WebCore/PAL/pal/spi/mac/NSPopoverSPI.h
    M Source/WebCore/PAL/pal/spi/mac/NSScrollingMomentumCalculatorSPI.h
    M Source/WebCore/PAL/pal/spi/mac/NSSearchFieldCellSPI.h
    M Source/WebCore/PAL/pal/spi/mac/NSSharingServicePickerSPI.h
    M Source/WebCore/PAL/pal/spi/mac/NSSharingServiceSPI.h
    M Source/WebCore/PAL/pal/spi/mac/NSTextFieldCellSPI.h
    M Source/WebCore/PAL/pal/spi/mac/NSTextTableSPI.h
    M Source/WebCore/crypto/CryptoAlgorithmIdentifier.h
    M Source/WebCore/crypto/cocoa/CryptoAlgorithmECDSAMac.cpp
    M Source/WebCore/crypto/cocoa/CryptoAlgorithmHKDFMac.cpp
    M Source/WebCore/crypto/cocoa/CryptoAlgorithmHMACMac.cpp
    M Source/WebKit/UIProcess/mac/WebColorPickerMac.mm

  Log Message:
  -----------
  [Swift in WebKit] Work towards modularizing PAL (part 2)
https://bugs.webkit.org/show_bug.cgi?id=303250
rdar://165544156

Reviewed by Mike Wyrzykowski.

More fixes made to previously incorrect PAL code.

* Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj:

- Remove PALSwiftUtils.h, and add CryptoDigestHashFunction.h (as a 
private-level header).

* Source/WebCore/PAL/pal/PALSwift.h:

- Remove unused `OptionalVectorUInt8` definition
- Because of the way PAL is currently incorrectly structured for Swift, an 
include of `CryptoDigestHashFunction.h` is needed before the generated Swift 
header is included.

* Source/WebCore/PAL/pal/PALSwift/CryptoKitShim.swift:
* Source/WebCore/PAL/pal/crypto/CryptoDigest.h:
* Source/WebCore/PAL/pal/crypto/CryptoDigestHashFunction.h:

Previously, both CryptoKitShim.swift and CryptoDigest.h had more or less the 
same type to represent a crypto digest hash function. De-duplicate this
logic by creating a separate C++ type shared by both files. This enum is C++ 
instead of Swift because (a) Swift-Cxx interop is significantly better
supported compared to reverse-interop, and (b) it is easier for this type to be 
used by a seperate module (aka WebCore) since it is invalid
for C++/Objective C to call Swift code from a different framework/module.

* Source/WebCore/PAL/pal/PALSwiftUtils.h: Removed.

Delete this file entirely, for several reasons:

- It doesn't really have anything to do with Swift specifically in the first 
place
- It defines symbols inside the WebCore namespace albeit being in PAL
- It was a project header included from a different framework, which is invalid
- It was dependent on the generated Swift header, which cannot cross 
module/framework boundaries
- It created a layering violation and dependency cycle since the file uses 
`CryptoAlgorithmIdentifier`, a type defined in WebCore
- It only "worked" in the first place because the functions inside of it get 
inlined into WebCore and was always an invalid header file
- The functions inside it are only used in WebCore

* Source/WebCore/crypto/CryptoAlgorithmIdentifier.h:
(WebCore::toCKHashFunction):
(WebCore::isValidHashParameter):
* Source/WebCore/crypto/cocoa/CryptoAlgorithmECDSAMac.cpp:
* Source/WebCore/crypto/cocoa/CryptoAlgorithmHKDFMac.cpp:
* Source/WebCore/crypto/cocoa/CryptoAlgorithmHMACMac.cpp:

- Move the functions from PALSwiftUtils to CryptoAlgorithmIdentifier

* Source/WebCore/PAL/pal/module.modulemap:

- Temporarily add a sub-module for Swift to be able to access 
`CryptoDigestHashFunction`; soon, this module map will be fixed to use an 
umbrella
header, so this will not be needed then.

* Source/WebCore/PAL/pal/spi/cocoa/AVStreamDataParserSPI.h:
* Source/WebCore/PAL/pal/spi/cocoa/NSAccessibilitySPI.h:
* Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h:
* Source/WebCore/PAL/pal/spi/cocoa/URLFormattingSPI.h:
* Source/WebCore/PAL/pal/spi/ios/MediaPlayerSPI.h:
* Source/WebCore/PAL/pal/spi/ios/OpenGLESSPI.h:
* Source/WebCore/PAL/pal/spi/ios/QuickLookSPI.h:
* Source/WebCore/PAL/pal/spi/ios/SBSStatusBarSPI.h:
* Source/WebCore/PAL/pal/spi/mac/NSCellSPI.h:
* Source/WebCore/PAL/pal/spi/mac/NSImmediateActionGestureRecognizerSPI.h:
* Source/WebCore/PAL/pal/spi/mac/NSPasteboardSPI.h:
* Source/WebCore/PAL/pal/spi/mac/NSPopoverColorWellSPI.h:
* Source/WebCore/PAL/pal/spi/mac/NSPopoverSPI.h:
* Source/WebCore/PAL/pal/spi/mac/NSScrollingMomentumCalculatorSPI.h:
* Source/WebCore/PAL/pal/spi/mac/NSSearchFieldCellSPI.h:
* Source/WebCore/PAL/pal/spi/mac/NSSharingServicePickerSPI.h:
* Source/WebCore/PAL/pal/spi/mac/NSSharingServiceSPI.h:
* Source/WebCore/PAL/pal/spi/mac/NSTextFieldCellSPI.h:
* Source/WebCore/PAL/pal/spi/mac/NSTextTableSPI.h:
* Source/WebKit/UIProcess/mac/WebColorPickerMac.mm:
(-[WKPopoverColorWell _showPopover]):

- Add missing compile time guards
- Add FIXMEs for issues that prevent proper modularization of PAL

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



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

Reply via email to