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

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

Powered by Google App Engine
This is Rietveld 408576698