RESOLVED FIXED 143452
[Mac] WebKit is not honoring operating system preferences for secondary click behavior
https://bugs.webkit.org/show_bug.cgi?id=143452
Summary [Mac] WebKit is not honoring operating system preferences for secondary click...
Brent Fulgham
Reported 2015-04-06 12:38:18 PDT
Users can adjust their system preference for how secondary click is interpreted by the operating system. WebKit is improperly hard-coding the button number for these mouse events, resulting in improper behavior.
Attachments
Patch (3.56 KB, patch)
2015-04-06 12:42 PDT, Brent Fulgham
no flags
Patch (Corrects WK1 and WK2 cases) (5.54 KB, patch)
2015-04-06 16:24 PDT, Brent Fulgham
no flags
Patch (v3: iOS Fixes) (5.29 KB, patch)
2015-04-07 08:55 PDT, Brent Fulgham
no flags
Patch (13.20 KB, patch)
2015-04-07 14:45 PDT, Brent Fulgham
no flags
Patch (13.86 KB, patch)
2015-04-07 16:16 PDT, Brent Fulgham
no flags
Patch (25.17 KB, patch)
2015-04-07 22:23 PDT, Brent Fulgham
no flags
Patch (35.35 KB, patch)
2015-04-08 14:19 PDT, Brent Fulgham
thorton: review+
Brent Fulgham
Comment 1 2015-04-06 12:38:36 PDT
Brent Fulgham
Comment 2 2015-04-06 12:42:04 PDT
Brent Fulgham
Comment 3 2015-04-06 16:24:59 PDT
Created attachment 250240 [details] Patch (Corrects WK1 and WK2 cases)
Brent Fulgham
Comment 4 2015-04-07 08:55:32 PDT
Created attachment 250267 [details] Patch (v3: iOS Fixes)
Tim Horton
Comment 5 2015-04-07 11:13:17 PDT
Comment on attachment 250267 [details] Patch (v3: iOS Fixes) I don't think this is the right solution. You'll note that Ctrl-Click hands the DOM a "left mouse down", so clearly context menus do not require a "right mouse button" click. And, we should lie and re-map what AppKit says about which button went down. So, please find a solution that doesn't involve remapping the buttons.
Brent Fulgham
Comment 6 2015-04-07 14:45:21 PDT
WebKit Commit Bot
Comment 7 2015-04-07 14:48:38 PDT
Attachment 250306 [details] did not pass style-queue: ERROR: Source/WebCore/platform/PlatformMouseEvent.h:75: Wrong number of spaces before statement. (expected: 31) [whitespace/indent] [4] Total errors found: 1 in 13 files If any of these errors are false positives, please file a bug against check-webkit-style.
Tim Horton
Comment 8 2015-04-07 15:02:45 PDT
Comment on attachment 250306 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=250306&action=review > Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm:1268 > +bool WebPage::shouldBeHandledAsContextClick(const PlatformMouseEvent& event) Can this be static and can it live in WebEventFactory, right near typeForEvent? > Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm:1271 > + if (event.button() == WebCore::LeftButton && event.ctrlKey()) > + return true; Can we make sure that event.menuTypeForEvent is NSMenuTypeContextMenu and get rid of this logic?
Brent Fulgham
Comment 9 2015-04-07 16:16:59 PDT
WebKit Commit Bot
Comment 10 2015-04-07 16:19:13 PDT
Attachment 250313 [details] did not pass style-queue: ERROR: Source/WebCore/platform/PlatformMouseEvent.h:75: Wrong number of spaces before statement. (expected: 31) [whitespace/indent] [4] Total errors found: 1 in 12 files If any of these errors are false positives, please file a bug against check-webkit-style.
Brent Fulgham
Comment 11 2015-04-07 22:23:22 PDT
WebKit Commit Bot
Comment 12 2015-04-07 22:25:49 PDT
Attachment 250334 [details] did not pass style-queue: ERROR: Source/WebCore/platform/PlatformMouseEvent.h:75: Wrong number of spaces before statement. (expected: 31) [whitespace/indent] [4] Total errors found: 1 in 15 files If any of these errors are false positives, please file a bug against check-webkit-style.
Brent Fulgham
Comment 13 2015-04-08 14:19:05 PDT
WebKit Commit Bot
Comment 14 2015-04-08 14:22:30 PDT
Attachment 250385 [details] did not pass style-queue: ERROR: Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm:46: When wrapping a line, only indent 4 spaces. [whitespace/indent] [3] ERROR: Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm:47: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm:48: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm:50: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm:51: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm:52: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Source/WebCore/platform/PlatformMouseEvent.h:75: Wrong number of spaces before statement. (expected: 31) [whitespace/indent] [4] ERROR: Tools/TestWebKitAPI/mac/PlatformWebViewMac.mm:230: When wrapping a line, only indent 4 spaces. [whitespace/indent] [3] ERROR: Tools/TestWebKitAPI/mac/PlatformWebViewMac.mm:231: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Tools/TestWebKitAPI/mac/PlatformWebViewMac.mm:232: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Tools/TestWebKitAPI/mac/PlatformWebViewMac.mm:234: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Tools/TestWebKitAPI/mac/PlatformWebViewMac.mm:235: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] ERROR: Tools/TestWebKitAPI/mac/PlatformWebViewMac.mm:236: Weird number of spaces at line-start. Are you using a 4-space indent? [whitespace/indent] [3] Total errors found: 13 in 19 files If any of these errors are false positives, please file a bug against check-webkit-style.
Tim Horton
Comment 15 2015-04-08 16:00:35 PDT
Comment on attachment 250385 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=250385&action=review > Tools/TestWebKitAPI/Tests/WebKit2/MenuTypesForMouseEvents.cpp:72 > +TEST(WebKit2, NormalLeftClick) these should have better names. The concatenated name WebKit2.NormalLeftClick will show up as the name of the test in the test runner. Maybe add something like NormalLeftClickMenuType or something? > Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm:49 > + windowNumber:[[webView.get() window] windowNumber] No .get()
Brent Fulgham
Comment 16 2015-04-08 19:42:24 PDT
Alexey Proskuryakov
Comment 17 2015-04-08 20:18:21 PDT
The new API tests fail everywhere: https://build.webkit.org/builders/Apple%20Yosemite%20Release%20WK1%20%28Tests%29/builds/4301/steps/run-api-tests/logs/stdio /Volumes/Data/slave/yosemite-release/build/Tools/TestWebKitAPI/Tests/mac/MenuTypesForMouseEvents.mm:59 Value of: pme.menuTypeForEvent() Actual: 0 Expected: expectedMenu Which is: 1 Should we roll out?
Brent Fulgham
Comment 18 2015-04-08 20:39:40 PDT
(In reply to comment #17) > The new API tests fail everywhere: > https://build.webkit.org/builders/ > Apple%20Yosemite%20Release%20WK1%20%28Tests%29/builds/4301/steps/run-api- > tests/logs/stdio > > /Volumes/Data/slave/yosemite-release/build/Tools/TestWebKitAPI/Tests/mac/ > MenuTypesForMouseEvents.mm:59 > Value of: pme.menuTypeForEvent() > Actual: 0 > Expected: expectedMenu > Which is: 1 > > Should we roll out? I'll check in a fix. This is apparently a system preference, which I didn't notice when I tested locally.
Brent Fulgham
Comment 19 2015-04-08 20:43:36 PDT
Attempted fix checked in as r182584: Committed r182584: <http://trac.webkit.org/changeset/182584>
mitz
Comment 20 2015-04-08 20:44:58 PDT
(In reply to comment #19) > Attempted fix checked in as r182584: > > Committed r182584: <http://trac.webkit.org/changeset/182584> Normally we set up consistent user defaults for testing so that the tests pass no matter what the global system preferences are. Can’t we do that here?
Alexey Proskuryakov
Comment 21 2015-04-08 21:33:47 PDT
We certainly can't expect one who sees a failing test to look for comments in the code. The tests should just pass unconditionally.
Brent Fulgham
Comment 22 2015-04-08 22:41:46 PDT
(In reply to comment #21) > We certainly can't expect one who sees a failing test to look for comments > in the code. The tests should just pass unconditionally. It turns out that this was not related to system preferences; it was an improper bitwise comparison. Interesting that the EWS did not catch this. Does EWS not run the API tests? Fix committed in r182589 <https://trac.webkit.org/changeset/182589>.
Alexey Proskuryakov
Comment 23 2015-04-08 22:55:29 PDT
> Does EWS not run the API tests? It does not.
Note You need to log in before you can comment on or make changes to this bug.