Skip to content

[Site Isolation] Fix datetime picker positioning in cross-origin iframes#59667

Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
zakariaridouh:eng/Site-Isolation-Fix-datetime-picker-positioning-in-cross-origin-iframes
Mar 12, 2026
Merged

[Site Isolation] Fix datetime picker positioning in cross-origin iframes#59667
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
zakariaridouh:eng/Site-Isolation-Fix-datetime-picker-positioning-in-cross-origin-iframes

Conversation

@zakariaridouh
Copy link
Contributor

@zakariaridouh zakariaridouh commented Mar 1, 2026

8263290

[Site Isolation] Fix datetime picker positioning in cross-origin iframes
https://bugs.webkit.org/show_bug.cgi?id=308921
rdar://171461287

Reviewed by Aditya Keerthi.

The anchorRectInRootView in DateTimeChooserParameters is
relative to the iframe's root view, but the UI process interprets it
as main-frame coordinates. Add rootFrameID to
DateTimeChooserParameters and use convertRectToMainFrameCoordinates()
 in showDateTimePicker, matching the existing color picker fix. Also
store the frameID on WebDateTimePicker so
didChooseDate/didEndDateTimePicker route responses reliably instead
of using focusedOrMainFrame().

* Source/WebCore/html/BaseDateAndTimeInputType.cpp:
(WebCore::BaseDateAndTimeInputType::setupDateTimeChooserParameters):
* Source/WebCore/platform/DateTimeChooserParameters.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/WebDateTimePicker.cpp:
(WebKit::WebDateTimePicker::showDateTimePicker):
* Source/WebKit/UIProcess/WebDateTimePicker.h:
(WebKit::WebDateTimePicker::frameID const):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::showDateTimePicker):
(WebKit::WebPageProxy::didChooseDate):
(WebKit::WebPageProxy::didEndDateTimePicker):
* Source/WebKit/UIProcess/gtk/WebDateTimePickerGtk.cpp:
(WebKit::WebDateTimePickerGtk::platformShowDateTimePicker):
(WebKit::WebDateTimePickerGtk::showDateTimePicker):
* Source/WebKit/UIProcess/gtk/WebDateTimePickerGtk.h:
* Source/WebKit/UIProcess/mac/WebDateTimePickerMac.h:
* Source/WebKit/UIProcess/mac/WebDateTimePickerMac.mm:
(WebKit::WebDateTimePickerMac::platformShowDateTimePicker):
(WebKit::WebDateTimePickerMac::showDateTimePicker):

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

781c669

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe 🛠 win loading 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 🧪 win-tests ✅ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ✅ 🛠 vision-apple
✅ 🧪 ios-wk2-wpt 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@zakariaridouh zakariaridouh self-assigned this Mar 1, 2026
@zakariaridouh zakariaridouh added the New Bugs Unclassified bugs are placed in this component until the correct component can be determined. label Mar 1, 2026
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 1, 2026
@zakariaridouh zakariaridouh removed the merging-blocked Applied to prevent a change from being merged label Mar 1, 2026
@zakariaridouh zakariaridouh force-pushed the eng/Site-Isolation-Fix-datetime-picker-positioning-in-cross-origin-iframes branch from a4a635a to 511477d Compare March 1, 2026 13:30
@zakariaridouh zakariaridouh requested a review from pxlcoder March 2, 2026 14:44
}
if (!m_dateTimePicker)
return;
auto rootFrameID = params.rootFrameID;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This local variable is unnecessary, we can read off of params in the lambda.

return;

params.anchorRectInRootView = IntRect(*convertedRect);
protectedThis->m_dateTimePicker->setFrameID(rootFrameID);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this setter and fold the logic into showDateTimePicker? We could read off of params inside that method.

void WebPageProxy::didEndDateTimePicker()
{
m_dateTimePicker = nullptr;
RefPtr picker = std::exchange(m_dateTimePicker, nullptr);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just pull out the frameID rather than keeping the picker alive longer?

@zakariaridouh zakariaridouh force-pushed the eng/Site-Isolation-Fix-datetime-picker-positioning-in-cross-origin-iframes branch from 511477d to 8205bdb Compare March 10, 2026 21:15
@zakariaridouh zakariaridouh requested a review from a team as a code owner March 10, 2026 21:15
@zakariaridouh zakariaridouh force-pushed the eng/Site-Isolation-Fix-datetime-picker-positioning-in-cross-origin-iframes branch from 8205bdb to b60a47a Compare March 11, 2026 07:23
@zakariaridouh zakariaridouh requested a review from pxlcoder March 11, 2026 20:33

void WebDateTimePickerGtk::showDateTimePicker(WebCore::DateTimeChooserParameters&& params)
{
m_frameID = params.rootFrameID;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to use the same platformShowDateTimePicker pattern I suggested in the other PR.

@zakariaridouh zakariaridouh force-pushed the eng/Site-Isolation-Fix-datetime-picker-positioning-in-cross-origin-iframes branch from b60a47a to 781c669 Compare March 11, 2026 20:52
@zakariaridouh zakariaridouh added the merge-queue Applied to send a pull request to merge-queue label Mar 11, 2026
@webkit-commit-queue webkit-commit-queue added merging-blocked Applied to prevent a change from being merged and removed merge-queue Applied to send a pull request to merge-queue labels Mar 11, 2026
@zakariaridouh zakariaridouh added merge-queue Applied to send a pull request to merge-queue and removed merging-blocked Applied to prevent a change from being merged labels Mar 12, 2026
https://bugs.webkit.org/show_bug.cgi?id=308921
rdar://171461287

Reviewed by Aditya Keerthi.

The anchorRectInRootView in DateTimeChooserParameters is
relative to the iframe's root view, but the UI process interprets it
as main-frame coordinates. Add rootFrameID to
DateTimeChooserParameters and use convertRectToMainFrameCoordinates()
 in showDateTimePicker, matching the existing color picker fix. Also
store the frameID on WebDateTimePicker so
didChooseDate/didEndDateTimePicker route responses reliably instead
of using focusedOrMainFrame().

* Source/WebCore/html/BaseDateAndTimeInputType.cpp:
(WebCore::BaseDateAndTimeInputType::setupDateTimeChooserParameters):
* Source/WebCore/platform/DateTimeChooserParameters.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/UIProcess/WebDateTimePicker.cpp:
(WebKit::WebDateTimePicker::showDateTimePicker):
* Source/WebKit/UIProcess/WebDateTimePicker.h:
(WebKit::WebDateTimePicker::frameID const):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::showDateTimePicker):
(WebKit::WebPageProxy::didChooseDate):
(WebKit::WebPageProxy::didEndDateTimePicker):
* Source/WebKit/UIProcess/gtk/WebDateTimePickerGtk.cpp:
(WebKit::WebDateTimePickerGtk::platformShowDateTimePicker):
(WebKit::WebDateTimePickerGtk::showDateTimePicker):
* Source/WebKit/UIProcess/gtk/WebDateTimePickerGtk.h:
* Source/WebKit/UIProcess/mac/WebDateTimePickerMac.h:
* Source/WebKit/UIProcess/mac/WebDateTimePickerMac.mm:
(WebKit::WebDateTimePickerMac::platformShowDateTimePicker):
(WebKit::WebDateTimePickerMac::showDateTimePicker):

Canonical link: https://commits.webkit.org/309104@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/Site-Isolation-Fix-datetime-picker-positioning-in-cross-origin-iframes branch from 781c669 to 8263290 Compare March 12, 2026 02:23
@webkit-commit-queue
Copy link
Collaborator

Committed 309104@main (8263290): https://commits.webkit.org/309104@main

Reviewed commits have been landed. Closing PR #59667 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 8263290 into WebKit:main Mar 12, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

New Bugs Unclassified bugs are placed in this component until the correct component can be determined.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants