RESOLVED WONTFIX 148018
[Win] The context menu on PluginView is displayed in wrong positions
https://bugs.webkit.org/show_bug.cgi?id=148018
Summary [Win] The context menu on PluginView is displayed in wrong positions
Sungmann Cho
Reported 2015-08-13 23:08:27 PDT
On Windows, the context menu on PluginView is displayed in wrong positions. It is due to not taking the device scale factor into account when assembling WM_RBUTTONDOWN events.
Attachments
Patch (2.09 KB, patch)
2015-08-13 23:16 PDT, Sungmann Cho
no flags
simple flash content for testing (1.48 KB, text/html)
2015-08-13 23:23 PDT, Sungmann Cho
no flags
Patch (2.05 KB, patch)
2015-08-21 09:13 PDT, Sungmann Cho
achristensen: review-
Sungmann Cho
Comment 1 2015-08-13 23:16:04 PDT
Sungmann Cho
Comment 2 2015-08-13 23:23:54 PDT
Created attachment 258988 [details] simple flash content for testing
Sungmann Cho
Comment 3 2015-08-16 18:58:48 PDT
This problem seems to occur when the value of "Make it easier to read what's on your screen" item in the display setting page is not equal to "Smaller - 100% (default)".
Alex Christensen
Comment 4 2015-08-17 09:54:42 PDT
Comment on attachment 258987 [details] Patch Why don't the other events (WM_LBUTTONDOWN, WM_MBUTTONDOWN) have the same problem? Doing this here specifically for the right button only seems like the wrong thing to do.
Brent Fulgham
Comment 5 2015-08-17 10:49:53 PDT
Comment on attachment 258987 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=258987&action=review > Source/WebKit/win/Plugins/PluginViewWin.cpp:657 > + npEvent.lParam = MAKELPARAM(point.x(), point.y()); This is correct if this event is being passed into WebCore, which wants to work in logical pixels. But it looks like this event is handed to the plugin, which may or may not be working in logical pixels. It could be that Flash is not high-DPI aware, and therefore needs the scaled pixel values -- but what happens if Flash is updated to recognize High-DPI? Also, It does seem like if the adjusted point is needed for the context menu, it's probably need for mouse down and other actions, as Alex pointed out.
Alex Christensen
Comment 6 2015-08-18 11:44:29 PDT
Sungmann Cho
Comment 7 2015-08-21 09:13:10 PDT
Sungmann Cho
Comment 8 2015-08-21 09:21:38 PDT
(In reply to comment #6) > Is this fixed by https://bugs.webkit.org/show_bug.cgi?id=148020 ? No. The problem still occurs after landing of that patch.
Alex Christensen
Comment 9 2015-08-21 09:49:57 PDT
Comment on attachment 259619 [details] Patch I'm not sure where the problem really is, but I really think that scaling only the right button event positions is not the right solution.
Sungmann Cho
Comment 10 2015-08-21 12:14:32 PDT
(In reply to comment #5) > It could be that Flash is not high-DPI aware, and therefore needs the scaled pixel values -- > but what happens if Flash is updated to recognize High-DPI? This problem still occurs even after updating to the latest version of Flash (18.0.0.232). > Also, It does seem like if the adjusted point is needed for the context menu, > it's probably need for mouse down and other actions, as Alex pointed out. Things get even worse when we pass the adjusted point to other down events. When I tried to do so with the attached test content, I couldn't click any buttons or links on it. According to the codes in WebView::handleContextMenuEvent() (https://goo.gl/RI8Mvz), it seems that we are scaling the given logical point with the device scale factor only when invoking TrackPopupMenu(). Any thoughts on this?
Brent Fulgham
Comment 11 2015-08-21 12:46:08 PDT
(In reply to comment #10) > > Also, It does seem like if the adjusted point is needed for the context menu, > > it's probably need for mouse down and other actions, as Alex pointed out. > > Things get even worse when we pass the adjusted point to other down events. > When I tried to do so with the attached test content, I couldn't click any > buttons or links on it. In general, the code in the WebKit layer (i.e., the stuff in Source/WebKit/win) work in terms of device (screen) pixels. So, position/size information received from Windows messages are device pixels, as are anything we send back to Windows via API or messages since Windows only understands device pixels. When we hand coordinates/sizes down to WebCore, we need to covert to "logical" pixels, so we have to adjust by the scaling factor. E.g., in a High DPI device one logical pixel maps to a group of 2x2 device pixels. So when we get a message and hand it to the plugin, we have to decide if the plugin wants to get device pixels or logical pixels -- and I'm not sure what Flash wants. Since the coordinates coming through HTMLPluginElement on their way to PluginViewWin are from WebCore, they are in logical units. If you have to scale the coordinates to get the context menu (which I assume is internal to Flash), then it doesn't make sense that you would not need to do this for all the other action as well! > According to the codes in WebView::handleContextMenuEvent() > (https://goo.gl/RI8Mvz), > it seems that we are scaling the given logical point with the device scale > factor > only when invoking TrackPopupMenu(). Any thoughts on this? Nearly all mouse events get scaled in the constructors for PlatformMouseEventWin. However, the context menu doesn't use that event object, so it was done manually. Is it possible that the plugin wants screen coordinates (i.e., referenced against the edge of the monitor), but we are handling it content coordinates (based on the plugin)? Maybe something was broken for Plugin handling when I made some of these other changes?
Alexey Proskuryakov
Comment 12 2022-07-01 11:36:11 PDT
Mass closing plug-in bugs, as plug-in support has been removed from WebKit. Please comment and/or reopen if this still affects WebKit in some way.
Note You need to log in before you can comment on or make changes to this bug.