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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/SourcesPanel.js

Issue 2389883003: DevTools: hoist debugger paused reason to top (Closed)
Patch Set: address comments; new widget 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) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 this._runSnippetAction = /** @type {!WebInspector.Action }*/ (WebInspector.a ctionRegistry.action("debugger.run-snippet")); 44 this._runSnippetAction = /** @type {!WebInspector.Action }*/ (WebInspector.a ctionRegistry.action("debugger.run-snippet"));
45 this._togglePauseAction = /** @type {!WebInspector.Action }*/ (WebInspector. actionRegistry.action("debugger.toggle-pause")); 45 this._togglePauseAction = /** @type {!WebInspector.Action }*/ (WebInspector. actionRegistry.action("debugger.toggle-pause"));
46 this._stepOverAction = /** @type {!WebInspector.Action }*/ (WebInspector.act ionRegistry.action("debugger.step-over")); 46 this._stepOverAction = /** @type {!WebInspector.Action }*/ (WebInspector.act ionRegistry.action("debugger.step-over"));
47 this._stepIntoAction = /** @type {!WebInspector.Action }*/ (WebInspector.act ionRegistry.action("debugger.step-into")); 47 this._stepIntoAction = /** @type {!WebInspector.Action }*/ (WebInspector.act ionRegistry.action("debugger.step-into"));
48 this._stepOutAction = /** @type {!WebInspector.Action }*/ (WebInspector.acti onRegistry.action("debugger.step-out")); 48 this._stepOutAction = /** @type {!WebInspector.Action }*/ (WebInspector.acti onRegistry.action("debugger.step-out"));
49 this._toggleBreakpointsActiveAction = /** @type {!WebInspector.Action }*/ (W ebInspector.actionRegistry.action("debugger.toggle-breakpoints-active")); 49 this._toggleBreakpointsActiveAction = /** @type {!WebInspector.Action }*/ (W ebInspector.actionRegistry.action("debugger.toggle-breakpoints-active"));
50 50
51 this._debugToolbar = this._createDebugToolbar(); 51 this._debugToolbar = this._createDebugToolbar();
52 this._debugToolbarDrawer = this._createDebugToolbarDrawer(); 52 this._debugToolbarDrawer = this._createDebugToolbarDrawer();
53 this._debuggerPausedMessage = new WebInspector.DebuggerPausedMessage();
53 54
54 const initialDebugSidebarWidth = 225; 55 const initialDebugSidebarWidth = 225;
55 this._splitWidget = new WebInspector.SplitWidget(true, true, "sourcesPanelSp litViewState", initialDebugSidebarWidth); 56 this._splitWidget = new WebInspector.SplitWidget(true, true, "sourcesPanelSp litViewState", initialDebugSidebarWidth);
56 this._splitWidget.enableShowModeSaving(); 57 this._splitWidget.enableShowModeSaving();
57 this._splitWidget.show(this.element); 58 this._splitWidget.show(this.element);
58 59
59 // Create scripts navigator 60 // Create scripts navigator
60 const initialNavigatorWidth = 225; 61 const initialNavigatorWidth = 225;
61 this.editorView = new WebInspector.SplitWidget(true, false, "sourcesPanelNav igatorSplitViewState", initialNavigatorWidth); 62 this.editorView = new WebInspector.SplitWidget(true, false, "sourcesPanelNav igatorSplitViewState", initialNavigatorWidth);
62 this.editorView.enableShowModeSaving(); 63 this.editorView.enableShowModeSaving();
(...skipping 23 matching lines...) Expand all
86 this._threadsSidebarPane = null; 87 this._threadsSidebarPane = null;
87 this._watchSidebarPane = /** @type {!WebInspector.View} */ (WebInspector.vie wManager.view("sources.watch")); 88 this._watchSidebarPane = /** @type {!WebInspector.View} */ (WebInspector.vie wManager.view("sources.watch"));
88 // TODO: Force installing listeners from the model, not the UI. 89 // TODO: Force installing listeners from the model, not the UI.
89 self.runtime.sharedInstance(WebInspector.XHRBreakpointsSidebarPane); 90 self.runtime.sharedInstance(WebInspector.XHRBreakpointsSidebarPane);
90 this._callstackPane = self.runtime.sharedInstance(WebInspector.CallStackSide barPane); 91 this._callstackPane = self.runtime.sharedInstance(WebInspector.CallStackSide barPane);
91 this._callstackPane.registerShortcuts(this.registerShortcuts.bind(this)); 92 this._callstackPane.registerShortcuts(this.registerShortcuts.bind(this));
92 93
93 WebInspector.moduleSetting("sidebarPosition").addChangeListener(this._update SidebarPosition.bind(this)); 94 WebInspector.moduleSetting("sidebarPosition").addChangeListener(this._update SidebarPosition.bind(this));
94 this._updateSidebarPosition(); 95 this._updateSidebarPosition();
95 96
96 this._updateDebuggerButtons(); 97 this._updateDebuggerButtonsAndStatus();
97 this._pauseOnExceptionEnabledChanged(); 98 this._pauseOnExceptionEnabledChanged();
98 WebInspector.moduleSetting("pauseOnExceptionEnabled").addChangeListener(this ._pauseOnExceptionEnabledChanged, this); 99 WebInspector.moduleSetting("pauseOnExceptionEnabled").addChangeListener(this ._pauseOnExceptionEnabledChanged, this);
99 100
100 this._liveLocationPool = new WebInspector.LiveLocationPool(); 101 this._liveLocationPool = new WebInspector.LiveLocationPool();
101 102
102 this._setTarget(WebInspector.context.flavor(WebInspector.Target)); 103 this._setTarget(WebInspector.context.flavor(WebInspector.Target));
103 WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManag er.Events.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, th is); 104 WebInspector.breakpointManager.addEventListener(WebInspector.BreakpointManag er.Events.BreakpointsActiveStateChanged, this._breakpointsActiveStateChanged, th is);
104 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._onCu rrentTargetChanged, this); 105 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._onCu rrentTargetChanged, this);
105 WebInspector.context.addFlavorChangeListener(WebInspector.DebuggerModel.Call Frame, this._callFrameChanged, this); 106 WebInspector.context.addFlavorChangeListener(WebInspector.DebuggerModel.Call Frame, this._callFrameChanged, this);
106 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerWasEnabled, this._debuggerWasEnabled, this ); 107 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI nspector.DebuggerModel.Events.DebuggerWasEnabled, this._debuggerWasEnabled, this );
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 else if (!this._paused) 262 else if (!this._paused)
262 WebInspector.context.setFlavor(WebInspector.Target, details.target() ); 263 WebInspector.context.setFlavor(WebInspector.Target, details.target() );
263 }, 264 },
264 265
265 /** 266 /**
266 * @param {!WebInspector.DebuggerPausedDetails} details 267 * @param {!WebInspector.DebuggerPausedDetails} details
267 */ 268 */
268 _showDebuggerPausedDetails: function(details) 269 _showDebuggerPausedDetails: function(details)
269 { 270 {
270 this._paused = true; 271 this._paused = true;
271 this._updateDebuggerButtons(); 272 this._updateDebuggerButtonsAndStatus();
272 WebInspector.context.setFlavor(WebInspector.DebuggerPausedDetails, detai ls); 273 WebInspector.context.setFlavor(WebInspector.DebuggerPausedDetails, detai ls);
273 this._toggleDebuggerSidebarButton.setEnabled(false); 274 this._toggleDebuggerSidebarButton.setEnabled(false);
274 window.focus(); 275 window.focus();
275 InspectorFrontendHost.bringToFront(); 276 InspectorFrontendHost.bringToFront();
276 }, 277 },
277 278
278 /** 279 /**
279 * @param {!WebInspector.Event} event 280 * @param {!WebInspector.Event} event
280 */ 281 */
281 _debuggerResumed: function(event) 282 _debuggerResumed: function(event)
(...skipping 10 matching lines...) Expand all
292 293
293 /** 294 /**
294 * @param {!WebInspector.Event} event 295 * @param {!WebInspector.Event} event
295 */ 296 */
296 _debuggerWasEnabled: function(event) 297 _debuggerWasEnabled: function(event)
297 { 298 {
298 var target = /** @type {!WebInspector.Target} */ (event.target.target() ); 299 var target = /** @type {!WebInspector.Target} */ (event.target.target() );
299 if (WebInspector.context.flavor(WebInspector.Target) !== target) 300 if (WebInspector.context.flavor(WebInspector.Target) !== target)
300 return; 301 return;
301 302
302 this._updateDebuggerButtons(); 303 this._updateDebuggerButtonsAndStatus();
303 }, 304 },
304 305
305 /** 306 /**
306 * @param {!WebInspector.Event} event 307 * @param {!WebInspector.Event} event
307 */ 308 */
308 _debuggerReset: function(event) 309 _debuggerReset: function(event)
309 { 310 {
310 this._debuggerResumed(event); 311 this._debuggerResumed(event);
311 }, 312 },
312 313
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 }, 446 },
446 447
447 _pauseOnExceptionEnabledChanged: function() 448 _pauseOnExceptionEnabledChanged: function()
448 { 449 {
449 var enabled = WebInspector.moduleSetting("pauseOnExceptionEnabled").get( ); 450 var enabled = WebInspector.moduleSetting("pauseOnExceptionEnabled").get( );
450 this._pauseOnExceptionButton.setToggled(enabled); 451 this._pauseOnExceptionButton.setToggled(enabled);
451 this._pauseOnExceptionButton.setTitle(WebInspector.UIString(enabled ? "D on't pause on exceptions" : "Pause on exceptions")); 452 this._pauseOnExceptionButton.setTitle(WebInspector.UIString(enabled ? "D on't pause on exceptions" : "Pause on exceptions"));
452 this._debugToolbarDrawer.classList.toggle("expanded", enabled); 453 this._debugToolbarDrawer.classList.toggle("expanded", enabled);
453 }, 454 },
454 455
455 _updateDebuggerButtons: function() 456 _updateDebuggerButtonsAndStatus: function()
456 { 457 {
457 var currentTarget = WebInspector.context.flavor(WebInspector.Target); 458 var currentTarget = WebInspector.context.flavor(WebInspector.Target);
458 var currentDebuggerModel = WebInspector.DebuggerModel.fromTarget(current Target); 459 var currentDebuggerModel = WebInspector.DebuggerModel.fromTarget(current Target);
459 if (!currentDebuggerModel) { 460 if (!currentDebuggerModel) {
460 this._togglePauseAction.setEnabled(false); 461 this._togglePauseAction.setEnabled(false);
461 this._stepOverAction.setEnabled(false); 462 this._stepOverAction.setEnabled(false);
462 this._stepIntoAction.setEnabled(false); 463 this._stepIntoAction.setEnabled(false);
463 this._stepOutAction.setEnabled(false); 464 this._stepOutAction.setEnabled(false);
464 } else if (this._paused) { 465 } else if (this._paused) {
465 this._togglePauseAction.setToggled(true); 466 this._togglePauseAction.setToggled(true);
466 this._togglePauseAction.setEnabled(true); 467 this._togglePauseAction.setEnabled(true);
467 this._stepOverAction.setEnabled(true); 468 this._stepOverAction.setEnabled(true);
468 this._stepIntoAction.setEnabled(true); 469 this._stepIntoAction.setEnabled(true);
469 this._stepOutAction.setEnabled(true); 470 this._stepOutAction.setEnabled(true);
470 } else { 471 } else {
471 this._togglePauseAction.setToggled(false); 472 this._togglePauseAction.setToggled(false);
472 this._togglePauseAction.setEnabled(!currentDebuggerModel.isPausing() ); 473 this._togglePauseAction.setEnabled(!currentDebuggerModel.isPausing() );
473 this._stepOverAction.setEnabled(false); 474 this._stepOverAction.setEnabled(false);
474 this._stepIntoAction.setEnabled(false); 475 this._stepIntoAction.setEnabled(false);
475 this._stepOutAction.setEnabled(false); 476 this._stepOutAction.setEnabled(false);
476 } 477 }
478
479 var details = currentDebuggerModel && currentDebuggerModel.debuggerPause dDetails();
480 this._debuggerPausedMessage.render(details);
477 }, 481 },
478 482
479 _clearInterface: function() 483 _clearInterface: function()
480 { 484 {
481 this._sourcesView.clearCurrentExecutionLine(); 485 this._sourcesView.clearCurrentExecutionLine();
482 this._updateDebuggerButtons(); 486 this._updateDebuggerButtonsAndStatus();
483 WebInspector.context.setFlavor(WebInspector.DebuggerPausedDetails, null) ; 487 WebInspector.context.setFlavor(WebInspector.DebuggerPausedDetails, null) ;
484 488
485 if (this._switchToPausedTargetTimeout) 489 if (this._switchToPausedTargetTimeout)
486 clearTimeout(this._switchToPausedTargetTimeout); 490 clearTimeout(this._switchToPausedTargetTimeout);
487 this._liveLocationPool.disposeAll(); 491 this._liveLocationPool.disposeAll();
488 }, 492 },
489 493
490 /** 494 /**
491 * @param {!WebInspector.DebuggerModel} debuggerModel 495 * @param {!WebInspector.DebuggerModel} debuggerModel
492 */ 496 */
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 1058
1055 WebInspector.SourcesPanel.updateResizer(this); 1059 WebInspector.SourcesPanel.updateResizer(this);
1056 1060
1057 // Create vertical box with stack. 1061 // Create vertical box with stack.
1058 var vbox = new WebInspector.VBox(); 1062 var vbox = new WebInspector.VBox();
1059 vbox.element.appendChild(this._debugToolbarDrawer); 1063 vbox.element.appendChild(this._debugToolbarDrawer);
1060 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minTo olbarWidth, 100); 1064 vbox.setMinimumAndPreferredSizes(25, 25, WebInspector.SourcesPanel.minTo olbarWidth, 100);
1061 this._sidebarPaneStack = WebInspector.viewManager.createStackLocation(th is._revealDebuggerSidebar.bind(this)); 1065 this._sidebarPaneStack = WebInspector.viewManager.createStackLocation(th is._revealDebuggerSidebar.bind(this));
1062 this._sidebarPaneStack.widget().element.classList.add("overflow-auto"); 1066 this._sidebarPaneStack.widget().element.classList.add("overflow-auto");
1063 this._sidebarPaneStack.widget().show(vbox.element); 1067 this._sidebarPaneStack.widget().show(vbox.element);
1068 this._debuggerPausedMessage.show(this._sidebarPaneStack.widget().element );
1064 vbox.element.appendChild(this._debugToolbar.element); 1069 vbox.element.appendChild(this._debugToolbar.element);
1065 1070
1066 if (this._threadsSidebarPane) 1071 if (this._threadsSidebarPane)
1067 this._sidebarPaneStack.showView(this._threadsSidebarPane); 1072 this._sidebarPaneStack.showView(this._threadsSidebarPane);
1068 1073
1069 if (!vertically) 1074 if (!vertically)
1070 this._sidebarPaneStack.appendView(this._watchSidebarPane); 1075 this._sidebarPaneStack.appendView(this._watchSidebarPane);
1071 1076
1072 this._sidebarPaneStack.showView(this._callstackPane); 1077 this._sidebarPaneStack.showView(this._callstackPane);
1073 var jsBreakpoints = /** @type {!WebInspector.View} */ (WebInspector.view Manager.view("sources.jsBreakpoints")); 1078 var jsBreakpoints = /** @type {!WebInspector.View} */ (WebInspector.view Manager.view("sources.jsBreakpoints"));
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 __proto__: WebInspector.VBox.prototype 1390 __proto__: WebInspector.VBox.prototype
1386 } 1391 }
1387 1392
1388 /** 1393 /**
1389 * @return {boolean} 1394 * @return {boolean}
1390 */ 1395 */
1391 WebInspector.SourcesPanel.WrapperView.isShowing = function() 1396 WebInspector.SourcesPanel.WrapperView.isShowing = function()
1392 { 1397 {
1393 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing(); 1398 return !!WebInspector.SourcesPanel.WrapperView._instance && WebInspector.Sou rcesPanel.WrapperView._instance.isShowing();
1394 } 1399 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698