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

Side by Side Diff: Source/devtools/front_end/elements/ElementsPanel.js

Issue 1104163003: Devtools: [ElementsPanel] Add dom listeners in sidebars (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@move-force-state
Patch Set: Address comments Created 5 years, 7 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, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com>
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 }, 669 },
670 670
671 /** 671 /**
672 * @override 672 * @override
673 * @param {!KeyboardEvent} event 673 * @param {!KeyboardEvent} event
674 */ 674 */
675 handleShortcut: function(event) 675 handleShortcut: function(event)
676 { 676 {
677 /** 677 /**
678 * @param {!WebInspector.ElementsTreeOutline} treeOutline 678 * @param {!WebInspector.ElementsTreeOutline} treeOutline
679 * @this {WebInspector.ElementsPanel}
680 */ 679 */
681 function handleUndoRedo(treeOutline) 680 function handleUndoRedo(treeOutline)
682 { 681 {
683 if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && !even t.shiftKey && event.keyIdentifier === "U+005A") { // Z key 682 if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && !even t.shiftKey && event.keyIdentifier === "U+005A") { // Z key
684 treeOutline.domModel().undo(this._updateSidebars.bind(this)); 683 treeOutline.domModel().undo();
685 event.handled = true; 684 event.handled = true;
686 return; 685 return;
687 } 686 }
688 687
689 var isRedoKey = WebInspector.isMac() ? event.metaKey && event.shiftK ey && event.keyIdentifier === "U+005A" : // Z key 688 var isRedoKey = WebInspector.isMac() ? event.metaKey && event.shiftK ey && event.keyIdentifier === "U+005A" : // Z key
690 event.ctrlKey && event.keyIde ntifier === "U+0059"; // Y key 689 event.ctrlKey && event.keyIde ntifier === "U+0059"; // Y key
691 if (isRedoKey) { 690 if (isRedoKey) {
692 treeOutline.domModel().redo(this._updateSidebars.bind(this)); 691 treeOutline.domModel().redo();
693 event.handled = true; 692 event.handled = true;
694 } 693 }
695 } 694 }
696 695
697 if (WebInspector.isEditing()) 696 if (WebInspector.isEditing())
698 return; 697 return;
699 698
700 var treeOutline = null; 699 var treeOutline = null;
701 for (var i = 0; i < this._treeOutlines.length; ++i) { 700 for (var i = 0; i < this._treeOutlines.length; ++i) {
702 if (this._treeOutlines[i].selectedDOMNode() === this._lastValidSelec tedNode) 701 if (this._treeOutlines[i].selectedDOMNode() === this._lastValidSelec tedNode)
703 treeOutline = this._treeOutlines[i]; 702 treeOutline = this._treeOutlines[i];
704 } 703 }
705 if (!treeOutline) 704 if (!treeOutline)
706 return; 705 return;
707 706
708 if (!treeOutline.editing()) { 707 if (!treeOutline.editing()) {
709 handleUndoRedo.call(this, treeOutline); 708 handleUndoRedo.call(null, treeOutline);
710 if (event.handled) 709 if (event.handled)
711 return; 710 return;
712 } 711 }
713 712
714 treeOutline.handleShortcut(event); 713 treeOutline.handleShortcut(event);
715 if (event.handled) 714 if (event.handled)
716 return; 715 return;
717 716
718 WebInspector.Panel.prototype.handleShortcut.call(this, event); 717 WebInspector.Panel.prototype.handleShortcut.call(this, event);
719 }, 718 },
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 WebInspector.ElementsPanelFactory.prototype = { 1105 WebInspector.ElementsPanelFactory.prototype = {
1107 /** 1106 /**
1108 * @override 1107 * @override
1109 * @return {!WebInspector.Panel} 1108 * @return {!WebInspector.Panel}
1110 */ 1109 */
1111 createPanel: function() 1110 createPanel: function()
1112 { 1111 {
1113 return WebInspector.ElementsPanel.instance(); 1112 return WebInspector.ElementsPanel.instance();
1114 } 1113 }
1115 } 1114 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698