Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4fcbbaa907493ffbb2021ba01ef57fe873d43914
      
https://github.com/WebKit/WebKit/commit/4fcbbaa907493ffbb2021ba01ef57fe873d43914
  Author: Brent Fulgham <[email protected]>
  Date:   2026-09-18 (Fri, 18 Sep 2026)

  Changed paths:
    M Source/WebKit/UIProcess/API/APIUIClient.h
    M Source/WebKit/UIProcess/API/C/WKPage.cpp
    M Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp
    M Source/WebKit/UIProcess/Cocoa/UIDelegate.h
    M Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
    M Source/WebKit/UIProcess/PageClient.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/mac/PageClientImplMac.h
    M Source/WebKit/UIProcess/mac/PageClientImplMac.mm
    M Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/UIDelegate.mm

  Log Message:
  -----------
  [Cocoa] window.outerWidth/outerHeight may return 0 in cases where a client 
window is present
https://bugs.webkit.org/show_bug.cgi?id=324366
rdar://187603389

Reviewed by Aditya Keerthi.

The _webView:getWindowFrameWithCompletionHandler: is an optional UI delegate 
method. When a
client does not implement it, every layer hands back an empty rect. On macOS
LocalDOMWindow::outerWidth()/outerHeight() return page->chrome().windowRect(), 
so those
clients report window.outerWidth === 0 even though the view is sitting in a 
perfectly
ordinary on-screen NSWindow.

This is a regression from WebKitLegacy.

Restore that behavior for modern WebKit by falling back to the frame of the 
window actually
hosting the view when the UI client does not supply one. PageClient gains
windowFrameInDeviceSpace(), which returns std::nullopt when the view is not in 
a window,
so the CSSOM View requirement that these attributes "must return zero" when 
there is no
client window is still honored. We only stop reporting zero when a client window
demonstrably exists.

The fallback is applied in WebPageProxy rather than in UIDelegate so that it 
covers all
three callers of m_uiClient->windowFrame(), including 
windowAndViewFramesChanged(), which
populates the WebProcess-side cache that WebChromeClient::windowRect() consults 
before it
will do the GetWindowFrame IPC at all.

* Source/WebKit/UIProcess/API/APIUIClient.h:
(API::UIClient::windowFrame):
* Source/WebKit/UIProcess/API/C/WKPage.cpp:
(WKPageSetPageUIClient):
* Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp:
* Source/WebKit/UIProcess/Cocoa/UIDelegate.h:
* Source/WebKit/UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::UIClient::windowFrame):
* Source/WebKit/UIProcess/PageClient.h:
(WebKit::PageClient::windowFrameInDeviceSpace const):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::windowFrameRespectingHostingWindow):
(WebKit::WebPageProxy::getWindowFrame):
(WebKit::WebPageProxy::getWindowFrameWithCallback):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/mac/PageClientImplMac.h:
* Source/WebKit/UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::windowFrameInDeviceSpace const):
* Source/WebKit/UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::windowAndViewFramesChanged):
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::viewDidMoveToWindow):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/UIDelegate.mm:
((WebKit, WindowFrameFallsBackToHostingWindowWithoutUIDelegate)):
((WebKit, WindowFrameHonorsDelegateReturningEmptyRect)):
((WebKit, WindowFrameIsZeroWhenNotInAWindow)):
((WebKit, WindowFrameIsZeroAfterRemovalFromWindow)):

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



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

Reply via email to