Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 08004ec9ed578de1c69d2733a63e9813aab81fc6
https://github.com/WebKit/WebKit/commit/08004ec9ed578de1c69d2733a63e9813aab81fc6
Author: Kiet Ho <[email protected]>
Date: 2026-09-10 (Thu, 10 Sep 2026)
Changed paths:
M Source/WebCore/html/ColorInputType.cpp
M Source/WebCore/html/ColorInputType.h
M Source/WebCore/page/FrameView.cpp
M Source/WebCore/page/FrameView.h
M Source/WebCore/platform/ColorChooserClient.h
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/WebProcess/WebCoreSupport/WebColorChooser.cpp
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm
Log Message:
-----------
[Site Isolation] Fix location of color input picker, take 2
rdar://186284344
https://bugs.webkit.org/show_bug.cgi?id=323020
Reviewed by Megan Gardner and Alex Christensen.
WebPageProxy::showColorPicker uses convertRectToMainFrameCoordinates to convert
the received coordinates to main frame view coordinates. There're two issues
with this:
1) convertRectToMainFrameCoordinates is wrong (won't go into details here)
2) More importantly, convertRectToMainFrameCoordinates requires sending messages
from UI to web process.
The added test demonstrates a case where the color input picker is at the wrong
location. When the color input is in the middle of the page, instead of on top,
then the color input picker is placed way outside of the view (Y coordinate
is negative.)
Fix this by:
1) add a new method FrameView::contentsToMainFrameView. It's equivalent to
ScrollView::contentsToRootView, except it uses
convertToRootViewAcrossIsolatedFrames
behind the scenes, so contentsToMainFrameView is guaranteed to convert all
the way to the main frame.
2) On the web process side, change WebColorChooser to use
contentsToMainFrameView
to compute the picker location.
3) On the UI process side, directly use the rect sent by the web process This
rect is
already in main frame view coordinates, so no conversion is needed.
4) Rename ColorInputType::elementRectRelativeToRootView to
elementRectRelativeToMainFrameView,
to make clear that the rect is relative to main frame view coordinates.
Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm
* Source/WebCore/html/ColorInputType.cpp:
(WebCore::ColorInputType::elementRectRelativeToMainFrameView const):
(WebCore::ColorInputType::elementRectRelativeToRootView const): Deleted.
* Source/WebCore/html/ColorInputType.h:
* Source/WebCore/page/FrameView.cpp:
(WebCore::FrameView::convertToRootViewAcrossIsolatedFrames const):
(WebCore::FrameView::contentsToMainFrameView const):
* Source/WebCore/page/FrameView.h:
* Source/WebCore/platform/ColorChooserClient.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::showColorPicker):
* Source/WebKit/WebProcess/WebCoreSupport/WebColorChooser.cpp:
(WebKit::WebColorChooser::WebColorChooser):
(WebKit::WebColorChooser::reattachColorChooser):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm:
(TestWebKitAPI::(SiteIsolation, ColorInputPickerLocation)):
(TestWebKitAPI::(SiteIsolation, ColorInputPickerLocation2)):
Canonical link: https://commits.webkit.org/320835@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications