Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5336d0544d6b8a9d3db284ad17b7df75584d0141
      
https://github.com/WebKit/WebKit/commit/5336d0544d6b8a9d3db284ad17b7df75584d0141
  Author: Lily Spiniolas <[email protected]>
  Date:   2025-11-03 (Mon, 03 Nov 2025)

  Changed paths:
    A 
LayoutTests/fast/events/contextmenu-items-match-node-receiving-contextmenu-event-expected.txt
    A 
LayoutTests/fast/events/contextmenu-items-match-node-receiving-contextmenu-event.html
    M LayoutTests/platform/glib/TestExpectations
    M LayoutTests/platform/win/TestExpectations
    M Source/WebCore/page/ContextMenuController.cpp
    M Source/WebKit/Shared/API/c/WKSharedAPICast.h
    M Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h

  Log Message:
  -----------
  Control-click on YouTube video does not show video controls
https://bugs.webkit.org/show_bug.cgi?id=301730
rdar://162276991

Reviewed by Wenson Hsieh and Abrar Rahman Protyasha.

After fractional coordinates were enabled in 298383@main,
`ContextMenuController::maybeCreateContextMenu` converted the absolute location
of the mouse from a DoublePoint to a LayoutPoint. Previously, it was an IntPoint
which was converted to a LayoutPoint.

This difference is responsible for causing right-clicking or control-clicking
on a YouTube video to fail to show video controls because the hit test began
to return the element used for YouTube's own context menu rather than hitting
the video.

We fix this by effectively restoring the old behavior; the DoublePoint absolute
location is now floored before it is converted to a LayoutPoint.

While this fix results in a loss of precision, it is arguably more correct to
floor the point because we currently do not report fractional coordinates for
contextmenu events, and the hit test now reflects this by using the exact same
point that we report for the event coordinates.

`eventSender.contextClick()` now respects fractional coordinates for the mouse
position instead of flooring the location.

Test: fast/events/contextmenu-items-match-node-receiving-contextmenu-event.html

* 
LayoutTests/fast/events/contextmenu-items-match-node-receiving-contextmenu-event-expected.txt:
 Added.
* 
LayoutTests/fast/events/contextmenu-items-match-node-receiving-contextmenu-event.html:
 Added.
* LayoutTests/platform/glib/TestExpectations:
* LayoutTests/platform/win/TestExpectations:
* Source/WebCore/page/ContextMenuController.cpp:
(WebCore::ContextMenuController::maybeCreateContextMenu):
* Source/WebKit/Shared/API/c/WKSharedAPICast.h:
(WebKit::toDoublePoint):
* Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePageCopyContextMenuAtPointInWindow):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::contextMenuAtPointInWindow):
* Source/WebKit/WebProcess/WebPage/WebPage.h:

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



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

Reply via email to