Title: [120928] trunk/Source/WebCore
Revision
120928
Author
[email protected]
Date
2012-06-21 09:34:36 -0700 (Thu, 21 Jun 2012)

Log Message

Web Inspector: do not add separator to the end of the context menu.
https://bugs.webkit.org/show_bug.cgi?id=89634

Reviewed by Vsevolod Vlasov.

Attaching separators only before menu items now.

* inspector/front-end/ContextMenu.js:
(WebInspector.ContextSubMenuItem.prototype.appendItem):
(WebInspector.ContextSubMenuItem.prototype.appendSubMenuItem):
(WebInspector.ContextSubMenuItem.prototype.appendCheckboxItem):
(WebInspector.ContextSubMenuItem.prototype.appendSeparator):
(WebInspector.ContextSubMenuItem.prototype._pushItem):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (120927 => 120928)


--- trunk/Source/WebCore/ChangeLog	2012-06-21 15:46:40 UTC (rev 120927)
+++ trunk/Source/WebCore/ChangeLog	2012-06-21 16:34:36 UTC (rev 120928)
@@ -1,3 +1,19 @@
+2012-06-21  Pavel Feldman  <[email protected]>
+
+        Web Inspector: do not add separator to the end of the context menu.
+        https://bugs.webkit.org/show_bug.cgi?id=89634
+
+        Reviewed by Vsevolod Vlasov.
+
+        Attaching separators only before menu items now.
+
+        * inspector/front-end/ContextMenu.js:
+        (WebInspector.ContextSubMenuItem.prototype.appendItem):
+        (WebInspector.ContextSubMenuItem.prototype.appendSubMenuItem):
+        (WebInspector.ContextSubMenuItem.prototype.appendCheckboxItem):
+        (WebInspector.ContextSubMenuItem.prototype.appendSeparator):
+        (WebInspector.ContextSubMenuItem.prototype._pushItem):
+
 2012-06-21  Taiju Tsuiki  <[email protected]>
 
         Web Inspector: Unify FileSystem callbacks

Modified: trunk/Source/WebCore/inspector/front-end/ContextMenu.js (120927 => 120928)


--- trunk/Source/WebCore/inspector/front-end/ContextMenu.js	2012-06-21 15:46:40 UTC (rev 120927)
+++ trunk/Source/WebCore/inspector/front-end/ContextMenu.js	2012-06-21 16:34:36 UTC (rev 120928)
@@ -91,7 +91,7 @@
     appendItem: function(label, handler, disabled)
     {
         var item = new WebInspector.ContextMenuItem(this._contextMenu, "item", label, disabled);
-        this._items.push(item);
+        this._pushItem(item);
         this._contextMenu._setHandler(item.id(), handler);
         return item;
     },
@@ -99,7 +99,7 @@
     appendSubMenuItem: function(label, disabled)
     {
         var item = new WebInspector.ContextSubMenuItem(this._contextMenu, label, disabled);
-        this._items.push(item);
+        this._pushItem(item);
         return item;
     },
 
@@ -109,21 +109,24 @@
     appendCheckboxItem: function(label, handler, checked, disabled)
     {
         var item = new WebInspector.ContextMenuItem(this._contextMenu, "checkbox", label, disabled, checked);
-        this._items.push(item);
+        this._pushItem(item);
         this._contextMenu._setHandler(item.id(), handler);
         return item;
     },
 
     appendSeparator: function()
     {
-        // No separator dupes allowed.
-        if (this._items.length === 0)
-            return null;
-        if (this._items[this._items.length - 1].type() === "separator")
-            return null;
-        var item = new WebInspector.ContextMenuItem(this._contextMenu, "separator");
+        if (this._items.length)
+            this._pendingSeparator = true;
+    },
+
+    _pushItem: function(item)
+    {
+        if (this._pendingSeparator) {
+            this._items.push(new WebInspector.ContextMenuItem(this._contextMenu, "separator"));
+            delete this._pendingSeparator;
+        }
         this._items.push(item);
-        return item;
     },
 
     /**
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to