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

Side by Side Diff: Source/devtools/front_end/StatusBarButton.js

Issue 145583007: Revert of Make pause-on-exceptions toggle/tri-state button. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « Source/devtools/front_end/SourcesPanel.js ('k') | Source/devtools/front_end/sourcesPanel.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 * @constructor 94 * @constructor
95 * @extends {WebInspector.StatusBarItem} 95 * @extends {WebInspector.StatusBarItem}
96 * @param {string} title 96 * @param {string} title
97 * @param {string} className 97 * @param {string} className
98 * @param {number=} states 98 * @param {number=} states
99 */ 99 */
100 WebInspector.StatusBarButton = function(title, className, states) 100 WebInspector.StatusBarButton = function(title, className, states)
101 { 101 {
102 WebInspector.StatusBarItem.call(this, document.createElement("button")); 102 WebInspector.StatusBarItem.call(this, document.createElement("button"));
103 this.element.className = className + " status-bar-item"; 103 this.element.className = className + " status-bar-item";
104 this.element.addEventListener("click", this._clicked.bind(this, false), fals e); 104 this.element.addEventListener("click", this._clicked.bind(this), false);
105 105
106 this.glyph = document.createElement("div"); 106 this.glyph = document.createElement("div");
107 this.glyph.className = "glyph"; 107 this.glyph.className = "glyph";
108 this.element.appendChild(this.glyph); 108 this.element.appendChild(this.glyph);
109 109
110 this.glyphShadow = document.createElement("div"); 110 this.glyphShadow = document.createElement("div");
111 this.glyphShadow.className = "glyph shadow"; 111 this.glyphShadow.className = "glyph shadow";
112 this.element.appendChild(this.glyphShadow); 112 this.element.appendChild(this.glyphShadow);
113 113
114 this.states = states; 114 this.states = states;
115 if (!states) 115 if (!states)
116 this.states = 2; 116 this.states = 2;
117 117
118 if (states == 2) 118 if (states == 2)
119 this._state = false; 119 this._state = false;
120 else 120 else
121 this._state = 0; 121 this._state = 0;
122 122
123 this.title = title; 123 this.title = title;
124 this.className = className; 124 this.className = className;
125 this._visible = true; 125 this._visible = true;
126 } 126 }
127 127
128 WebInspector.StatusBarButton.prototype = { 128 WebInspector.StatusBarButton.prototype = {
129 /** 129 _clicked: function()
130 * @param {boolean} optionClick
131 */
132 _clicked: function(optionClick)
133 { 130 {
134 this.dispatchEventToListeners("click", optionClick); 131 this.dispatchEventToListeners("click");
135 if (this._longClickInterval) { 132 if (this._longClickInterval) {
136 clearInterval(this._longClickInterval); 133 clearInterval(this._longClickInterval);
137 delete this._longClickInterval; 134 delete this._longClickInterval;
138 } 135 }
139 }, 136 },
140 137
141 /** 138 /**
142 * @override 139 * @override
143 */ 140 */
144 _applyEnabledState: function() 141 _applyEnabledState: function()
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 delete this._longClickOptionsData; 312 delete this._longClickOptionsData;
316 313
317 this.unmakeLongClickEnabled(); 314 this.unmakeLongClickEnabled();
318 } 315 }
319 }, 316 },
320 317
321 _showOptions: function() 318 _showOptions: function()
322 { 319 {
323 var buttons = this._longClickOptionsData.buttonsProvider(); 320 var buttons = this._longClickOptionsData.buttonsProvider();
324 var mainButtonClone = new WebInspector.StatusBarButton(this.title, this. className, this.states); 321 var mainButtonClone = new WebInspector.StatusBarButton(this.title, this. className, this.states);
325 mainButtonClone.addEventListener("click", this._clicked.bind(this, true) , this); 322 mainButtonClone.addEventListener("click", this._clicked, this);
326 mainButtonClone.state = this.state; 323 mainButtonClone.state = this.state;
327 buttons.unshift(mainButtonClone); 324 buttons.push(mainButtonClone);
328 325
329 var mouseUpListener = mouseUp.bind(this); 326 var mouseUpListener = mouseUp.bind(this);
330 document.documentElement.addEventListener("mouseup", mouseUpListener, fa lse); 327 document.documentElement.addEventListener("mouseup", mouseUpListener, fa lse);
331 328
332 var optionsGlassPane = new WebInspector.GlassPane(); 329 var optionsGlassPane = new WebInspector.GlassPane();
333 var optionsBarElement = optionsGlassPane.element.createChild("div", "alt ernate-status-bar-buttons-bar"); 330 var optionsBarElement = optionsGlassPane.element.createChild("div", "alt ernate-status-bar-buttons-bar");
334 const buttonHeight = 23; 331 const buttonHeight = 23;
335 332
336 var hostButtonPosition = this.element.totalOffset(); 333 var hostButtonPosition = this.element.totalOffset();
337 334
338 var topNotBottom = hostButtonPosition.top + buttonHeight * buttons.lengt h < document.documentElement.offsetHeight; 335 var topNotBottom = hostButtonPosition.top + buttonHeight * buttons.lengt h < document.documentElement.offsetHeight;
339 336
340 if (!topNotBottom) 337 if (topNotBottom)
341 buttons = buttons.reverse(); 338 buttons = buttons.reverse();
342 339
343 optionsBarElement.style.height = (buttonHeight * buttons.length) + "px"; 340 optionsBarElement.style.height = (buttonHeight * buttons.length) + "px";
344 if (topNotBottom) 341 if (topNotBottom)
345 optionsBarElement.style.top = (hostButtonPosition.top + 1) + "px"; 342 optionsBarElement.style.top = (hostButtonPosition.top + 1) + "px";
346 else 343 else
347 optionsBarElement.style.top = (hostButtonPosition.top - (buttonHeigh t * (buttons.length - 1))) + "px"; 344 optionsBarElement.style.top = (hostButtonPosition.top - (buttonHeigh t * (buttons.length - 1))) + "px";
348 optionsBarElement.style.left = (hostButtonPosition.left + 1) + "px"; 345 optionsBarElement.style.left = (hostButtonPosition.left + 1) + "px";
349 346
350 var boundMouseOver = mouseOver.bind(this); 347 var boundMouseOver = mouseOver.bind(this);
(...skipping 25 matching lines...) Expand all
376 function mouseUp(e) 373 function mouseUp(e)
377 { 374 {
378 if (e.which !== 1) 375 if (e.which !== 1)
379 return; 376 return;
380 optionsGlassPane.dispose(); 377 optionsGlassPane.dispose();
381 document.documentElement.removeEventListener("mouseup", mouseUpListe ner, false); 378 document.documentElement.removeEventListener("mouseup", mouseUpListe ner, false);
382 379
383 for (var i = 0; i < buttons.length; ++i) { 380 for (var i = 0; i < buttons.length; ++i) {
384 if (buttons[i].element.classList.contains("emulate-active")) { 381 if (buttons[i].element.classList.contains("emulate-active")) {
385 buttons[i].element.classList.remove("emulate-active"); 382 buttons[i].element.classList.remove("emulate-active");
386 buttons[i]._clicked(true); 383 buttons[i]._clicked();
387 break; 384 break;
388 } 385 }
389 } 386 }
390 } 387 }
391 }, 388 },
392 389
393 __proto__: WebInspector.StatusBarItem.prototype 390 __proto__: WebInspector.StatusBarItem.prototype
394 } 391 }
395 392
396 /** 393 /**
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 var options = []; 627 var options = [];
631 for (var index = 0; index < this._states.length; index++) { 628 for (var index = 0; index < this._states.length; index++) {
632 if (this._states[index] !== this.state && this._states[index] !== th is._currentState) 629 if (this._states[index] !== this.state && this._states[index] !== th is._currentState)
633 options.push(this._buttons[index]); 630 options.push(this._buttons[index]);
634 } 631 }
635 return options; 632 return options;
636 }, 633 },
637 634
638 __proto__: WebInspector.StatusBarButton.prototype 635 __proto__: WebInspector.StatusBarButton.prototype
639 } 636 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/SourcesPanel.js ('k') | Source/devtools/front_end/sourcesPanel.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698