Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Side by Side Diff: chrome/browser/resources/ntp4/synthetic_middleclick.js

Issue 1963823002: Dispatch middle click manually by tracking mouse (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl try Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 var middleButtonMouseDownTarget = null;
Dan Beam 2016/05/24 01:57:31 wrap this in: (function() { ... code ... })();
Navid Zolghadr 2016/05/24 17:51:14 Done.
6 document.addEventListener('mousedown', function(e) {
7 if (e.button == 1) {
Dan Beam 2016/05/24 01:57:32 no curlies
Navid Zolghadr 2016/05/24 17:51:14 Done.
8 middleButtonMouseDownTarget = e.target;
9 }
10 }, true);
11 document.addEventListener('mouseup', function(e) {
12 if (e.button == 1) {
13 if (e.target == middleButtonMouseDownTarget)
Dan Beam 2016/05/24 01:57:32 how does this work with shadow DOM? should you be
Navid Zolghadr 2016/05/24 17:51:14 I don't think there is any shadow DOM here in this
14 e.target.dispatchEvent(new MouseEvent('click', e));
15 middleButtonMouseDownTarget = null;
16 }
17 }, true);
Dan Beam 2016/05/12 02:06:24 both of our code has all kind of things wrong with
dtapuska 2016/05/12 02:12:50 Won't this dispatch two click events if the mouse
Navid Zolghadr 2016/05/12 13:56:01 Yes, I believe Dave is right. Dan, your solutions
Dan Beam 2016/05/12 18:59:05 mousing up outside of the window still dispatches
Dan Beam 2016/05/12 19:08:21 obviously it's possible some other listener stops
Navid Zolghadr 2016/05/12 20:53:59 Dan, I totally agree that having a platform suppor
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698