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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/SoftContextMenu.js

Issue 2393763002: [DevTools] Cleanup DOMExtension.js. (Closed)
Patch Set: review comments Created 4 years, 2 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
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All Rights Reserved. 2 * Copyright (C) 2011 Google Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 // Create context menu. 55 // Create context menu.
56 this.element = createElementWithClass("div", "soft-context-menu"); 56 this.element = createElementWithClass("div", "soft-context-menu");
57 var root = WebInspector.createShadowRootWithCoreStyles(this.element, "ui /softContextMenu.css"); 57 var root = WebInspector.createShadowRootWithCoreStyles(this.element, "ui /softContextMenu.css");
58 this._contextMenuElement = root.createChild("div"); 58 this._contextMenuElement = root.createChild("div");
59 this.element.style.top = y + "px"; 59 this.element.style.top = y + "px";
60 var subMenuOverlap = 3; 60 var subMenuOverlap = 3;
61 this.element.style.left = (this._parentMenu ? x - subMenuOverlap : x) + "px"; 61 this.element.style.left = (this._parentMenu ? x - subMenuOverlap : x) + "px";
62 62
63 this._contextMenuElement.tabIndex = 0; 63 this._contextMenuElement.tabIndex = 0;
64 this._contextMenuElement.addEventListener("mouseup", consumeEvent, false ); 64 this._contextMenuElement.addEventListener("mouseup", (e) => e.consume(), false);
65 this._contextMenuElement.addEventListener("keydown", this._menuKeyDown.b ind(this), false); 65 this._contextMenuElement.addEventListener("keydown", this._menuKeyDown.b ind(this), false);
66 66
67 for (var i = 0; i < this._items.length; ++i) 67 for (var i = 0; i < this._items.length; ++i)
68 this._contextMenuElement.appendChild(this._createMenuItem(this._item s[i])); 68 this._contextMenuElement.appendChild(this._createMenuItem(this._item s[i]));
69 69
70 // Install glass pane capturing events. 70 // Install glass pane capturing events.
71 if (!this._parentMenu) { 71 if (!this._parentMenu) {
72 this._glassPaneElement = createElementWithClass("div", "soft-context -menu-glass-pane fill"); 72 this._glassPaneElement = createElementWithClass("div", "soft-context -menu-glass-pane fill");
73 this._glassPaneElement.tabIndex = 0; 73 this._glassPaneElement.tabIndex = 0;
74 this._glassPaneElement.style.zIndex = "20000"; 74 this._glassPaneElement.style.zIndex = "20000";
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 _discardSubMenus: function() 391 _discardSubMenus: function()
392 { 392 {
393 if (this._subMenu) 393 if (this._subMenu)
394 this._subMenu._discardSubMenus(); 394 this._subMenu._discardSubMenus();
395 if (this.element) 395 if (this.element)
396 this.element.remove(); 396 this.element.remove();
397 if (this._parentMenu) 397 if (this._parentMenu)
398 delete this._parentMenu._subMenu; 398 delete this._parentMenu._subMenu;
399 } 399 }
400 } 400 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698