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

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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 }, 667 },
668 668
669 /** 669 /**
670 * @override 670 * @override
671 * @param {!KeyboardEvent} event 671 * @param {!KeyboardEvent} event
672 */ 672 */
673 handleShortcut: function(event) 673 handleShortcut: function(event)
674 { 674 {
675 /** 675 /**
676 * @param {!WebInspector.ElementsTreeOutline} treeOutline 676 * @param {!WebInspector.ElementsTreeOutline} treeOutline
677 * @this {WebInspector.ElementsPanel}
678 */ 677 */
679 function handleUndoRedo(treeOutline) 678 function handleUndoRedo(treeOutline)
680 { 679 {
681 if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && !even t.shiftKey && event.keyIdentifier === "U+005A") { // Z key 680 if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event) && !even t.shiftKey && event.keyIdentifier === "U+005A") { // Z key
682 treeOutline.domModel().undo(this._updateSidebars.bind(this)); 681 treeOutline.domModel().undo();
683 event.handled = true; 682 event.handled = true;
684 return; 683 return;
685 } 684 }
686 685
687 var isRedoKey = WebInspector.isMac() ? event.metaKey && event.shiftK ey && event.keyIdentifier === "U+005A" : // Z key 686 var isRedoKey = WebInspector.isMac() ? event.metaKey && event.shiftK ey && event.keyIdentifier === "U+005A" : // Z key
688 event.ctrlKey && event.keyIde ntifier === "U+0059"; // Y key 687 event.ctrlKey && event.keyIde ntifier === "U+0059"; // Y key
689 if (isRedoKey) { 688 if (isRedoKey) {
690 treeOutline.domModel().redo(this._updateSidebars.bind(this)); 689 treeOutline.domModel().redo();
691 event.handled = true; 690 event.handled = true;
692 } 691 }
693 } 692 }
694 693
695 if (WebInspector.isEditing()) 694 if (WebInspector.isEditing())
696 return; 695 return;
697 696
698 var treeOutline = null; 697 var treeOutline = null;
699 for (var i = 0; i < this._treeOutlines.length; ++i) { 698 for (var i = 0; i < this._treeOutlines.length; ++i) {
700 if (this._treeOutlines[i].selectedDOMNode() === this._lastValidSelec tedNode) 699 if (this._treeOutlines[i].selectedDOMNode() === this._lastValidSelec tedNode)
701 treeOutline = this._treeOutlines[i]; 700 treeOutline = this._treeOutlines[i];
702 } 701 }
703 if (!treeOutline) 702 if (!treeOutline)
704 return; 703 return;
705 704
706 if (!treeOutline.editing()) { 705 if (!treeOutline.editing()) {
707 handleUndoRedo.call(this, treeOutline); 706 handleUndoRedo.call(null, treeOutline);
708 if (event.handled) 707 if (event.handled)
709 return; 708 return;
710 } 709 }
711 710
712 treeOutline.handleShortcut(event); 711 treeOutline.handleShortcut(event);
713 if (event.handled) 712 if (event.handled)
714 return; 713 return;
715 714
716 WebInspector.Panel.prototype.handleShortcut.call(this, event); 715 WebInspector.Panel.prototype.handleShortcut.call(this, event);
717 }, 716 },
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 WebInspector.ElementsPanelFactory.prototype = { 1127 WebInspector.ElementsPanelFactory.prototype = {
1129 /** 1128 /**
1130 * @override 1129 * @override
1131 * @return {!WebInspector.Panel} 1130 * @return {!WebInspector.Panel}
1132 */ 1131 */
1133 createPanel: function() 1132 createPanel: function()
1134 { 1133 {
1135 return WebInspector.ElementsPanel.instance(); 1134 return WebInspector.ElementsPanel.instance();
1136 } 1135 }
1137 } 1136 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698