Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 74cd1a931428159efb1200511a7b70740cfd526a
      
https://github.com/WebKit/WebKit/commit/74cd1a931428159efb1200511a7b70740cfd526a
  Author: Jintian Wang <[email protected]>
  Date:   2026-03-27 (Fri, 27 Mar 2026)

  Changed paths:
    M Source/WebCore/platform/ValidationBubble.h
    M Source/WebCore/platform/ios/ValidationBubbleIOS.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
    M Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h
    M Source/WebKit/UIProcess/PageClient.h
    M Source/WebKit/UIProcess/ios/PageClientImplIOS.h
    M Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
    M Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/FormValidation.mm

  Log Message:
  -----------
  Create SPI to suppress form validation bubble presentation
https://bugs.webkit.org/show_bug.cgi?id=310695
rdar://173305613

Reviewed by Aditya Keerthi and Abrar Rahman Protyasha.

Add SPI to suppress form validation bubble presentation. The validation bubble
could appear unexpectedly when the host app's window is invisible.

Consider the context: when WebView is hosted inside a remote view service,
ValidationBubble::show() presents a popover via m_presentingViewController,
which is the service's view controller. This controller only has access to the
remote window layer, not the host app's actual UIWindow.

One approach of checking the host app's window visibility directly from
ValidationBubble::show() was considered, but is not easily feasible because the
presenting view controller lives in the service process and cannot observe the
host app's window state. Additionally, a visibility check at show() time would
be susceptible to timing issues if the window state changes.

Instead, this patch adds a WKWebView SPI property that clients can set to
unconditionally suppress validation bubble presentation. Once set, the bubble
will not show. This follows the same pattern as
_shouldSuppressTopColorExtensionView.

* Source/WebCore/platform/ValidationBubble.h:
* Source/WebCore/platform/ios/ValidationBubbleIOS.mm:
(WebCore::ValidationBubble::setShouldSuppressPresentation):
(WebCore::ValidationBubble::show):
Implement setShouldSuppressPresentation and add early return in show() when
suppression is enabled.

* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _shouldSuppressFormValidationBubble]):
(-[WKWebView _setShouldSuppressFormValidationBubble:]):
Implement getter and setter for _shouldSuppressFormValidationBubble

* Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h:
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h:
Declare _shouldSuppressFormValidationBubble SPI property for iOS and visionOS

* Source/WebKit/UIProcess/PageClient.h:
(WebKit::PageClient::shouldSuppressFormValidationBubble const):
* Source/WebKit/UIProcess/ios/PageClientImplIOS.h:
* Source/WebKit/UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::shouldSuppressFormValidationBubble const):
* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::showValidationMessage):
Query PageClient for the suppression flag and propagate it to the newly created
ValidationBubble.

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



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

Reply via email to