[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

pfeldman at chromium.org pfeldman at chromium.org
Thu Apr 8 00:35:27 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 59eca95605a4fe90141581ebca3051e0e3885feb
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Dec 14 18:01:08 2009 +0000

    2009-12-14  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Timothy Hatcher.
    
            Web Inspector: [regression] inspector deletes nodes when editing css.
    
            Now all the treeoutlines are focusable, sections and their titles
            are also focusable. Change contains couple of drive-by fixes such as
            canceling of the attribute edit nuking attr info and maintaining proper
            selection while deleting nodes.
    
            https://bugs.webkit.org/show_bug.cgi?id=32460
    
            * inspector/front-end/CallStackSidebarPane.js:
            (WebInspector.CallStackSidebarPane.prototype.handleShortcut):
            * inspector/front-end/ConsoleView.js:
            (WebInspector.ConsoleView.prototype._promptKeyDown):
            * inspector/front-end/DataGrid.js:
            (WebInspector.DataGrid.prototype._keyDown):
            * inspector/front-end/DatabaseQueryView.js:
            (WebInspector.DatabaseQueryView):
            (WebInspector.DatabaseQueryView.prototype._promptKeyDown):
            * inspector/front-end/ElementsPanel.js:
            (WebInspector.ElementsPanel.this.treeOutline.focusedNodeChanged):
            (WebInspector.ElementsPanel.prototype.get defaultFocusedElement):
            (WebInspector.ElementsPanel.prototype.handleShortcut):
            * inspector/front-end/ElementsTreeOutline.js:
            (WebInspector.ElementsTreeOutline):
            (WebInspector.ElementsTreeOutline.prototype._keyDown):
            (WebInspector.ElementsTreeElement.prototype._textNodeEditingCommitted):
            (WebInspector.ElementsTreeElement.prototype._editingCancelled):
            * inspector/front-end/Panel.js:
            (WebInspector.Panel.prototype.show):
            (WebInspector.Panel.prototype.get defaultFocusedElement):
            * inspector/front-end/PropertiesSection.js:
            (WebInspector.PropertiesSection):
            * inspector/front-end/ScriptsPanel.js:
            (WebInspector.ScriptsPanel):
            (WebInspector.ScriptsPanel.prototype.get defaultFocusedElement):
            (WebInspector.ScriptsPanel.prototype.handleShortcut):
            * inspector/front-end/SidebarPane.js:
            (WebInspector.SidebarPane):
            (WebInspector.SidebarPane.prototype.toggleExpanded):
            (WebInspector.SidebarPane.prototype._onTitleKeyDown):
            * inspector/front-end/SourceFrame.js:
            (WebInspector.SourceFrame.prototype._loaded):
            * inspector/front-end/TextPrompt.js:
            (WebInspector.TextPrompt):
            * inspector/front-end/inspector.css:
            * inspector/front-end/inspector.html:
            * inspector/front-end/inspector.js:
            (WebInspector.loaded):
            (WebInspector.documentKeyDown):
            (WebInspector.documentCanCopy):
            (WebInspector.documentCopy):
            (WebInspector._searchFieldManualFocus):
            (WebInspector._searchKeyDown):
            (WebInspector.startEditing.cleanUpAfterEditing):
            (WebInspector.startEditing.keyDownEventListener):
            (WebInspector.startEditing):
            * inspector/front-end/treeoutline.js:
            (TreeOutline):
            (TreeOutline._removeChildAtIndex):
            (TreeOutline.prototype._treeKeyDown):
            (TreeElement.prototype.deselect):
            * inspector/front-end/utilities.js:
            ():
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52099 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 562fa6a..3fd6c3f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,71 @@
+2009-12-14  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Timothy Hatcher.
+
+        Web Inspector: [regression] inspector deletes nodes when editing css.
+
+        Now all the treeoutlines are focusable, sections and their titles
+        are also focusable. Change contains couple of drive-by fixes such as
+        canceling of the attribute edit nuking attr info and maintaining proper
+        selection while deleting nodes.
+
+        https://bugs.webkit.org/show_bug.cgi?id=32460
+
+        * inspector/front-end/CallStackSidebarPane.js:
+        (WebInspector.CallStackSidebarPane.prototype.handleShortcut):
+        * inspector/front-end/ConsoleView.js:
+        (WebInspector.ConsoleView.prototype._promptKeyDown):
+        * inspector/front-end/DataGrid.js:
+        (WebInspector.DataGrid.prototype._keyDown):
+        * inspector/front-end/DatabaseQueryView.js:
+        (WebInspector.DatabaseQueryView):
+        (WebInspector.DatabaseQueryView.prototype._promptKeyDown):
+        * inspector/front-end/ElementsPanel.js:
+        (WebInspector.ElementsPanel.this.treeOutline.focusedNodeChanged):
+        (WebInspector.ElementsPanel.prototype.get defaultFocusedElement):
+        (WebInspector.ElementsPanel.prototype.handleShortcut):
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeOutline):
+        (WebInspector.ElementsTreeOutline.prototype._keyDown):
+        (WebInspector.ElementsTreeElement.prototype._textNodeEditingCommitted):
+        (WebInspector.ElementsTreeElement.prototype._editingCancelled):
+        * inspector/front-end/Panel.js:
+        (WebInspector.Panel.prototype.show):
+        (WebInspector.Panel.prototype.get defaultFocusedElement):
+        * inspector/front-end/PropertiesSection.js:
+        (WebInspector.PropertiesSection):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel):
+        (WebInspector.ScriptsPanel.prototype.get defaultFocusedElement):
+        (WebInspector.ScriptsPanel.prototype.handleShortcut):
+        * inspector/front-end/SidebarPane.js:
+        (WebInspector.SidebarPane):
+        (WebInspector.SidebarPane.prototype.toggleExpanded):
+        (WebInspector.SidebarPane.prototype._onTitleKeyDown):
+        * inspector/front-end/SourceFrame.js:
+        (WebInspector.SourceFrame.prototype._loaded):
+        * inspector/front-end/TextPrompt.js:
+        (WebInspector.TextPrompt):
+        * inspector/front-end/inspector.css:
+        * inspector/front-end/inspector.html:
+        * inspector/front-end/inspector.js:
+        (WebInspector.loaded):
+        (WebInspector.documentKeyDown):
+        (WebInspector.documentCanCopy):
+        (WebInspector.documentCopy):
+        (WebInspector._searchFieldManualFocus):
+        (WebInspector._searchKeyDown):
+        (WebInspector.startEditing.cleanUpAfterEditing):
+        (WebInspector.startEditing.keyDownEventListener):
+        (WebInspector.startEditing):
+        * inspector/front-end/treeoutline.js:
+        (TreeOutline):
+        (TreeOutline._removeChildAtIndex):
+        (TreeOutline.prototype._treeKeyDown):
+        (TreeElement.prototype.deselect):
+        * inspector/front-end/utilities.js:
+        ():
+
 2009-12-14  Dimitri Glazkov  <dglazkov at chromium.org>
 
         Unreviewed, build fix.
diff --git a/WebCore/inspector/front-end/CallStackSidebarPane.js b/WebCore/inspector/front-end/CallStackSidebarPane.js
index 2fe4315..ddca80b 100644
--- a/WebCore/inspector/front-end/CallStackSidebarPane.js
+++ b/WebCore/inspector/front-end/CallStackSidebarPane.js
@@ -109,13 +109,12 @@ WebInspector.CallStackSidebarPane.prototype = {
         this.dispatchEventToListeners("call frame selected");
     },
 
-    handleKeyEvent: function(event)
+    handleShortcut: function(event)
     {
         var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
         var handler = this._shortcuts[shortcut];
         if (handler) {
             handler(event);
-            event.preventDefault();
             event.handled = true;
         }
     },
diff --git a/WebCore/inspector/front-end/ConsoleView.js b/WebCore/inspector/front-end/ConsoleView.js
index 9815f4a..21299f7 100644
--- a/WebCore/inspector/front-end/ConsoleView.js
+++ b/WebCore/inspector/front-end/ConsoleView.js
@@ -45,7 +45,7 @@ WebInspector.ConsoleView = function(drawer)
     this.messagesElement.addEventListener("click", this._messagesClicked.bind(this), true);
 
     this.promptElement = document.getElementById("console-prompt");
-    this.promptElement.handleKeyEvent = this._promptKeyDown.bind(this);
+    this.promptElement.addEventListener("keydown", this._promptKeyDown.bind(this), true);
     this.prompt = new WebInspector.TextPrompt(this.promptElement, this.completions.bind(this), ExpressionStopCharacters + ".");
 
     this.topGroup = new WebInspector.ConsoleGroup(null, 0);
@@ -407,13 +407,6 @@ WebInspector.ConsoleView.prototype = {
             return;
         }
 
-        if (isFnKey(event)) {
-            if (WebInspector.currentPanel && WebInspector.currentPanel.handleKeyEvent) {
-                WebInspector.currentPanel.handleKeyEvent(event);
-                return;
-            }
-        }
-
         var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
         var handler = this._shortcuts[shortcut];
         if (handler) {
@@ -423,8 +416,6 @@ WebInspector.ConsoleView.prototype = {
                 return;
             }
         }
-
-        this.prompt.handleKeyEvent(event);
     },
 
     evalInInspectedWindow: function(expression, objectGroup, callback)
diff --git a/WebCore/inspector/front-end/DataGrid.js b/WebCore/inspector/front-end/DataGrid.js
index 7b58c8e..2c91db5 100644
--- a/WebCore/inspector/front-end/DataGrid.js
+++ b/WebCore/inspector/front-end/DataGrid.js
@@ -469,10 +469,11 @@ WebInspector.DataGrid.prototype = {
         this.children = [];
     },
 
-    handleKeyEvent: function(event)
+
+    _keyDown: function(event)
     {
         if (!this.selectedNode || event.shiftKey || event.metaKey || event.ctrlKey || this._editing)
-            return false;
+            return;
 
         var handled = false;
         var nextSelectedNode;
@@ -540,8 +541,6 @@ WebInspector.DataGrid.prototype = {
             event.preventDefault();
             event.stopPropagation();
         }
-
-        return handled;
     },
 
     expand: function()
@@ -572,11 +571,6 @@ WebInspector.DataGrid.prototype = {
         return rowElement._dataGridNode;
     },
 
-    _keyDown: function(event)
-    {
-        this.handleKeyEvent(event);
-    },
-
     _clickInHeaderCell: function(event)
     {
         var cell = event.target.enclosingNodeOrSelfWithNodeName("th");
diff --git a/WebCore/inspector/front-end/DatabaseQueryView.js b/WebCore/inspector/front-end/DatabaseQueryView.js
index e85af66..61b236c 100644
--- a/WebCore/inspector/front-end/DatabaseQueryView.js
+++ b/WebCore/inspector/front-end/DatabaseQueryView.js
@@ -38,7 +38,7 @@ WebInspector.DatabaseQueryView = function(database)
     this.promptElement = document.createElement("div");
     this.promptElement.className = "database-query-prompt";
     this.promptElement.appendChild(document.createElement("br"));
-    this.promptElement.handleKeyEvent = this._promptKeyDown.bind(this);
+    this.promptElement.addEventListener("keydown", this._promptKeyDown.bind(this), true);
     this.element.appendChild(this.promptElement);
 
     this.prompt = new WebInspector.TextPrompt(this.promptElement, this.completions.bind(this), " ");
@@ -98,8 +98,6 @@ WebInspector.DatabaseQueryView.prototype = {
             this._enterKeyPressed(event);
             return;
         }
-
-        this.prompt.handleKeyEvent(event);
     },
 
     _selectStart: function(event)
diff --git a/WebCore/inspector/front-end/ElementsPanel.js b/WebCore/inspector/front-end/ElementsPanel.js
index 9b18251..7c78902 100644
--- a/WebCore/inspector/front-end/ElementsPanel.js
+++ b/WebCore/inspector/front-end/ElementsPanel.js
@@ -46,7 +46,7 @@ WebInspector.ElementsPanel = function()
     this.treeOutline.focusedNodeChanged = function(forceUpdate)
     {
         if (this.panel.visible && WebInspector.currentFocusElement !== document.getElementById("search"))
-            WebInspector.currentFocusElement = document.getElementById("main-panels");
+            WebInspector.currentFocusElement = this.element;
 
         this.panel.updateBreadcrumb(forceUpdate);
 
@@ -129,6 +129,11 @@ WebInspector.ElementsPanel.prototype = {
         return [this.nodeSearchButton.element, this.crumbsElement];
     },
 
+    get defaultFocusedElement()
+    {
+        return this.treeOutline.element;
+    },
+
     updateStatusBarItems: function()
     {
         this.updateBreadcrumbSizes();
@@ -1024,7 +1029,7 @@ WebInspector.ElementsPanel.prototype = {
         eventListenersSidebarPane.needsUpdate = false;
     },
 
-    handleKeyEvent: function(event)
+    handleShortcut: function(event)
     {
         // Cmd/Control + Shift + C should be a shortcut to clicking the Node Search Button.
         // This shortcut matches Firebug.
@@ -1036,12 +1041,10 @@ WebInspector.ElementsPanel.prototype = {
 
             if (isNodeSearchKey) {
                 this._nodeSearchButtonClicked(event);
-                event.preventDefault();
+                event.handled = true;
                 return;
             }
         }
-        
-        this.treeOutline.handleKeyEvent(event);
     },
 
     handleCopyEvent: function(event)
diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js
index a035e7d..91ee9bc 100644
--- a/WebCore/inspector/front-end/ElementsTreeOutline.js
+++ b/WebCore/inspector/front-end/ElementsTreeOutline.js
@@ -43,6 +43,7 @@ WebInspector.ElementsTreeOutline = function() {
     this.focusedDOMNode = null;
 
     this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true);
+    this.element.addEventListener("keydown", this._keyDown.bind(this), true);
 }
 
 WebInspector.ElementsTreeOutline.prototype = {
@@ -191,8 +192,11 @@ WebInspector.ElementsTreeOutline.prototype = {
         return element;
     },
     
-    handleKeyEvent: function(event)
+    _keyDown: function(event)
     {
+        if (event.target !== this.treeOutline.element)
+            return;
+
         var selectedElement = this.selectedTreeElement;
         if (!selectedElement)
             return;
@@ -201,12 +205,13 @@ WebInspector.ElementsTreeOutline.prototype = {
                 event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Delete) {
             selectedElement.remove();
             event.preventDefault();
+            event.stopPropagation();
             return;
         }
 
         // On Enter or Return start editing the first attribute
         // or create a new attribute on the selected element.
-        if (event.keyIdentifier === "Enter") {
+        if (isEnterKey(event)) {
             if (this._editing)
                 return;
 
@@ -214,10 +219,9 @@ WebInspector.ElementsTreeOutline.prototype = {
 
             // prevent a newline from being immediately inserted
             event.preventDefault();
+            event.stopPropagation();
             return;
         }
-
-        TreeOutline.prototype.handleKeyEvent.call(this, event);
     },
 
     _onmousedown: function(event)
@@ -829,14 +833,16 @@ WebInspector.ElementsTreeElement.prototype = {
 
         textNode.nodeValue = newText;
 
-        // No need to call _updateTitle here, it will be called after the nodeValue is committed.
+        // Need to restore attributes / node structure.
+        this._updateTitle();
     },
 
     _editingCancelled: function(element, context)
     {
         delete this._editing;
 
-        // No need to call _updateTitle here, the editing code will revert to the original text.
+        // Need to restore attributes structure.
+        this._updateTitle();
     },
 
     _updateTitle: function()
diff --git a/WebCore/inspector/front-end/Panel.js b/WebCore/inspector/front-end/Panel.js
index d816ce5..95ce6b4 100644
--- a/WebCore/inspector/front-end/Panel.js
+++ b/WebCore/inspector/front-end/Panel.js
@@ -81,7 +81,7 @@ WebInspector.Panel.prototype = {
         if ("_toolbarItem" in this)
             this._toolbarItem.addStyleClass("toggled-on");
 
-        WebInspector.currentFocusElement = document.getElementById("main-panels");
+        WebInspector.currentFocusElement = this.defaultFocusedElement;
 
         this.updateSidebarWidth();
     },
@@ -97,6 +97,11 @@ WebInspector.Panel.prototype = {
             this._toolbarItem.removeStyleClass("toggled-on");
     },
 
+    get defaultFocusedElement()
+    {
+        return this.sidebarTreeElement || this.element;
+    },
+
     attach: function()
     {
         if (!this.element.parentNode)
@@ -274,17 +279,6 @@ WebInspector.Panel.prototype = {
             currentView.jumpToPreviousSearchResult();
     },
 
-    handleKeyEvent: function(event)
-    {
-        this.handleSidebarKeyEvent(event);
-    },
-
-    handleSidebarKeyEvent: function(event)
-    {
-        if (this.hasSidebar && this.sidebarTree)
-            this.sidebarTree.handleKeyEvent(event);
-    },
-
     createSidebar: function(parentElement, resizerParentElement)
     {
         if (this.hasSidebar)
diff --git a/WebCore/inspector/front-end/PropertiesSection.js b/WebCore/inspector/front-end/PropertiesSection.js
index a4b2fba..7db496b 100644
--- a/WebCore/inspector/front-end/PropertiesSection.js
+++ b/WebCore/inspector/front-end/PropertiesSection.js
@@ -47,6 +47,7 @@ WebInspector.PropertiesSection = function(title, subtitle)
 
     this.propertiesElement = document.createElement("ol");
     this.propertiesElement.className = "properties";
+    this.propertiesElement.tabIndex = 0;
     this.propertiesTreeOutline = new TreeOutline(this.propertiesElement);
     this.propertiesTreeOutline.section = this;
 
diff --git a/WebCore/inspector/front-end/ScriptsPanel.js b/WebCore/inspector/front-end/ScriptsPanel.js
index 8b31a8b..7f9b7ea 100644
--- a/WebCore/inspector/front-end/ScriptsPanel.js
+++ b/WebCore/inspector/front-end/ScriptsPanel.js
@@ -56,7 +56,6 @@ WebInspector.ScriptsPanel = function()
     this.filesSelectElement.className = "status-bar-item";
     this.filesSelectElement.id = "scripts-files";
     this.filesSelectElement.addEventListener("change", this._changeVisibleFile.bind(this), false);
-    this.filesSelectElement.handleKeyEvent = this.handleKeyEvent.bind(this);
     this.topStatusBar.appendChild(this.filesSelectElement);
 
     this.functionsSelectElement = document.createElement("select");
@@ -208,6 +207,11 @@ WebInspector.ScriptsPanel.prototype = {
         return [this.enableToggleButton.element, this.pauseOnExceptionButton.element];
     },
 
+    get defaultFocusedElement()
+    {
+        return this.filesSelectElement;
+    },
+
     get paused()
     {
         return this._paused;
@@ -515,17 +519,15 @@ WebInspector.ScriptsPanel.prototype = {
         this._showScriptOrResource((view.resource || view.script));
     },
 
-    handleKeyEvent: function(event)
+    handleShortcut: function(event)
     {
         var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
         var handler = this._shortcuts[shortcut];
         if (handler) {
             handler(event);
-            event.preventDefault();
             event.handled = true;
-        } else {
-            this.sidebarPanes.callstack.handleKeyEvent(event);
-        }
+        } else
+            this.sidebarPanes.callstack.handleShortcut(event);
     },
 
     scriptViewForScript: function(script)
diff --git a/WebCore/inspector/front-end/SidebarPane.js b/WebCore/inspector/front-end/SidebarPane.js
index af9e5f9..855894c 100644
--- a/WebCore/inspector/front-end/SidebarPane.js
+++ b/WebCore/inspector/front-end/SidebarPane.js
@@ -33,7 +33,9 @@ WebInspector.SidebarPane = function(title)
 
     this.titleElement = document.createElement("div");
     this.titleElement.className = "title";
+    this.titleElement.tabIndex = 0;
     this.titleElement.addEventListener("click", this.toggleExpanded.bind(this), false);
+    this.titleElement.addEventListener("keydown", this._onTitleKeyDown.bind(this), false);
 
     this.bodyElement = document.createElement("div");
     this.bodyElement.className = "body";
@@ -119,6 +121,12 @@ WebInspector.SidebarPane.prototype = {
     toggleExpanded: function()
     {
         this.expanded = !this.expanded;
+    },
+
+    _onTitleKeyDown: function(event)
+    {
+        if (isEnterKey(event) || event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Space)
+            this.toggleExpanded();
     }
 }
 
diff --git a/WebCore/inspector/front-end/SourceFrame.js b/WebCore/inspector/front-end/SourceFrame.js
index b5cf4c0..109515a 100644
--- a/WebCore/inspector/front-end/SourceFrame.js
+++ b/WebCore/inspector/front-end/SourceFrame.js
@@ -203,7 +203,6 @@ WebInspector.SourceFrame.prototype = {
         this.element.contentDocument.addEventListener("contextmenu", this._documentContextMenu.bind(this), true);
         this.element.contentDocument.addEventListener("mousedown", this._documentMouseDown.bind(this), true);
         this.element.contentDocument.addEventListener("keydown", this._documentKeyDown.bind(this), true);
-        this.element.contentDocument.addEventListener("keyup", WebInspector.documentKeyUp.bind(WebInspector), true);
         this.element.contentDocument.addEventListener("webkitAnimationEnd", this._highlightLineEnds.bind(this), false);
 
         // Register 'eval' shortcut.
diff --git a/WebCore/inspector/front-end/TextPrompt.js b/WebCore/inspector/front-end/TextPrompt.js
index 2230eaa..8554a28 100644
--- a/WebCore/inspector/front-end/TextPrompt.js
+++ b/WebCore/inspector/front-end/TextPrompt.js
@@ -33,6 +33,7 @@ WebInspector.TextPrompt = function(element, completions, stopCharacters)
     this.completionStopCharacters = stopCharacters;
     this.history = [];
     this.historyOffset = 0;
+    this.element.addEventListener("keydown", this._onKeyDown.bind(this), true);
 }
 
 WebInspector.TextPrompt.prototype = {
@@ -53,7 +54,7 @@ WebInspector.TextPrompt.prototype = {
         this.moveCaretToEndOfPrompt();
     },
 
-    handleKeyEvent: function(event)
+    _onKeyDown: function(event)
     {
         function defaultAction()
         {
diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css
index 7cae8b2..67f8eb2 100644
--- a/WebCore/inspector/front-end/inspector.css
+++ b/WebCore/inspector/front-end/inspector.css
@@ -1047,7 +1047,7 @@ body.drawer-visible #drawer {
     background-color: rgb(212, 212, 212);
 }
 
-:focus .outline-disclosure li.selected .selection {
+.outline-disclosure ol:focus li.selected .selection {
     background-color: rgb(56, 121, 217);
 }
 
@@ -1075,11 +1075,11 @@ body.drawer-visible #drawer {
     text-indent: -2px
 }
 
-:focus .outline-disclosure li.selected {
+.outline-disclosure ol:focus li.selected {
     color: white;
 }
 
-:focus .outline-disclosure li.selected * {
+.outline-disclosure ol:focus li.selected * {
     color: inherit;
 }
 
@@ -1104,7 +1104,7 @@ body.drawer-visible #drawer {
     content: url(Images/treeRightTriangleBlack.png);
 }
 
-:focus .outline-disclosure li.parent.selected::before {
+.outline-disclosure ol:focus li.parent.selected::before {
     content: url(Images/treeRightTriangleWhite.png);
 }
 
@@ -1112,7 +1112,7 @@ body.drawer-visible #drawer {
     content: url(Images/treeDownTriangleBlack.png);
 }
 
-:focus .outline-disclosure li.parent.expanded.selected::before {
+.outline-disclosure ol:focus li.parent.expanded.selected::before {
     content: url(Images/treeDownTriangleWhite.png);
 }
 
diff --git a/WebCore/inspector/front-end/inspector.html b/WebCore/inspector/front-end/inspector.html
index 77c7760..c2070e2 100644
--- a/WebCore/inspector/front-end/inspector.html
+++ b/WebCore/inspector/front-end/inspector.html
@@ -112,7 +112,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
         <div class="toolbar-item close-right"><button id="close-button-right"></button></div>
     </div>
     <div id="main">
-        <div id="main-panels" tabindex="0" spellcheck="false"></div>
+        <div id="main-panels" spellcheck="false"></div>
         <div id="main-status-bar" class="status-bar"><div id="anchored-status-bar-items"><button id="dock-status-bar-item" class="status-bar-item"><div class="glyph"></div><div class="glyph shadow"></div></button><button id="console-status-bar-item" class="status-bar-item"><div class="glyph"></div><div class="glyph shadow"></div></button><button id="changes-status-bar-item" class="status-bar-item hidden"></button><div id="count-items"><div id="changes-count" class="hidden"></div><div id="error-warning-count" class="hidden"></div></div></div></div>
     </div>
     <div id="drawer">
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index 3f21f4f..20d8c35 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -475,20 +475,11 @@ WebInspector.loaded = function()
     window.addEventListener("resize", this.windowResize.bind(this), true);
 
     document.addEventListener("focus", this.focusChanged.bind(this), true);
-    document.addEventListener("keydown", this.documentKeyDown.bind(this), true);
-    document.addEventListener("keyup", this.documentKeyUp.bind(this), true);
+    document.addEventListener("keydown", this.documentKeyDown.bind(this), false);
     document.addEventListener("beforecopy", this.documentCanCopy.bind(this), true);
     document.addEventListener("copy", this.documentCopy.bind(this), true);
     document.addEventListener("contextmenu", this.contextMenuEventFired.bind(this), true);
 
-    var mainPanelsElement = document.getElementById("main-panels");
-    mainPanelsElement.handleCopyEvent = this.mainCopy.bind(this);
-
-    // Focus the mainPanelsElement in a timeout so it happens after the initial focus,
-    // so it doesn't get reset to the first toolbar button. This initial focus happens
-    // on Mac when the window is made key and the WebHTMLView becomes the first responder.
-    setTimeout(function() { WebInspector.currentFocusElement = mainPanelsElement }, 0);
-
     var dockToggleButton = document.getElementById("dock-status-bar-item");
     dockToggleButton.addEventListener("click", this.toggleAttach.bind(this), false);
 
@@ -509,7 +500,8 @@ WebInspector.loaded = function()
 
     var searchField = document.getElementById("search");
     searchField.addEventListener("search", this.performSearch.bind(this), false); // when the search is emptied
-    searchField.addEventListener("mousedown", this.searchFieldManualFocus.bind(this), false); // when the search field is manually selected
+    searchField.addEventListener("mousedown", this._searchFieldManualFocus.bind(this), false); // when the search field is manually selected
+    searchField.addEventListener("keydown", this._searchKeyDown.bind(this), true);
 
     toolbarElement.addEventListener("mousedown", this.toolbarDragStart, true);
     document.getElementById("close-button-left").addEventListener("click", this.close, true);
@@ -638,131 +630,102 @@ WebInspector.documentClick = function(event)
 
 WebInspector.documentKeyDown = function(event)
 {
-    if (this.currentFocusElement) {
-        if (this.currentFocusElement.handleKeyEvent)
-            this.currentFocusElement.handleKeyEvent(event);
-        else if (this.currentFocusElement.id && this.currentFocusElement.id.length && WebInspector[this.currentFocusElement.id + "KeyDown"])
-            WebInspector[this.currentFocusElement.id + "KeyDown"](event);
-        if (event.handled)
+    if (this.currentPanel && this.currentPanel.handleShortcut) {
+        this.currentPanel.handleShortcut(event);
+        if (event.handled) {
+            event.preventDefault();
             return;
+        }
     }
 
-    if (this.currentPanel && this.currentPanel.handleKeyEvent)
-        this.currentPanel.handleKeyEvent(event);
-
-    if (!event.handled) {
-        var isMac = WebInspector.isMac();
-
-        switch (event.keyIdentifier) {
-            case "U+001B": // Escape key
-                event.preventDefault();
-                if (this.drawer.fullPanel)
-                    return;
+    var isMac = WebInspector.isMac();
 
-                this.drawer.visible = !this.drawer.visible;
-                break;
+    switch (event.keyIdentifier) {
+        case "U+001B": // Escape key
+            event.preventDefault();
+            if (this.drawer.fullPanel)
+                return;
 
-            case "U+0046": // F key
-                if (isMac)
-                    var isFindKey = event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey;
-                else
-                    var isFindKey = event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey;
+            this.drawer.visible = !this.drawer.visible;
+            break;
 
-                if (isFindKey) {
-                    var searchField = document.getElementById("search");
-                    searchField.focus();
-                    searchField.select();
-                    event.preventDefault();
-                }
+        case "U+0046": // F key
+            if (isMac)
+                var isFindKey = event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey;
+            else
+                var isFindKey = event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey;
 
-                break;
+            if (isFindKey) {
+                var searchField = document.getElementById("search");
+                searchField.focus();
+                searchField.select();
+                event.preventDefault();
+            }
 
-            case "U+0047": // G key
-                if (isMac)
-                    var isFindAgainKey = event.metaKey && !event.ctrlKey && !event.altKey;
-                else
-                    var isFindAgainKey = event.ctrlKey && !event.metaKey && !event.altKey;
-
-                if (isFindAgainKey) {
-                    if (event.shiftKey) {
-                        if (this.currentPanel.jumpToPreviousSearchResult)
-                            this.currentPanel.jumpToPreviousSearchResult();
-                    } else if (this.currentPanel.jumpToNextSearchResult)
-                        this.currentPanel.jumpToNextSearchResult();
-                    event.preventDefault();
-                }
+            break;
 
-                break;
+        case "U+0047": // G key
+            if (isMac)
+                var isFindAgainKey = event.metaKey && !event.ctrlKey && !event.altKey;
+            else
+                var isFindAgainKey = event.ctrlKey && !event.metaKey && !event.altKey;
+
+            if (isFindAgainKey) {
+                if (event.shiftKey) {
+                    if (this.currentPanel.jumpToPreviousSearchResult)
+                        this.currentPanel.jumpToPreviousSearchResult();
+                } else if (this.currentPanel.jumpToNextSearchResult)
+                    this.currentPanel.jumpToNextSearchResult();
+                event.preventDefault();
+            }
 
-            // Windows and Mac have two different definitions of [, so accept both.
-            case "U+005B":
-            case "U+00DB": // [ key
-                if (isMac)
-                    var isRotateLeft = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey;
-                else
-                    var isRotateLeft = event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey;
+            break;
 
-                if (isRotateLeft) {
-                    var index = this.panelOrder.indexOf(this.currentPanel);
-                    index = (index === 0) ? this.panelOrder.length - 1 : index - 1;
-                    this.panelOrder[index].toolbarItem.click();
-                    event.preventDefault();
-                }
+        // Windows and Mac have two different definitions of [, so accept both.
+        case "U+005B":
+        case "U+00DB": // [ key
+            if (isMac)
+                var isRotateLeft = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey;
+            else
+                var isRotateLeft = event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey;
 
-                break;
+            if (isRotateLeft) {
+                var index = this.panelOrder.indexOf(this.currentPanel);
+                index = (index === 0) ? this.panelOrder.length - 1 : index - 1;
+                this.panelOrder[index].toolbarItem.click();
+                event.preventDefault();
+            }
 
-            // Windows and Mac have two different definitions of ], so accept both.
-            case "U+005D":
-            case "U+00DD":  // ] key
-                if (isMac)
-                    var isRotateRight = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey;
-                else
-                    var isRotateRight = event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey;
+            break;
 
-                if (isRotateRight) {
-                    var index = this.panelOrder.indexOf(this.currentPanel);
-                    index = (index + 1) % this.panelOrder.length;
-                    this.panelOrder[index].toolbarItem.click();
-                    event.preventDefault();
-                }
+        // Windows and Mac have two different definitions of ], so accept both.
+        case "U+005D":
+        case "U+00DD":  // ] key
+            if (isMac)
+                var isRotateRight = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey;
+            else
+                var isRotateRight = event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey;
 
-                break;
-        }
-    }
-}
+            if (isRotateRight) {
+                var index = this.panelOrder.indexOf(this.currentPanel);
+                index = (index + 1) % this.panelOrder.length;
+                this.panelOrder[index].toolbarItem.click();
+                event.preventDefault();
+            }
 
-WebInspector.documentKeyUp = function(event)
-{
-    if (this.currentFocusElement) {
-        if (this.currentFocusElement.handleKeyUpEvent)
-            this.currentFocusElement.handleKeyUpEvent(event);
-        if (event.handled)
-            return;
+            break;
     }
-
-    if (this.currentPanel && this.currentPanel.handleKeyUpEvent)
-        this.currentPanel.handleKeyUpEvent(event);
 }
 
 WebInspector.documentCanCopy = function(event)
 {
-    if (!this.currentFocusElement)
-        return;
-    // Calling preventDefault() will say "we support copying, so enable the Copy menu".
-    if (this.currentFocusElement.handleCopyEvent)
-        event.preventDefault();
-    else if (this.currentFocusElement.id && this.currentFocusElement.id.length && WebInspector[this.currentFocusElement.id + "Copy"])
-        event.preventDefault();
+    return this.currentPanel && this.currentPanel.handleCopyEvent;
 }
 
 WebInspector.documentCopy = function(event)
 {
-    if (!this.currentFocusElement)
-        return;
-    if (this.currentFocusElement.handleCopyEvent)
-        this.currentFocusElement.handleCopyEvent(event);
-    else if (this.currentFocusElement.id && this.currentFocusElement.id.length && WebInspector[this.currentFocusElement.id + "Copy"])
-        WebInspector[this.currentFocusElement.id + "Copy"](event);
+    if (this.currentPanel && this.currentPanel.handleCopyEvent)
+        this.currentPanel.handleCopyEvent(event);
 }
 
 WebInspector.contextMenuEventFired = function(event)
@@ -771,12 +734,6 @@ WebInspector.contextMenuEventFired = function(event)
         event.preventDefault();
 }
 
-WebInspector.mainCopy = function(event)
-{
-    if (this.currentPanel && this.currentPanel.handleCopyEvent)
-        this.currentPanel.handleCopyEvent(event);
-}
-
 WebInspector.animateStyle = function(animations, duration, callback)
 {
     var interval;
@@ -1536,20 +1493,23 @@ WebInspector.addMainEventListeners = function(doc)
     doc.addEventListener("click", this.documentClick.bind(this), true);
 }
 
-WebInspector.searchFieldManualFocus = function(event)
+WebInspector._searchFieldManualFocus = function(event)
 {
     this.currentFocusElement = event.target;
     this._previousFocusElement = event.target;
 }
 
-WebInspector.searchKeyDown = function(event)
+WebInspector._searchKeyDown = function(event)
 {
     // Escape Key will clear the field and clear the search results
     if (event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Esc) {
+        // If focus belongs here and text is empty - nothing to do, return unhandled.
+        if (event.target.value === "" && this.currentFocusElement === this.previousFocusElement)
+            return;
         event.preventDefault();
+        event.stopPropagation();
         // When search was selected manually and is currently blank, we'd like Esc stay unhandled
         // and hit console drawer handler.
-        event.handled = !(this.previousFocusElement === event.target && event.target.value === "");
         event.target.value = "";
 
         this.performSearch(event);
@@ -1557,10 +1517,6 @@ WebInspector.searchKeyDown = function(event)
         if (this.currentFocusElement === event.target)
             this.currentFocusElement.select();
         return false;
-    } else if (event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Backspace ||
-               event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Delete) {
-        event.handled = true;
-        return false;
     }
 
     if (!isEnterKey(event))
@@ -1704,7 +1660,6 @@ WebInspector.startEditing = function(element, committedCallback, cancelledCallba
     element.__editing = true;
 
     var oldText = getContent(element);
-    var oldHandleKeyEvent = element.handleKeyEvent;
     var moveDirection = "";
 
     element.addStyleClass("editing");
@@ -1732,8 +1687,8 @@ WebInspector.startEditing = function(element, committedCallback, cancelledCallba
         this.scrollTop = 0;
         this.scrollLeft = 0;
 
-        this.handleKeyEvent = oldHandleKeyEvent;
         element.removeEventListener("blur", blurEventListener, false);
+        element.removeEventListener("keydown", keyDownEventListener, true);
 
         if (element === WebInspector.currentFocusElement || element.isAncestor(WebInspector.currentFocusElement))
             WebInspector.currentFocusElement = WebInspector.previousFocusElement;
@@ -1758,26 +1713,21 @@ WebInspector.startEditing = function(element, committedCallback, cancelledCallba
             committedCallback(this, getContent(this), oldText, context, moveDirection);
     }
 
-    element.handleKeyEvent = function(event) {
-        if (oldHandleKeyEvent)
-            oldHandleKeyEvent(event);
-        if (event.handled)
-            return;
-
+    function keyDownEventListener(event) {
         if (isEnterKey(event)) {
             editingCommitted.call(element);
             event.preventDefault();
             event.stopPropagation();
-            event.handled = true;
-        } else if (event.keyCode === 27) { // Escape key
+        } else if (event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Esc) {
             editingCancelled.call(element);
             event.preventDefault();
-            event.handled = true;
+            event.stopPropagation();
         } else if (event.keyIdentifier === "U+0009") // Tab key
             moveDirection = (event.shiftKey ? "backward" : "forward");
     }
 
     element.addEventListener("blur", blurEventListener, false);
+    element.addEventListener("keydown", keyDownEventListener, true);
 
     WebInspector.currentFocusElement = element;
 }
diff --git a/WebCore/inspector/front-end/treeoutline.js b/WebCore/inspector/front-end/treeoutline.js
index 2cde151..f343c7c 100644
--- a/WebCore/inspector/front-end/treeoutline.js
+++ b/WebCore/inspector/front-end/treeoutline.js
@@ -40,6 +40,9 @@ function TreeOutline(listNode)
     this.expanded = true;
     this.selected = false;
     this.treeOutline = this;
+
+    this._childrenListNode.tabIndex = 0;
+    this._childrenListNode.addEventListener("keydown", this._treeKeyDown.bind(this), true);
 }
 
 TreeOutline._knownTreeElementNextIdentifier = 1;
@@ -141,7 +144,15 @@ TreeOutline._removeChildAtIndex = function(childIndex)
     var child = this.children[childIndex];
     this.children.splice(childIndex, 1);
 
-    child.deselect();
+    var parent = child.parent;
+    if (child.deselect()) {
+        if (child.previousSibling)
+            child.previousSibling.select();
+        else if (child.nextSibling)
+            child.nextSibling.select();
+        else
+            parent.select();
+    }
 
     if (child.previousSibling)
         child.previousSibling.nextSibling = child.nextSibling;
@@ -327,10 +338,13 @@ TreeOutline.prototype.treeElementFromPoint = function(x, y)
     return null;
 }
 
-TreeOutline.prototype.handleKeyEvent = function(event)
+TreeOutline.prototype._treeKeyDown = function(event)
 {
+    if (event.target !== this._childrenListNode)
+        return;
+
     if (!this.selectedTreeElement || event.shiftKey || event.metaKey || event.ctrlKey)
-        return false;
+        return;
 
     var handled = false;
     var nextSelectedElement;
@@ -386,8 +400,6 @@ TreeOutline.prototype.handleKeyEvent = function(event)
         event.preventDefault();
         event.stopPropagation();
     }
-
-    return handled;
 }
 
 TreeOutline.prototype.expand = function()
@@ -775,7 +787,7 @@ TreeElement.prototype.select = function(supressOnSelect)
 TreeElement.prototype.deselect = function(supressOnDeselect)
 {
     if (!this.treeOutline || this.treeOutline.selectedTreeElement !== this || !this.selected)
-        return;
+        return false;
 
     this.selected = false;
     this.treeOutline.selectedTreeElement = null;
@@ -784,6 +796,7 @@ TreeElement.prototype.deselect = function(supressOnDeselect)
 
     if (this.ondeselect && !supressOnDeselect)
         this.ondeselect(this);
+    return true;
 }
 
 TreeElement.prototype.traverseNextTreeElement = function(skipHidden, stayWithin, dontPopulate, info)
diff --git a/WebCore/inspector/front-end/utilities.js b/WebCore/inspector/front-end/utilities.js
index 04c9032..7a3352c 100644
--- a/WebCore/inspector/front-end/utilities.js
+++ b/WebCore/inspector/front-end/utilities.js
@@ -833,7 +833,3 @@ function isEnterKey(event) {
     // Check if in IME.
     return event.keyCode !== 229 && event.keyIdentifier === "Enter";
 }
-
-function isFnKey(event) {
-    return event.keyCode >= 112 && event.keyCode <= 123;
-}

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list