Changeset 52099 in webkit
- Timestamp:
- Dec 14, 2009 10:01:08 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r52096 r52099 1 2009-12-14 Pavel Feldman <pfeldman@chromium.org> 2 3 Reviewed by Timothy Hatcher. 4 5 Web Inspector: [regression] inspector deletes nodes when editing css. 6 7 Now all the treeoutlines are focusable, sections and their titles 8 are also focusable. Change contains couple of drive-by fixes such as 9 canceling of the attribute edit nuking attr info and maintaining proper 10 selection while deleting nodes. 11 12 https://bugs.webkit.org/show_bug.cgi?id=32460 13 14 * inspector/front-end/CallStackSidebarPane.js: 15 (WebInspector.CallStackSidebarPane.prototype.handleShortcut): 16 * inspector/front-end/ConsoleView.js: 17 (WebInspector.ConsoleView.prototype._promptKeyDown): 18 * inspector/front-end/DataGrid.js: 19 (WebInspector.DataGrid.prototype._keyDown): 20 * inspector/front-end/DatabaseQueryView.js: 21 (WebInspector.DatabaseQueryView): 22 (WebInspector.DatabaseQueryView.prototype._promptKeyDown): 23 * inspector/front-end/ElementsPanel.js: 24 (WebInspector.ElementsPanel.this.treeOutline.focusedNodeChanged): 25 (WebInspector.ElementsPanel.prototype.get defaultFocusedElement): 26 (WebInspector.ElementsPanel.prototype.handleShortcut): 27 * inspector/front-end/ElementsTreeOutline.js: 28 (WebInspector.ElementsTreeOutline): 29 (WebInspector.ElementsTreeOutline.prototype._keyDown): 30 (WebInspector.ElementsTreeElement.prototype._textNodeEditingCommitted): 31 (WebInspector.ElementsTreeElement.prototype._editingCancelled): 32 * inspector/front-end/Panel.js: 33 (WebInspector.Panel.prototype.show): 34 (WebInspector.Panel.prototype.get defaultFocusedElement): 35 * inspector/front-end/PropertiesSection.js: 36 (WebInspector.PropertiesSection): 37 * inspector/front-end/ScriptsPanel.js: 38 (WebInspector.ScriptsPanel): 39 (WebInspector.ScriptsPanel.prototype.get defaultFocusedElement): 40 (WebInspector.ScriptsPanel.prototype.handleShortcut): 41 * inspector/front-end/SidebarPane.js: 42 (WebInspector.SidebarPane): 43 (WebInspector.SidebarPane.prototype.toggleExpanded): 44 (WebInspector.SidebarPane.prototype._onTitleKeyDown): 45 * inspector/front-end/SourceFrame.js: 46 (WebInspector.SourceFrame.prototype._loaded): 47 * inspector/front-end/TextPrompt.js: 48 (WebInspector.TextPrompt): 49 * inspector/front-end/inspector.css: 50 * inspector/front-end/inspector.html: 51 * inspector/front-end/inspector.js: 52 (WebInspector.loaded): 53 (WebInspector.documentKeyDown): 54 (WebInspector.documentCanCopy): 55 (WebInspector.documentCopy): 56 (WebInspector._searchFieldManualFocus): 57 (WebInspector._searchKeyDown): 58 (WebInspector.startEditing.cleanUpAfterEditing): 59 (WebInspector.startEditing.keyDownEventListener): 60 (WebInspector.startEditing): 61 * inspector/front-end/treeoutline.js: 62 (TreeOutline): 63 (TreeOutline._removeChildAtIndex): 64 (TreeOutline.prototype._treeKeyDown): 65 (TreeElement.prototype.deselect): 66 * inspector/front-end/utilities.js: 67 (): 68 1 69 2009-12-14 Dimitri Glazkov <dglazkov@chromium.org> 2 70 -
trunk/WebCore/inspector/front-end/CallStackSidebarPane.js
r47703 r52099 110 110 }, 111 111 112 handle KeyEvent: function(event)112 handleShortcut: function(event) 113 113 { 114 114 var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event); … … 116 116 if (handler) { 117 117 handler(event); 118 event.preventDefault();119 118 event.handled = true; 120 119 } -
trunk/WebCore/inspector/front-end/ConsoleView.js
r51528 r52099 46 46 47 47 this.promptElement = document.getElementById("console-prompt"); 48 this.promptElement. handleKeyEvent = this._promptKeyDown.bind(this);48 this.promptElement.addEventListener("keydown", this._promptKeyDown.bind(this), true); 49 49 this.prompt = new WebInspector.TextPrompt(this.promptElement, this.completions.bind(this), ExpressionStopCharacters + "."); 50 50 … … 408 408 } 409 409 410 if (isFnKey(event)) {411 if (WebInspector.currentPanel && WebInspector.currentPanel.handleKeyEvent) {412 WebInspector.currentPanel.handleKeyEvent(event);413 return;414 }415 }416 417 410 var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event); 418 411 var handler = this._shortcuts[shortcut]; … … 424 417 } 425 418 } 426 427 this.prompt.handleKeyEvent(event);428 419 }, 429 420 -
trunk/WebCore/inspector/front-end/DataGrid.js
r51139 r52099 470 470 }, 471 471 472 handleKeyEvent: function(event) 472 473 _keyDown: function(event) 473 474 { 474 475 if (!this.selectedNode || event.shiftKey || event.metaKey || event.ctrlKey || this._editing) 475 return false;476 return; 476 477 477 478 var handled = false; … … 541 542 event.stopPropagation(); 542 543 } 543 544 return handled;545 544 }, 546 545 … … 571 570 var rowElement = node.enclosingNodeOrSelfWithNodeName("tr"); 572 571 return rowElement._dataGridNode; 573 },574 575 _keyDown: function(event)576 {577 this.handleKeyEvent(event);578 572 }, 579 573 -
trunk/WebCore/inspector/front-end/DatabaseQueryView.js
r50039 r52099 39 39 this.promptElement.className = "database-query-prompt"; 40 40 this.promptElement.appendChild(document.createElement("br")); 41 this.promptElement. handleKeyEvent = this._promptKeyDown.bind(this);41 this.promptElement.addEventListener("keydown", this._promptKeyDown.bind(this), true); 42 42 this.element.appendChild(this.promptElement); 43 43 … … 99 99 return; 100 100 } 101 102 this.prompt.handleKeyEvent(event);103 101 }, 104 102 -
trunk/WebCore/inspector/front-end/ElementsPanel.js
r51710 r52099 47 47 { 48 48 if (this.panel.visible && WebInspector.currentFocusElement !== document.getElementById("search")) 49 WebInspector.currentFocusElement = document.getElementById("main-panels");49 WebInspector.currentFocusElement = this.element; 50 50 51 51 this.panel.updateBreadcrumb(forceUpdate); … … 128 128 { 129 129 return [this.nodeSearchButton.element, this.crumbsElement]; 130 }, 131 132 get defaultFocusedElement() 133 { 134 return this.treeOutline.element; 130 135 }, 131 136 … … 1025 1030 }, 1026 1031 1027 handle KeyEvent: function(event)1032 handleShortcut: function(event) 1028 1033 { 1029 1034 // Cmd/Control + Shift + C should be a shortcut to clicking the Node Search Button. … … 1037 1042 if (isNodeSearchKey) { 1038 1043 this._nodeSearchButtonClicked(event); 1039 event. preventDefault();1044 event.handled = true; 1040 1045 return; 1041 1046 } 1042 1047 } 1043 1044 this.treeOutline.handleKeyEvent(event);1045 1048 }, 1046 1049 -
trunk/WebCore/inspector/front-end/ElementsTreeOutline.js
r51961 r52099 44 44 45 45 this.element.addEventListener("contextmenu", this._contextMenuEventFired.bind(this), true); 46 this.element.addEventListener("keydown", this._keyDown.bind(this), true); 46 47 } 47 48 … … 192 193 }, 193 194 194 handleKeyEvent: function(event) 195 { 195 _keyDown: function(event) 196 { 197 if (event.target !== this.treeOutline.element) 198 return; 199 196 200 var selectedElement = this.selectedTreeElement; 197 201 if (!selectedElement) … … 202 206 selectedElement.remove(); 203 207 event.preventDefault(); 208 event.stopPropagation(); 204 209 return; 205 210 } … … 207 212 // On Enter or Return start editing the first attribute 208 213 // or create a new attribute on the selected element. 209 if ( event.keyIdentifier === "Enter") {214 if (isEnterKey(event)) { 210 215 if (this._editing) 211 216 return; … … 215 220 // prevent a newline from being immediately inserted 216 221 event.preventDefault(); 217 return; 218 } 219 220 TreeOutline.prototype.handleKeyEvent.call(this, event); 222 event.stopPropagation(); 223 return; 224 } 221 225 }, 222 226 … … 830 834 textNode.nodeValue = newText; 831 835 832 // No need to call _updateTitle here, it will be called after the nodeValue is committed. 836 // Need to restore attributes / node structure. 837 this._updateTitle(); 833 838 }, 834 839 … … 837 842 delete this._editing; 838 843 839 // No need to call _updateTitle here, the editing code will revert to the original text. 844 // Need to restore attributes structure. 845 this._updateTitle(); 840 846 }, 841 847 -
trunk/WebCore/inspector/front-end/Panel.js
r50635 r52099 82 82 this._toolbarItem.addStyleClass("toggled-on"); 83 83 84 WebInspector.currentFocusElement = document.getElementById("main-panels");84 WebInspector.currentFocusElement = this.defaultFocusedElement; 85 85 86 86 this.updateSidebarWidth(); … … 96 96 if ("_toolbarItem" in this) 97 97 this._toolbarItem.removeStyleClass("toggled-on"); 98 }, 99 100 get defaultFocusedElement() 101 { 102 return this.sidebarTreeElement || this.element; 98 103 }, 99 104 … … 275 280 }, 276 281 277 handleKeyEvent: function(event)278 {279 this.handleSidebarKeyEvent(event);280 },281 282 handleSidebarKeyEvent: function(event)283 {284 if (this.hasSidebar && this.sidebarTree)285 this.sidebarTree.handleKeyEvent(event);286 },287 288 282 createSidebar: function(parentElement, resizerParentElement) 289 283 { -
trunk/WebCore/inspector/front-end/PropertiesSection.js
r39537 r52099 48 48 this.propertiesElement = document.createElement("ol"); 49 49 this.propertiesElement.className = "properties"; 50 this.propertiesElement.tabIndex = 0; 50 51 this.propertiesTreeOutline = new TreeOutline(this.propertiesElement); 51 52 this.propertiesTreeOutline.section = this; -
trunk/WebCore/inspector/front-end/ScriptsPanel.js
r51528 r52099 57 57 this.filesSelectElement.id = "scripts-files"; 58 58 this.filesSelectElement.addEventListener("change", this._changeVisibleFile.bind(this), false); 59 this.filesSelectElement.handleKeyEvent = this.handleKeyEvent.bind(this);60 59 this.topStatusBar.appendChild(this.filesSelectElement); 61 60 … … 207 206 { 208 207 return [this.enableToggleButton.element, this.pauseOnExceptionButton.element]; 208 }, 209 210 get defaultFocusedElement() 211 { 212 return this.filesSelectElement; 209 213 }, 210 214 … … 516 520 }, 517 521 518 handle KeyEvent: function(event)522 handleShortcut: function(event) 519 523 { 520 524 var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event); … … 522 526 if (handler) { 523 527 handler(event); 524 event.preventDefault();525 528 event.handled = true; 526 } else { 527 this.sidebarPanes.callstack.handleKeyEvent(event); 528 } 529 } else 530 this.sidebarPanes.callstack.handleShortcut(event); 529 531 }, 530 532 -
trunk/WebCore/inspector/front-end/SidebarPane.js
r37289 r52099 34 34 this.titleElement = document.createElement("div"); 35 35 this.titleElement.className = "title"; 36 this.titleElement.tabIndex = 0; 36 37 this.titleElement.addEventListener("click", this.toggleExpanded.bind(this), false); 38 this.titleElement.addEventListener("keydown", this._onTitleKeyDown.bind(this), false); 37 39 38 40 this.bodyElement = document.createElement("div"); … … 120 122 { 121 123 this.expanded = !this.expanded; 124 }, 125 126 _onTitleKeyDown: function(event) 127 { 128 if (isEnterKey(event) || event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Space) 129 this.toggleExpanded(); 122 130 } 123 131 } -
trunk/WebCore/inspector/front-end/SourceFrame.js
r51250 r52099 204 204 this.element.contentDocument.addEventListener("mousedown", this._documentMouseDown.bind(this), true); 205 205 this.element.contentDocument.addEventListener("keydown", this._documentKeyDown.bind(this), true); 206 this.element.contentDocument.addEventListener("keyup", WebInspector.documentKeyUp.bind(WebInspector), true);207 206 this.element.contentDocument.addEventListener("webkitAnimationEnd", this._highlightLineEnds.bind(this), false); 208 207 -
trunk/WebCore/inspector/front-end/TextPrompt.js
r51291 r52099 34 34 this.history = []; 35 35 this.historyOffset = 0; 36 this.element.addEventListener("keydown", this._onKeyDown.bind(this), true); 36 37 } 37 38 … … 54 55 }, 55 56 56 handleKeyEvent: function(event)57 _onKeyDown: function(event) 57 58 { 58 59 function defaultAction() -
trunk/WebCore/inspector/front-end/inspector.css
r51952 r52099 1048 1048 } 1049 1049 1050 :focus .outline-disclosureli.selected .selection {1050 .outline-disclosure ol:focus li.selected .selection { 1051 1051 background-color: rgb(56, 121, 217); 1052 1052 } … … 1076 1076 } 1077 1077 1078 :focus .outline-disclosureli.selected {1078 .outline-disclosure ol:focus li.selected { 1079 1079 color: white; 1080 1080 } 1081 1081 1082 :focus .outline-disclosureli.selected * {1082 .outline-disclosure ol:focus li.selected * { 1083 1083 color: inherit; 1084 1084 } … … 1105 1105 } 1106 1106 1107 :focus .outline-disclosureli.parent.selected::before {1107 .outline-disclosure ol:focus li.parent.selected::before { 1108 1108 content: url(Images/treeRightTriangleWhite.png); 1109 1109 } … … 1113 1113 } 1114 1114 1115 :focus .outline-disclosureli.parent.expanded.selected::before {1115 .outline-disclosure ol:focus li.parent.expanded.selected::before { 1116 1116 content: url(Images/treeDownTriangleWhite.png); 1117 1117 } -
trunk/WebCore/inspector/front-end/inspector.html
r51839 r52099 113 113 </div> 114 114 <div id="main"> 115 <div id="main-panels" tabindex="0"spellcheck="false"></div>115 <div id="main-panels" spellcheck="false"></div> 116 116 <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> 117 117 </div> -
trunk/WebCore/inspector/front-end/inspector.js
r51961 r52099 476 476 477 477 document.addEventListener("focus", this.focusChanged.bind(this), true); 478 document.addEventListener("keydown", this.documentKeyDown.bind(this), true); 479 document.addEventListener("keyup", this.documentKeyUp.bind(this), true); 478 document.addEventListener("keydown", this.documentKeyDown.bind(this), false); 480 479 document.addEventListener("beforecopy", this.documentCanCopy.bind(this), true); 481 480 document.addEventListener("copy", this.documentCopy.bind(this), true); 482 481 document.addEventListener("contextmenu", this.contextMenuEventFired.bind(this), true); 483 484 var mainPanelsElement = document.getElementById("main-panels");485 mainPanelsElement.handleCopyEvent = this.mainCopy.bind(this);486 487 // Focus the mainPanelsElement in a timeout so it happens after the initial focus,488 // so it doesn't get reset to the first toolbar button. This initial focus happens489 // on Mac when the window is made key and the WebHTMLView becomes the first responder.490 setTimeout(function() { WebInspector.currentFocusElement = mainPanelsElement }, 0);491 482 492 483 var dockToggleButton = document.getElementById("dock-status-bar-item"); … … 510 501 var searchField = document.getElementById("search"); 511 502 searchField.addEventListener("search", this.performSearch.bind(this), false); // when the search is emptied 512 searchField.addEventListener("mousedown", this.searchFieldManualFocus.bind(this), false); // when the search field is manually selected 503 searchField.addEventListener("mousedown", this._searchFieldManualFocus.bind(this), false); // when the search field is manually selected 504 searchField.addEventListener("keydown", this._searchKeyDown.bind(this), true); 513 505 514 506 toolbarElement.addEventListener("mousedown", this.toolbarDragStart, true); … … 639 631 WebInspector.documentKeyDown = function(event) 640 632 { 641 if (this.currentFocusElement) { 642 if (this.currentFocusElement.handleKeyEvent) 643 this.currentFocusElement.handleKeyEvent(event); 644 else if (this.currentFocusElement.id && this.currentFocusElement.id.length && WebInspector[this.currentFocusElement.id + "KeyDown"]) 645 WebInspector[this.currentFocusElement.id + "KeyDown"](event); 646 if (event.handled) 633 if (this.currentPanel && this.currentPanel.handleShortcut) { 634 this.currentPanel.handleShortcut(event); 635 if (event.handled) { 636 event.preventDefault(); 647 637 return; 648 } 649 650 if (this.currentPanel && this.currentPanel.handleKeyEvent) 651 this.currentPanel.handleKeyEvent(event); 652 653 if (!event.handled) { 654 var isMac = WebInspector.isMac(); 655 656 switch (event.keyIdentifier) { 657 case "U+001B": // Escape key 638 } 639 } 640 641 var isMac = WebInspector.isMac(); 642 643 switch (event.keyIdentifier) { 644 case "U+001B": // Escape key 645 event.preventDefault(); 646 if (this.drawer.fullPanel) 647 return; 648 649 this.drawer.visible = !this.drawer.visible; 650 break; 651 652 case "U+0046": // F key 653 if (isMac) 654 var isFindKey = event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey; 655 else 656 var isFindKey = event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey; 657 658 if (isFindKey) { 659 var searchField = document.getElementById("search"); 660 searchField.focus(); 661 searchField.select(); 658 662 event.preventDefault(); 659 if (this.drawer.fullPanel) 660 return; 661 662 this.drawer.visible = !this.drawer.visible; 663 break; 664 665 case "U+0046": // F key 666 if (isMac) 667 var isFindKey = event.metaKey && !event.ctrlKey && !event.altKey && !event.shiftKey; 668 else 669 var isFindKey = event.ctrlKey && !event.metaKey && !event.altKey && !event.shiftKey; 670 671 if (isFindKey) { 672 var searchField = document.getElementById("search"); 673 searchField.focus(); 674 searchField.select(); 675 event.preventDefault(); 676 } 677 678 break; 679 680 case "U+0047": // G key 681 if (isMac) 682 var isFindAgainKey = event.metaKey && !event.ctrlKey && !event.altKey; 683 else 684 var isFindAgainKey = event.ctrlKey && !event.metaKey && !event.altKey; 685 686 if (isFindAgainKey) { 687 if (event.shiftKey) { 688 if (this.currentPanel.jumpToPreviousSearchResult) 689 this.currentPanel.jumpToPreviousSearchResult(); 690 } else if (this.currentPanel.jumpToNextSearchResult) 691 this.currentPanel.jumpToNextSearchResult(); 692 event.preventDefault(); 693 } 694 695 break; 696 697 // Windows and Mac have two different definitions of [, so accept both. 698 case "U+005B": 699 case "U+00DB": // [ key 700 if (isMac) 701 var isRotateLeft = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey; 702 else 703 var isRotateLeft = event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey; 704 705 if (isRotateLeft) { 706 var index = this.panelOrder.indexOf(this.currentPanel); 707 index = (index === 0) ? this.panelOrder.length - 1 : index - 1; 708 this.panelOrder[index].toolbarItem.click(); 709 event.preventDefault(); 710 } 711 712 break; 713 714 // Windows and Mac have two different definitions of ], so accept both. 715 case "U+005D": 716 case "U+00DD": // ] key 717 if (isMac) 718 var isRotateRight = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey; 719 else 720 var isRotateRight = event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey; 721 722 if (isRotateRight) { 723 var index = this.panelOrder.indexOf(this.currentPanel); 724 index = (index + 1) % this.panelOrder.length; 725 this.panelOrder[index].toolbarItem.click(); 726 event.preventDefault(); 727 } 728 729 break; 730 } 731 } 732 } 733 734 WebInspector.documentKeyUp = function(event) 735 { 736 if (this.currentFocusElement) { 737 if (this.currentFocusElement.handleKeyUpEvent) 738 this.currentFocusElement.handleKeyUpEvent(event); 739 if (event.handled) 740 return; 741 } 742 743 if (this.currentPanel && this.currentPanel.handleKeyUpEvent) 744 this.currentPanel.handleKeyUpEvent(event); 663 } 664 665 break; 666 667 case "U+0047": // G key 668 if (isMac) 669 var isFindAgainKey = event.metaKey && !event.ctrlKey && !event.altKey; 670 else 671 var isFindAgainKey = event.ctrlKey && !event.metaKey && !event.altKey; 672 673 if (isFindAgainKey) { 674 if (event.shiftKey) { 675 if (this.currentPanel.jumpToPreviousSearchResult) 676 this.currentPanel.jumpToPreviousSearchResult(); 677 } else if (this.currentPanel.jumpToNextSearchResult) 678 this.currentPanel.jumpToNextSearchResult(); 679 event.preventDefault(); 680 } 681 682 break; 683 684 // Windows and Mac have two different definitions of [, so accept both. 685 case "U+005B": 686 case "U+00DB": // [ key 687 if (isMac) 688 var isRotateLeft = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey; 689 else 690 var isRotateLeft = event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey; 691 692 if (isRotateLeft) { 693 var index = this.panelOrder.indexOf(this.currentPanel); 694 index = (index === 0) ? this.panelOrder.length - 1 : index - 1; 695 this.panelOrder[index].toolbarItem.click(); 696 event.preventDefault(); 697 } 698 699 break; 700 701 // Windows and Mac have two different definitions of ], so accept both. 702 case "U+005D": 703 case "U+00DD": // ] key 704 if (isMac) 705 var isRotateRight = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey; 706 else 707 var isRotateRight = event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey; 708 709 if (isRotateRight) { 710 var index = this.panelOrder.indexOf(this.currentPanel); 711 index = (index + 1) % this.panelOrder.length; 712 this.panelOrder[index].toolbarItem.click(); 713 event.preventDefault(); 714 } 715 716 break; 717 } 745 718 } 746 719 747 720 WebInspector.documentCanCopy = function(event) 748 721 { 749 if (!this.currentFocusElement) 750 return; 751 // Calling preventDefault() will say "we support copying, so enable the Copy menu". 752 if (this.currentFocusElement.handleCopyEvent) 753 event.preventDefault(); 754 else if (this.currentFocusElement.id && this.currentFocusElement.id.length && WebInspector[this.currentFocusElement.id + "Copy"]) 755 event.preventDefault(); 722 return this.currentPanel && this.currentPanel.handleCopyEvent; 756 723 } 757 724 758 725 WebInspector.documentCopy = function(event) 759 726 { 760 if (!this.currentFocusElement) 761 return; 762 if (this.currentFocusElement.handleCopyEvent) 763 this.currentFocusElement.handleCopyEvent(event); 764 else if (this.currentFocusElement.id && this.currentFocusElement.id.length && WebInspector[this.currentFocusElement.id + "Copy"]) 765 WebInspector[this.currentFocusElement.id + "Copy"](event); 727 if (this.currentPanel && this.currentPanel.handleCopyEvent) 728 this.currentPanel.handleCopyEvent(event); 766 729 } 767 730 … … 770 733 if (event.handled || event.target.hasStyleClass("popup-glasspane")) 771 734 event.preventDefault(); 772 }773 774 WebInspector.mainCopy = function(event)775 {776 if (this.currentPanel && this.currentPanel.handleCopyEvent)777 this.currentPanel.handleCopyEvent(event);778 735 } 779 736 … … 1537 1494 } 1538 1495 1539 WebInspector. searchFieldManualFocus = function(event)1496 WebInspector._searchFieldManualFocus = function(event) 1540 1497 { 1541 1498 this.currentFocusElement = event.target; … … 1543 1500 } 1544 1501 1545 WebInspector. searchKeyDown = function(event)1502 WebInspector._searchKeyDown = function(event) 1546 1503 { 1547 1504 // Escape Key will clear the field and clear the search results 1548 1505 if (event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Esc) { 1506 // If focus belongs here and text is empty - nothing to do, return unhandled. 1507 if (event.target.value === "" && this.currentFocusElement === this.previousFocusElement) 1508 return; 1549 1509 event.preventDefault(); 1510 event.stopPropagation(); 1550 1511 // When search was selected manually and is currently blank, we'd like Esc stay unhandled 1551 1512 // and hit console drawer handler. 1552 event.handled = !(this.previousFocusElement === event.target && event.target.value === "");1553 1513 event.target.value = ""; 1554 1514 … … 1557 1517 if (this.currentFocusElement === event.target) 1558 1518 this.currentFocusElement.select(); 1559 return false;1560 } else if (event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Backspace ||1561 event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Delete) {1562 event.handled = true;1563 1519 return false; 1564 1520 } … … 1705 1661 1706 1662 var oldText = getContent(element); 1707 var oldHandleKeyEvent = element.handleKeyEvent;1708 1663 var moveDirection = ""; 1709 1664 … … 1733 1688 this.scrollLeft = 0; 1734 1689 1735 this.handleKeyEvent = oldHandleKeyEvent;1736 1690 element.removeEventListener("blur", blurEventListener, false); 1691 element.removeEventListener("keydown", keyDownEventListener, true); 1737 1692 1738 1693 if (element === WebInspector.currentFocusElement || element.isAncestor(WebInspector.currentFocusElement)) … … 1759 1714 } 1760 1715 1761 element.handleKeyEvent = function(event) { 1762 if (oldHandleKeyEvent) 1763 oldHandleKeyEvent(event); 1764 if (event.handled) 1765 return; 1766 1716 function keyDownEventListener(event) { 1767 1717 if (isEnterKey(event)) { 1768 1718 editingCommitted.call(element); 1769 1719 event.preventDefault(); 1770 1720 event.stopPropagation(); 1771 event.handled = true; 1772 } else if (event.keyCode === 27) { // Escape key 1721 } else if (event.keyCode === WebInspector.KeyboardShortcut.KeyCodes.Esc) { 1773 1722 editingCancelled.call(element); 1774 1723 event.preventDefault(); 1775 event. handled = true;1724 event.stopPropagation(); 1776 1725 } else if (event.keyIdentifier === "U+0009") // Tab key 1777 1726 moveDirection = (event.shiftKey ? "backward" : "forward"); … … 1779 1728 1780 1729 element.addEventListener("blur", blurEventListener, false); 1730 element.addEventListener("keydown", keyDownEventListener, true); 1781 1731 1782 1732 WebInspector.currentFocusElement = element; -
trunk/WebCore/inspector/front-end/treeoutline.js
r51946 r52099 41 41 this.selected = false; 42 42 this.treeOutline = this; 43 44 this._childrenListNode.tabIndex = 0; 45 this._childrenListNode.addEventListener("keydown", this._treeKeyDown.bind(this), true); 43 46 } 44 47 … … 142 145 this.children.splice(childIndex, 1); 143 146 144 child.deselect(); 147 var parent = child.parent; 148 if (child.deselect()) { 149 if (child.previousSibling) 150 child.previousSibling.select(); 151 else if (child.nextSibling) 152 child.nextSibling.select(); 153 else 154 parent.select(); 155 } 145 156 146 157 if (child.previousSibling) … … 328 339 } 329 340 330 TreeOutline.prototype.handleKeyEvent = function(event) 331 { 341 TreeOutline.prototype._treeKeyDown = function(event) 342 { 343 if (event.target !== this._childrenListNode) 344 return; 345 332 346 if (!this.selectedTreeElement || event.shiftKey || event.metaKey || event.ctrlKey) 333 return false;347 return; 334 348 335 349 var handled = false; … … 387 401 event.stopPropagation(); 388 402 } 389 390 return handled;391 403 } 392 404 … … 776 788 { 777 789 if (!this.treeOutline || this.treeOutline.selectedTreeElement !== this || !this.selected) 778 return ;790 return false; 779 791 780 792 this.selected = false; … … 785 797 if (this.ondeselect && !supressOnDeselect) 786 798 this.ondeselect(this); 799 return true; 787 800 } 788 801 -
trunk/WebCore/inspector/front-end/utilities.js
r51506 r52099 834 834 return event.keyCode !== 229 && event.keyIdentifier === "Enter"; 835 835 } 836 837 function isFnKey(event) {838 return event.keyCode >= 112 && event.keyCode <= 123;839 }
Note: See TracChangeset
for help on using the changeset viewer.