Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e1e849f259d0a32e603e644d6fc6b6ef8774ed22
      
https://github.com/WebKit/WebKit/commit/e1e849f259d0a32e603e644d6fc6b6ef8774ed22
  Author: Aditya Keerthi <akeer...@apple.com>
  Date:   2024-04-24 (Wed, 24 Apr 2024)

  Changed paths:
    M Source/WebCore/PAL/pal/spi/ios/GraphicsServicesSPI.h
    M Source/WebKit/DerivedSources-input.xcfilelist
    M Source/WebKit/DerivedSources.make
    M Source/WebKit/Shared/WebPageCreationParameters.h
    M Source/WebKit/Shared/WebPageCreationParameters.serialization.in
    A Source/WebKit/Shared/ios/HardwareKeyboardState.cpp
    A Source/WebKit/Shared/ios/HardwareKeyboardState.h
    A Source/WebKit/Shared/ios/HardwareKeyboardState.serialization.in
    M Source/WebKit/Shared/mac/MediaFormatReader/MediaSampleCursor.h
    M Source/WebKit/SourcesCocoa.txt
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/PageClient.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/WebPageProxyInternals.h
    M Source/WebKit/UIProcess/ios/PageClientImplIOS.h
    M Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
    M Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
    M 
WebKitLibraries/SDKs/appletvos16.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd
    M 
WebKitLibraries/SDKs/appletvos17.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd
    M 
WebKitLibraries/SDKs/appletvsimulator16.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd
    M 
WebKitLibraries/SDKs/appletvsimulator17.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd
    M 
WebKitLibraries/SDKs/iphoneos16.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd
    M 
WebKitLibraries/SDKs/iphoneos17.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd
    M 
WebKitLibraries/SDKs/iphonesimulator16.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd
    M 
WebKitLibraries/SDKs/iphonesimulator17.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd
    M 
WebKitLibraries/SDKs/watchos10.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd
    M 
WebKitLibraries/SDKs/watchos9.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd
    M 
WebKitLibraries/SDKs/watchsimulator10.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd
    M 
WebKitLibraries/SDKs/watchsimulator9.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd

  Log Message:
  -----------
  REGRESSION (277389@main): [iOS] AutoFill not offered on autofocus with an 
attached hardware keyboard
https://bugs.webkit.org/show_bug.cgi?id=273086
rdar://126653124

Reviewed by Chris Dumez, Abrar Rahman Protyasha and Richard Robinson.

Focusing a field without user interaction should not offer AutoFill unless there
is a hardware keyboard attached. In order to implement this behavior, Safari
checks the returned value of `GSEventIsHardwareKeyboardAttached()` in their
injected bundle.

Since that call is made in the web process, where notifyd is blocked following
277389@main, it always returns false, as `GSEventIsHardwareKeyboardAttached()`
relies on libnotify. Consequently, AutoFill is not offered until the user
actually taps on a field, even when a hardware keyboard is attached.

Simply updating `WebProcessPool::registerNotificationObservers` to register
for the hardware keyboard notification is not sufficient, as the returned value
of `GSEventIsHardwareKeyboardAttached()` will be incorrect if the process is
launched with the hardware keyboard already attached.

Fix by explicitly setting the state at process creation time, and whenever the
value changes, using 
`GSEventSetHardwareKeyboardAttachedWithCountryCodeAndType()`.
A new `HardwareKeyboardState` struct is introduced to represent the state across
process boundaries. Additionally suppress updates in the UI process if the state
is unchanged, to avoid notification loops in the simulator.

* Source/WebCore/PAL/pal/spi/ios/GraphicsServicesSPI.h:
* Source/WebKit/DerivedSources-input.xcfilelist:
* Source/WebKit/DerivedSources.make:
* Source/WebKit/Shared/WebPageCreationParameters.h:
* Source/WebKit/Shared/WebPageCreationParameters.serialization.in:
* Source/WebKit/Shared/ios/HardwareKeyboardState.cpp: Copied from 
Source/WebCore/PAL/pal/spi/ios/GraphicsServicesSPI.h.
(WebKit::currentHardwareKeyboardState):
(WebKit::setHardwareKeyboardState):
* Source/WebKit/Shared/ios/HardwareKeyboardState.h: Copied from 
Source/WebCore/PAL/pal/spi/ios/GraphicsServicesSPI.h.
* Source/WebKit/Shared/ios/HardwareKeyboardState.serialization.in: Added.
* Source/WebKit/Shared/mac/MediaFormatReader/MediaSampleCursor.h:

Unified sources build fix.

* Source/WebKit/SourcesCocoa.txt:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(hardwareKeyboardAvailabilityChangedCallback):
* Source/WebKit/UIProcess/PageClient.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::creationParameters):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxyInternals.h:
* Source/WebKit/UIProcess/ios/PageClientImplIOS.h:
* Source/WebKit/UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::hardwareKeyboardAvailabilityChanged):
* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::platformInitialize):
(WebKit::WebPageProxy::applicationWillEnterForeground):
(WebKit::WebPageProxy::hardwareKeyboardAvailabilityChanged):
(WebKit::WebPageProxy::isInHardwareKeyboardMode): Deleted.
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::platformInitialize):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::hardwareKeyboardAvailabilityChanged):
* 
WebKitLibraries/SDKs/appletvos16.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd:
* 
WebKitLibraries/SDKs/appletvos17.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd:
* 
WebKitLibraries/SDKs/appletvsimulator16.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd:
* 
WebKitLibraries/SDKs/appletvsimulator17.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd:
* 
WebKitLibraries/SDKs/iphoneos16.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd:
* 
WebKitLibraries/SDKs/iphoneos17.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd:
* 
WebKitLibraries/SDKs/iphonesimulator16.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd:
* 
WebKitLibraries/SDKs/iphonesimulator17.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd:
* 
WebKitLibraries/SDKs/watchos10.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd:
* 
WebKitLibraries/SDKs/watchos9.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd:
* 
WebKitLibraries/SDKs/watchsimulator10.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd:
* 
WebKitLibraries/SDKs/watchsimulator9.0-additions.sdk/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices.tbd:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to