Web Inspector: Debugger sidebar should group global breakpoints together
authorjonowells@apple.com <jonowells@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Mar 2015 20:32:29 +0000 (20:32 +0000)
committerjonowells@apple.com <jonowells@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 12 Mar 2015 20:32:29 +0000 (20:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=142607

Reviewed by Timothy Hatcher.

Update the DebuggerSidebarPanel class to hold global breakpoints such as "All Exceptions" in one container. This
will be the place future such breakpoints are added.

* Localizations/en.lproj/localizedStrings.js: Added string.
* UserInterface/Main.html: Small rearrangement.

* UserInterface/Views/DebuggerSidebarPanel.js: Change how exception breaking options are displayed.
(WebInspector.DebuggerSidebarPanel):
(WebInspector.DebuggerSidebarPanel.prototype._treeElementSelected):
(WebInspector.DebuggerSidebarPanel.prototype._compareTopLevelTreeElements):

* UserInterface/Views/FolderTreeElement.js: Support additional classes for icons.
* UserInterface/Views/ResourceSidebarPanel.js: Change call to FolderTreeElement constructor.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@181452 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Main.html
Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/FolderTreeElement.js
Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js

index f908882..fc615c6 100644 (file)
@@ -1,3 +1,24 @@
+2015-03-12  Jono Wells  <jonowells@apple.com>
+
+        Web Inspector: Debugger sidebar should group global breakpoints together
+        https://bugs.webkit.org/show_bug.cgi?id=142607
+
+        Reviewed by Timothy Hatcher.
+
+        Update the DebuggerSidebarPanel class to hold global breakpoints such as "All Exceptions" in one container. This
+        will be the place future such breakpoints are added.
+
+        * Localizations/en.lproj/localizedStrings.js: Added string.
+        * UserInterface/Main.html: Small rearrangement.
+
+        * UserInterface/Views/DebuggerSidebarPanel.js: Change how exception breaking options are displayed.
+        (WebInspector.DebuggerSidebarPanel):
+        (WebInspector.DebuggerSidebarPanel.prototype._treeElementSelected):
+        (WebInspector.DebuggerSidebarPanel.prototype._compareTopLevelTreeElements):
+
+        * UserInterface/Views/FolderTreeElement.js: Support additional classes for icons.
+        * UserInterface/Views/ResourceSidebarPanel.js: Change call to FolderTreeElement constructor.
+
 2015-03-12  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Console Errors during provisional document loads get lost with "Clear Log on Reload"
index ef8f790..df86f8e 100644 (file)
Binary files a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js and b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js differ
index 09a5994..373b6fc 100644 (file)
 
     <script src="Views/DOMDetailsSidebarPanel.js"></script>
     <script src="Views/ObjectTreeBaseTreeElement.js"></script>
+    <script src="Views/FolderTreeElement.js"></script>
     <script src="Views/FolderizedTreeElement.js"></script>
     <script src="Views/SourceCodeTreeElement.js"></script>
     <script src="Views/StorageTreeElement.js"></script>
     <script src="Views/FilterBar.js"></script>
     <script src="Views/FindBanner.js"></script>
     <script src="Views/FlexibleSpaceNavigationItem.js"></script>
-    <script src="Views/FolderTreeElement.js"></script>
     <script src="Views/FontResourceContentView.js"></script>
     <script src="Views/FormattedValue.js"></script>
     <script src="Views/FrameContentView.js"></script>
index ab561d2..28703c2 100644 (file)
@@ -104,6 +104,7 @@ WebInspector.DebuggerSidebarPanel = function()
     // Add this offset-sections class name so the sticky headers don't overlap the navigation bar.
     this.element.classList.add(WebInspector.DebuggerSidebarPanel.OffsetSectionsStyleClassName);
 
+    this._globalBreakpointsFolderTreeElement = new WebInspector.FolderTreeElement(WebInspector.UIString("Global Breakpoints"), null, WebInspector.DebuggerSidebarPanel.GlobalIconStyleClassName);
     this._allExceptionsBreakpointTreeElement = new WebInspector.BreakpointTreeElement(WebInspector.debuggerManager.allExceptionsBreakpoint, WebInspector.DebuggerSidebarPanel.ExceptionIconStyleClassName, WebInspector.UIString("All Exceptions"));
     this._allUncaughtExceptionsBreakpointTreeElement = new WebInspector.BreakpointTreeElement(WebInspector.debuggerManager.allUncaughtExceptionsBreakpoint, WebInspector.DebuggerSidebarPanel.ExceptionIconStyleClassName, WebInspector.UIString("All Uncaught Exceptions"));
 
@@ -114,8 +115,10 @@ WebInspector.DebuggerSidebarPanel = function()
     this._breakpointsContentTreeOutline.ondelete = this._breakpointTreeOutlineDeleteTreeElement.bind(this);
     this._breakpointsContentTreeOutline.oncontextmenu = this._breakpointTreeOutlineContextMenuTreeElement.bind(this);
 
-    this._breakpointsContentTreeOutline.appendChild(this._allExceptionsBreakpointTreeElement);
-    this._breakpointsContentTreeOutline.appendChild(this._allUncaughtExceptionsBreakpointTreeElement);
+    this._breakpointsContentTreeOutline.appendChild(this._globalBreakpointsFolderTreeElement);
+    this._globalBreakpointsFolderTreeElement.appendChild(this._allExceptionsBreakpointTreeElement);
+    this._globalBreakpointsFolderTreeElement.appendChild(this._allUncaughtExceptionsBreakpointTreeElement);
+    this._globalBreakpointsFolderTreeElement.expand();
 
     var breakpointsRow = new WebInspector.DetailsSectionRow;
     breakpointsRow.element.appendChild(this._breakpointsContentTreeOutline.element);
@@ -147,6 +150,7 @@ WebInspector.DebuggerSidebarPanel = function()
 WebInspector.DebuggerSidebarPanel.OffsetSectionsStyleClassName = "offset-sections";
 WebInspector.DebuggerSidebarPanel.ExceptionIconStyleClassName = "breakpoint-exception-icon";
 WebInspector.DebuggerSidebarPanel.PausedBreakpointIconStyleClassName = "breakpoint-paused-icon";
+WebInspector.DebuggerSidebarPanel.GlobalIconStyleClassName = "global-breakpoints-icon";
 
 WebInspector.DebuggerSidebarPanel.SelectedAllExceptionsCookieKey = "debugger-sidebar-panel-all-exceptions-breakpoint";
 WebInspector.DebuggerSidebarPanel.SelectedAllUncaughtExceptionsCookieKey = "debugger-sidebar-panel-all-uncaught-exceptions-breakpoint";
@@ -524,7 +528,7 @@ WebInspector.DebuggerSidebarPanel.prototype = {
 
     _breakpointTreeOutlineContextMenuTreeElement: function(event, treeElement)
     {
-        console.assert(treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement);
+        console.assert(treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement || treeElement.constructor === WebInspector.FolderTreeElement);
         if (!(treeElement instanceof WebInspector.ResourceTreeElement) && !(treeElement instanceof WebInspector.ScriptTreeElement))
             return;
 
@@ -600,7 +604,7 @@ WebInspector.DebuggerSidebarPanel.prototype = {
             return;
         }
 
-        if (!(treeElement instanceof WebInspector.BreakpointTreeElement))
+        if (!(treeElement instanceof WebInspector.BreakpointTreeElement) || treeElement.parent.constructor === WebInspector.FolderTreeElement)
             return;
 
         // Deselect any other tree elements to prevent two selections in the sidebar.
@@ -629,14 +633,9 @@ WebInspector.DebuggerSidebarPanel.prototype = {
 
     _compareTopLevelTreeElements: function(a, b)
     {
-        if (a === this._allExceptionsBreakpointTreeElement)
-            return -1;
-        if (b === this._allExceptionsBreakpointTreeElement)
-            return 1;
-
-        if (a === this._allUncaughtExceptionsBreakpointTreeElement)
+        if (a === this._globalBreakpointsFolderTreeElement)
             return -1;
-        if (b === this._allUncaughtExceptionsBreakpointTreeElement)
+        if (b === this._globalBreakpointsFolderTreeElement)
             return 1;
 
         return a.mainTitle.localeCompare(b.mainTitle);
index 3d460a1..8cae8b7 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.FolderTreeElement = function(title, subtitle, representedObject)
+WebInspector.FolderTreeElement = function(title, subtitle, additionalClassNames, representedObject)
 {
-    WebInspector.GeneralTreeElement.call(this, WebInspector.FolderTreeElement.FolderIconStyleClassName, title, subtitle, representedObject, true);
+    var classNames;
+    if (!additionalClassNames)
+        classNames = [];
+    else if (additionalClassNames.constructor === Array)
+        classNames = additionalClassNames;
+    else if (typeof additionalClassNames === "string")
+        classNames = [additionalClassNames];
+
+    classNames.unshift(WebInspector.FolderTreeElement.FolderIconStyleClassName);
+
+    WebInspector.GeneralTreeElement.call(this, classNames, title, subtitle, representedObject, true);
 
     this.small = true;
 };
@@ -33,7 +43,7 @@ WebInspector.FolderTreeElement = function(title, subtitle, representedObject)
 WebInspector.FolderTreeElement.FolderIconStyleClassName = "folder-icon";
 
 WebInspector.FolderTreeElement.prototype = {
-    constructor: WebInspector.FolderTreeElement,
+    constructor: WebInspector.FolderTreeElement
 
     // No Methods or Properties
 };
index 5bda55a..1364a76 100644 (file)
@@ -910,7 +910,7 @@ WebInspector.ResourceSidebarPanel.prototype = {
             previousOnlyChild.flattened = false;
             this._resourcesContentTreeOutline.removeChild(previousOnlyChild);
 
-            var folderElement = new WebInspector.FolderTreeElement(folderName, null, null);
+            var folderElement = new WebInspector.FolderTreeElement(folderName);
             this._resourcesContentTreeOutline.insertChild(folderElement, insertionIndexForObjectInListSortedByFunction(folderElement, this._resourcesContentTreeOutline.children, this._compareTreeElements));
 
             folderElement.appendChild(previousOnlyChild);