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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/elements/StylesSidebarPane.js

Issue 2033403005: Eradicate keyIndentifier from devtools/* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Call KeyCodeToKeyIdentifier for unhandle key events Created 4 years, 6 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) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
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 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 filterCallback(regex); 624 filterCallback(regex);
625 container.classList.toggle("styles-filter-engaged", !!input.value); 625 container.classList.toggle("styles-filter-engaged", !!input.value);
626 } 626 }
627 input.addEventListener("input", searchHandler, false); 627 input.addEventListener("input", searchHandler, false);
628 628
629 /** 629 /**
630 * @param {!Event} event 630 * @param {!Event} event
631 */ 631 */
632 function keydownHandler(event) 632 function keydownHandler(event)
633 { 633 {
634 var Esc = "U+001B"; 634 if (event.key !== "Escape" || !input.value)
635 if (event.keyIdentifier !== Esc || !input.value)
636 return; 635 return;
637 event.consume(true); 636 event.consume(true);
638 input.value = ""; 637 input.value = "";
639 searchHandler(); 638 searchHandler();
640 } 639 }
641 input.addEventListener("keydown", keydownHandler, false); 640 input.addEventListener("keydown", keydownHandler, false);
642 641
643 input.setFilterValue = setFilterValue; 642 input.setFilterValue = setFilterValue;
644 643
645 /** 644 /**
(...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after
2466 _editingNameValueKeyDown: function(context, event) 2465 _editingNameValueKeyDown: function(context, event)
2467 { 2466 {
2468 if (event.handled) 2467 if (event.handled)
2469 return; 2468 return;
2470 2469
2471 var result; 2470 var result;
2472 2471
2473 if (isEnterKey(event)) { 2472 if (isEnterKey(event)) {
2474 event.preventDefault(); 2473 event.preventDefault();
2475 result = "forward"; 2474 result = "forward";
2476 } else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Esc.code || event.keyIdentifier === "U+001B") 2475 } else if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Esc.code || event.key === "Escape")
2477 result = "cancel"; 2476 result = "cancel";
2478 else if (!context.isEditingName && this._newProperty && event.keyCode == = WebInspector.KeyboardShortcut.Keys.Backspace.code) { 2477 else if (!context.isEditingName && this._newProperty && event.keyCode == = WebInspector.KeyboardShortcut.Keys.Backspace.code) {
2479 // For a new property, when Backspace is pressed at the beginning of new property value, move back to the property name. 2478 // For a new property, when Backspace is pressed at the beginning of new property value, move back to the property name.
2480 var selection = event.target.getComponentSelection(); 2479 var selection = event.target.getComponentSelection();
2481 if (selection.isCollapsed && !selection.focusOffset) { 2480 if (selection.isCollapsed && !selection.focusOffset) {
2482 event.preventDefault(); 2481 event.preventDefault();
2483 result = "backward"; 2482 result = "backward";
2484 } 2483 }
2485 } else if (event.keyIdentifier === "U+0009") { // Tab key. 2484 } else if (event.key === "Tab") {
2486 result = event.shiftKey ? "backward" : "forward"; 2485 result = event.shiftKey ? "backward" : "forward";
2487 event.preventDefault(); 2486 event.preventDefault();
2488 } 2487 }
2489 2488
2490 if (result) { 2489 if (result) {
2491 switch (result) { 2490 switch (result) {
2492 case "cancel": 2491 case "cancel":
2493 this.editingCancelled(null, context); 2492 this.editingCancelled(null, context);
2494 break; 2493 break;
2495 case "forward": 2494 case "forward":
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
2880 } 2879 }
2881 } 2880 }
2882 2881
2883 WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype = { 2882 WebInspector.StylesSidebarPane.CSSPropertyPrompt.prototype = {
2884 /** 2883 /**
2885 * @override 2884 * @override
2886 * @param {!Event} event 2885 * @param {!Event} event
2887 */ 2886 */
2888 onKeyDown: function(event) 2887 onKeyDown: function(event)
2889 { 2888 {
2890 switch (event.keyIdentifier) { 2889 switch (event.key) {
2891 case "Up": 2890 case "ArrowUp":
2892 case "Down": 2891 case "ArrowDown":
2893 case "PageUp": 2892 case "PageUp":
2894 case "PageDown": 2893 case "PageDown":
2895 if (this._handleNameOrValueUpDown(event)) { 2894 if (this._handleNameOrValueUpDown(event)) {
2896 event.preventDefault(); 2895 event.preventDefault();
2897 return; 2896 return;
2898 } 2897 }
2899 break; 2898 break;
2900 case "Enter": 2899 case "Enter":
2901 // Accept any available autocompletions and advance to the next fiel d. 2900 // Accept any available autocompletions and advance to the next fiel d.
2902 if (this.autoCompleteElement && this.autoCompleteElement.textContent .length) { 2901 if (this.autoCompleteElement && this.autoCompleteElement.textContent .length) {
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
3138 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, onNodeCha nged); 3137 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, onNodeCha nged);
3139 onNodeChanged(); 3138 onNodeChanged();
3140 return button; 3139 return button;
3141 3140
3142 function onNodeChanged() 3141 function onNodeChanged()
3143 { 3142 {
3144 var node = WebInspector.context.flavor(WebInspector.DOMNode); 3143 var node = WebInspector.context.flavor(WebInspector.DOMNode);
3145 button.setEnabled(!!node); 3144 button.setEnabled(!!node);
3146 } 3145 }
3147 } 3146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698