Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6a5b0e34236b1f47fe2250c5cb6e7934b4565527
      
https://github.com/WebKit/WebKit/commit/6a5b0e34236b1f47fe2250c5cb6e7934b4565527
  Author: John Cardullo <[email protected]>
  Date:   2026-10-08 (Thu, 08 Oct 2026)

  Changed paths:
    M Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp
    M Source/WebKit/UIProcess/API/glib/WebKitWindowProperties.cpp
    M Source/WebKit/UIProcess/API/glib/WebKitWindowProperties.h.in
    M Source/WebKit/UIProcess/API/glib/WebKitWindowPropertiesPrivate.h
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/glib/TestUIClient.cpp

  Log Message:
  -----------
  [GLib] Allow detecting custom geometry and popups in WebKitWindowProperties
https://bugs.webkit.org/show_bug.cgi?id=325290

Reviewed by Michael Catanzaro and Patrick Griffis.

When a new window is created without explicit dimension features (or via 
target="_blank"),
WebKitGTK in Source/WebCore/page/Page.cpp inherits the opener window's geometry 
as a fallback:

    #if PLATFORM(GTK)
        if (!windowRect.width())
                windowRect.setWidth(features.oldWindowRect.width());
        if (!windowRect.height())
                windowRect.setHeight(features.oldWindowRect.height());
    #endif

This geometry is sent to the UIProcess over IPC, causing WebKitWindowProperties 
to report
the opener window's dimensions via webkit_window_properties_get_geometry(). As 
a result,
tabbed embedders (such as Epiphany) cannot distinguish between an 
author-specified popup
(e.g. window.open('', '', 'width=1000,height=800')) and a regular page whose 
opener happened
to be 1000x800. Furthermore, WebCore's WindowFeatures::wantsPopup() calculation 
is not
exposed through the GLib API.

The Fix:
- Add a new "has-custom-geometry" GObject property and 
webkit_window_properties_get_has_custom_geometry()
  getter under PLATFORM(GTK). It evaluates to TRUE only if the page explicitly 
specified x, y,
  width (> 0), or height (> 0) window features, or if the window frame is 
subsequently resized
  via script (e.g. window.resizeTo()).
- Add a new "is-popup" GObject property and 
webkit_window_properties_get_is_popup() getter
  across GLib platforms, returning WindowFeatures::wantsPopup() per the HTML 
standard.
- Preserve existing webkit_window_properties_get_geometry() fallback behavior 
for backward
  compatibility with existing embedders.

Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/glib/TestUIClient.cpp

* Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp:
(UIClient::showPage):
(UIClient::setWindowFrame):
* Source/WebKit/UIProcess/API/glib/WebKitWindowProperties.h.in:
* Source/WebKit/UIProcess/API/glib/WebKitWindowPropertiesPrivate.h:
* Source/WebKit/UIProcess/API/glib/WebKitWindowProperties.cpp:
(webkitWindowPropertiesGetProperty):
(webkitWindowPropertiesSetProperty):
(webkit_window_properties_class_init):
(webkitWindowPropertiesSetHasCustomGeometry):
(webkitWindowPropertiesSetIsPopup):
(webkitWindowPropertiesUpdateFromWebWindowFeatures):
(webkit_window_properties_get_has_custom_geometry):
(webkit_window_properties_get_is_popup):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/glib/TestUIClient.cpp:
(TestWebKitAPI::UIClientTest::WindowProperties::WindowProperties):
(TestWebKitAPI::UIClientTest::WindowProperties::assertEqual const):
(TestWebKitAPI::UIClientTest::setFinalExpectedWindowProperties):
(TestWebKitAPI::UIClientTest::viewClose):
(TestWebKitAPI::testWebViewWindowProperties):
(TestWebKitAPI::testWebViewOpenWindowDefaultSize):
(TestWebKitAPI::testWebViewOpenWindowNoDefaultSize):
(TestWebKitAPI::testWebViewOpenWindowNoFeatures):
(TestWebKitAPI::testWebViewOpenWindowZeroSize):
(TestWebKitAPI::testWebViewWindowPropertiesResizeTo):
(beforeAll):

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



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

Reply via email to