Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: bb06bdc992326258c402dd4594c2cffd77ca3795
https://github.com/WebKit/WebKit/commit/bb06bdc992326258c402dd4594c2cffd77ca3795
Author: Aditya Keerthi <[email protected]>
Date: 2026-10-01 (Thu, 01 Oct 2026)
Changed paths:
M LayoutTests/fast/dom/navigator-detached-no-crash-expected.txt
M LayoutTests/platform/gtk/fast/dom/navigator-detached-no-crash-expected.txt
M
LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt
M LayoutTests/platform/win/fast/dom/navigator-detached-no-crash-expected.txt
M LayoutTests/platform/wpe/fast/dom/navigator-detached-no-crash-expected.txt
M Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
M Source/WTF/wtf/PlatformHave.h
M Source/WebCore/CMakeLists.txt
M Source/WebCore/DerivedSources-input.xcfilelist
M Source/WebCore/DerivedSources-output.xcfilelist
M Source/WebCore/DerivedSources.make
M Source/WebCore/Headers.cmake
A Source/WebCore/Modules/device-posture/DevicePosture.cpp
A Source/WebCore/Modules/device-posture/DevicePosture.h
A Source/WebCore/Modules/device-posture/DevicePosture.idl
A Source/WebCore/Modules/device-posture/DevicePostureType.h
A Source/WebCore/Modules/device-posture/DevicePostureType.idl
A Source/WebCore/Modules/device-posture/Navigator+DevicePosture.idl
A Source/WebCore/Modules/device-posture/NavigatorDevicePosture.cpp
A Source/WebCore/Modules/device-posture/NavigatorDevicePosture.h
M Source/WebCore/Modules/geolocation/Geolocation.cpp
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/bindings/js/WebCoreBuiltinNames.h
M Source/WebCore/css/CSSValueKeywords.in
M Source/WebCore/css/query/MediaQueryFeatures.cpp
M Source/WebCore/css/query/MediaQueryFeatures.h
M Source/WebCore/dom/EventTargetFactory.in
M Source/WebCore/page/ChromeClient.h
M Source/WebCore/page/Page.cpp
M Source/WebCore/page/Page.h
M Source/WebCore/platform/Supplementable.h
M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/WebPageProxy.h
M Source/WebKit/UIProcess/WebPageProxyInternals.h
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h
M Source/WebKit/WebProcess/WebPage/WebPage.cpp
M Source/WebKit/WebProcess/WebPage/WebPage.h
M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
Log Message:
-----------
Implement the Device Posture API
https://bugs.webkit.org/show_bug.cgi?id=325585
rdar://187132802
Reviewed by Tim Nguyen.
Implement the Device Posture API behind an off-by-default feature flag.
The Device Posture API allows applications to request and be notified of
changes of the posture of a device. The posture may be either "continuous" or
"folded". The implementation adds a `DevicePosture` object to `Navigator` and a
device-posture media query.
Devices that do not support a folded state will always report as continuous.
Tests to come in a separate patch.
Spec: https://w3c.github.io/device-posture/#dom-deviceposture
* LayoutTests/fast/dom/navigator-detached-no-crash-expected.txt:
* LayoutTests/platform/gtk/fast/dom/navigator-detached-no-crash-expected.txt:
*
LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt:
* LayoutTests/platform/win/fast/dom/navigator-detached-no-crash-expected.txt:
* LayoutTests/platform/wpe/fast/dom/navigator-detached-no-crash-expected.txt:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WTF/wtf/PlatformHave.h:
* Source/WebCore/DerivedSources-input.xcfilelist:
* Source/WebCore/DerivedSources-output.xcfilelist:
* Source/WebCore/DerivedSources.make:
* Source/WebCore/Modules/device-posture/DevicePosture.cpp: Added.
(WebCore::DevicePosture::create):
(WebCore::DevicePosture::DevicePosture):
(WebCore::DevicePosture::~DevicePosture):
(WebCore::DevicePosture::virtualHasPendingActivity const):
(WebCore::DevicePosture::navigator):
(WebCore::DevicePosture::scriptExecutionContext const):
(WebCore::DevicePosture::type const):
(WebCore::DevicePosture::typeChanged):
* Source/WebCore/Modules/device-posture/DevicePosture.h: Added.
* Source/WebCore/Modules/device-posture/DevicePosture.idl: Added.
* Source/WebCore/Modules/device-posture/DevicePostureType.h: Added.
* Source/WebCore/Modules/device-posture/DevicePostureType.idl: Added.
* Source/WebCore/Modules/device-posture/Navigator+DevicePosture.idl: Added.
* Source/WebCore/Modules/device-posture/NavigatorDevicePosture.cpp: Added.
(WebCore::NavigatorDevicePosture::devicePosture):
(WebCore::NavigatorDevicePosture::from):
* Source/WebCore/Modules/device-posture/NavigatorDevicePosture.h: Added.
(isType):
* Source/WebCore/Modules/geolocation/Geolocation.cpp:
(WebCore::createGeolocationPosition):
Fix Safer CPP issue.
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/js/WebCoreBuiltinNames.h:
* Source/WebCore/css/CSSValueKeywords.in:
* Source/WebCore/css/query/MediaQueryFeatures.cpp:
(WebCore::MQ::Features::devicePostureFeatureSchema):
(WebCore::MQ::Features::devicePosture):
* Source/WebCore/css/query/MediaQueryFeatures.h:
* Source/WebCore/dom/EventTargetFactory.in:
* Source/WebCore/page/ChromeClient.h:
(WebCore::ChromeClient::devicePostureType const):
* Source/WebCore/page/Page.cpp:
(WebCore::Page::devicePostureTypeChanged):
* Source/WebCore/page/Page.h:
* Source/WebCore/platform/Supplementable.h:
(WebCore::SupplementBase::isNavigatorDevicePosture const):
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setDevicePostureType):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxyInternals.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setUpInteraction]):
(-[WKContentView cleanUpInteraction]):
(-[WKContentView setUpHingeInteraction]):
On iOS, the API is supported by `UIHingeInteraction`. If the hinge status is
"partially open" the device is considered "folded". A fully open or fully closed
device is considered "continuous".
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::devicePostureType const):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setDevicePostureType):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Source/WebCore/CMakeLists.txt:
* Source/WebCore/Headers.cmake:
Canonical link: https://commits.webkit.org/322390@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications