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

Side by Side Diff: Source/WebCore/inspector/front-end/SoftContextMenu.js

Issue 9968120: Merge 112992 - Web Inspector: "Pause on start" doesn't change checked state in workers panel (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1084/
Patch Set: Created 8 years, 8 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 this._glassPaneElement.appendChild(this._contextMenuElement); 74 this._glassPaneElement.appendChild(this._contextMenuElement);
75 document.body.appendChild(this._glassPaneElement); 75 document.body.appendChild(this._glassPaneElement);
76 this._contextMenuElement.focus(); 76 this._contextMenuElement.focus();
77 77
78 // Re-position menu in case it does not fit. 78 // Re-position menu in case it does not fit.
79 if (document.body.offsetWidth < this._contextMenuElement.offsetLeft + t his._contextMenuElement.offsetWidth) 79 if (document.body.offsetWidth < this._contextMenuElement.offsetLeft + t his._contextMenuElement.offsetWidth)
80 this._contextMenuElement.style.left = (absoluteX - this._contextMenu Element.offsetWidth) + "px"; 80 this._contextMenuElement.style.left = (absoluteX - this._contextMenu Element.offsetWidth) + "px";
81 if (document.body.offsetHeight < this._contextMenuElement.offsetTop + th is._contextMenuElement.offsetHeight) 81 if (document.body.offsetHeight < this._contextMenuElement.offsetTop + th is._contextMenuElement.offsetHeight)
82 this._contextMenuElement.style.top = (document.body.offsetHeight - t his._contextMenuElement.offsetHeight) + "px"; 82 this._contextMenuElement.style.top = (document.body.offsetHeight - t his._contextMenuElement.offsetHeight) + "px";
83 83
84 event.consume(); 84 event.consume(true);
85 }, 85 },
86 86
87 _createMenuItem: function(item) 87 _createMenuItem: function(item)
88 { 88 {
89 if (item.type === "separator") 89 if (item.type === "separator")
90 return this._createSeparator(); 90 return this._createSeparator();
91 91
92 var menuItemElement = document.createElement("div"); 92 var menuItemElement = document.createElement("div");
93 menuItemElement.className = "soft-context-menu-item"; 93 menuItemElement.className = "soft-context-menu-item";
94 94
(...skipping 21 matching lines...) Expand all
116 { 116 {
117 var separatorElement = document.createElement("div"); 117 var separatorElement = document.createElement("div");
118 separatorElement.className = "soft-context-menu-separator"; 118 separatorElement.className = "soft-context-menu-separator";
119 separatorElement._isSeparator = true; 119 separatorElement._isSeparator = true;
120 return separatorElement; 120 return separatorElement;
121 }, 121 },
122 122
123 _menuItemMouseDown: function(event) 123 _menuItemMouseDown: function(event)
124 { 124 {
125 // Do not let separator's mouse down hit menu's handler - we need to rec eive mouse up! 125 // Do not let separator's mouse down hit menu's handler - we need to rec eive mouse up!
126 event.consume(); 126 event.consume(true);
127 }, 127 },
128 128
129 _menuItemMouseUp: function(event) 129 _menuItemMouseUp: function(event)
130 { 130 {
131 this._triggerAction(event.target, event); 131 this._triggerAction(event.target, event);
132 }, 132 },
133 133
134 _triggerAction: function(menuItemElement, event) 134 _triggerAction: function(menuItemElement, event)
135 { 135 {
136 this._discardMenu(event); 136 this._discardMenu(event);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 this._discardMenu(event); break; 188 this._discardMenu(event); break;
189 case "Enter": 189 case "Enter":
190 if (!isEnterKey(event)) 190 if (!isEnterKey(event))
191 break; 191 break;
192 // Fall through 192 // Fall through
193 case "U+0020": // Space 193 case "U+0020": // Space
194 if (this._highlightedMenuItemElement) 194 if (this._highlightedMenuItemElement)
195 this._triggerAction(this._highlightedMenuItemElement, event); 195 this._triggerAction(this._highlightedMenuItemElement, event);
196 break; 196 break;
197 } 197 }
198 event.consume(); 198 event.consume(true);
199 }, 199 },
200 200
201 _glassPaneMouseUp: function(event) 201 _glassPaneMouseUp: function(event)
202 { 202 {
203 // Return if this is simple 'click', since dispatched on glass pane, can 't use 'click' event. 203 // Return if this is simple 'click', since dispatched on glass pane, can 't use 'click' event.
204 if (event.x === this._x && event.y === this._y && new Date().getTime() - this._time < 300) 204 if (event.x === this._x && event.y === this._y && new Date().getTime() - this._time < 300)
205 return; 205 return;
206 this._discardMenu(event); 206 this._discardMenu(event);
207 }, 207 },
208 208
209 _discardMenu: function(event) 209 _discardMenu: function(event)
210 { 210 {
211 if (this._glassPaneElement) { 211 if (this._glassPaneElement) {
212 var glassPane = this._glassPaneElement; 212 var glassPane = this._glassPaneElement;
213 delete this._glassPaneElement; 213 delete this._glassPaneElement;
214 // This can re-enter discardMenu due to blur. 214 // This can re-enter discardMenu due to blur.
215 document.body.removeChild(glassPane); 215 document.body.removeChild(glassPane);
216 216
217 event.consume(); 217 event.consume(true);
218 } 218 }
219 } 219 }
220 } 220 }
221 221
222 InspectorFrontendHost.showContextMenu = function(event, items) 222 InspectorFrontendHost.showContextMenu = function(event, items)
223 { 223 {
224 new WebInspector.SoftContextMenu(items).show(event); 224 new WebInspector.SoftContextMenu(items).show(event);
225 } 225 }
226 226
227 } 227 }
OLDNEW
« no previous file with comments | « Source/WebCore/inspector/front-end/SearchController.js ('k') | Source/WebCore/inspector/front-end/Spectrum.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698