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

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

Issue 2018943003: Fix history page middle click action (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing the comment Created 4 years, 6 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
« no previous file with comments | « chrome/browser/resources/ntp4/synthetic_middleclick.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 (function() { 5 (function() {
6 6
7 var middleButtonMouseDownTarget = null; 7 var middleButtonMouseDownTarget = null;
8 8
9 document.addEventListener('mousedown', function(e) { 9 document.addEventListener('mousedown', function(e) {
10 if (e.button == 1) 10 if (e.button == 1)
11 middleButtonMouseDownTarget = e.path[0]; 11 middleButtonMouseDownTarget = e.path[0];
12 }, true); 12 }, true);
13 13
14 document.addEventListener('mouseup', function(e) { 14 document.addEventListener('mouseup', function(e) {
15 if (e.button != 1) 15 if (e.button != 1)
16 return; 16 return;
17 17
18 if (e.path.length > 0 && e.path[0] == middleButtonMouseDownTarget) 18 if (e.path.length > 0 && e.path[0] == middleButtonMouseDownTarget)
19 middleButtonMouseDownTarget.dispatchEvent(new MouseEvent('click', e)); 19 middleButtonMouseDownTarget.dispatchEvent(new MouseEvent('click', e));
20 20
21 middleButtonMouseDownTarget = null; 21 middleButtonMouseDownTarget = null;
22 }, true); 22 }, true);
23 23
24 window.addEventListener('click', function(e) {
25 if (e.button == 1 && !e.isTrusted)
26 e.preventDefault();
27 });
28
24 })(); 29 })();
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/synthetic_middleclick.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698