| OLD | NEW |
| 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 WebInspector.moduleSetting("sidebarPosition").addChangeListener(this._update
SidebarPosition.bind(this)); | 78 WebInspector.moduleSetting("sidebarPosition").addChangeListener(this._update
SidebarPosition.bind(this)); |
| 79 this._updateSidebarPosition(); | 79 this._updateSidebarPosition(); |
| 80 | 80 |
| 81 /** @type {!Array.<!WebInspector.ElementsTreeOutline>} */ | 81 /** @type {!Array.<!WebInspector.ElementsTreeOutline>} */ |
| 82 this._treeOutlines = []; | 82 this._treeOutlines = []; |
| 83 WebInspector.targetManager.observeTargets(this); | 83 WebInspector.targetManager.observeTargets(this); |
| 84 WebInspector.moduleSetting("showUAShadowDOM").addChangeListener(this._showUA
ShadowDOMChanged.bind(this)); | 84 WebInspector.moduleSetting("showUAShadowDOM").addChangeListener(this._showUA
ShadowDOMChanged.bind(this)); |
| 85 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec
tor.DOMModel.Events.DocumentUpdated, this._documentUpdatedEvent, this); | 85 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebInspec
tor.DOMModel.Events.DocumentUpdated, this._documentUpdatedEvent, this); |
| 86 WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.E
vents.SidebarPaneAdded, this._extensionSidebarPaneAdded, this); | 86 WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.E
vents.SidebarPaneAdded, this._extensionSidebarPaneAdded, this); |
| 87 } | 87 }; |
| 88 | 88 |
| 89 WebInspector.ElementsPanel._elementsSidebarViewTitleSymbol = Symbol("title"); | 89 WebInspector.ElementsPanel._elementsSidebarViewTitleSymbol = Symbol("title"); |
| 90 | 90 |
| 91 WebInspector.ElementsPanel.prototype = { | 91 WebInspector.ElementsPanel.prototype = { |
| 92 /** | 92 /** |
| 93 * @param {!WebInspector.CSSProperty} cssProperty | 93 * @param {!WebInspector.CSSProperty} cssProperty |
| 94 */ | 94 */ |
| 95 _revealProperty: function(cssProperty) | 95 _revealProperty: function(cssProperty) |
| 96 { | 96 { |
| 97 return this.sidebarPaneView.showView(this._stylesViewToReveal).then(() =
> { | 97 return this.sidebarPaneView.showView(this._stylesViewToReveal).then(() =
> { |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 /** | 945 /** |
| 946 * @param {!WebInspector.ExtensionSidebarPane} pane | 946 * @param {!WebInspector.ExtensionSidebarPane} pane |
| 947 */ | 947 */ |
| 948 _addExtensionSidebarPane: function(pane) | 948 _addExtensionSidebarPane: function(pane) |
| 949 { | 949 { |
| 950 if (pane.panelName() === this.name) | 950 if (pane.panelName() === this.name) |
| 951 this.sidebarPaneView.appendView(pane); | 951 this.sidebarPaneView.appendView(pane); |
| 952 }, | 952 }, |
| 953 | 953 |
| 954 __proto__: WebInspector.Panel.prototype | 954 __proto__: WebInspector.Panel.prototype |
| 955 } | 955 }; |
| 956 | 956 |
| 957 /** | 957 /** |
| 958 * @constructor | 958 * @constructor |
| 959 * @implements {WebInspector.ContextMenu.Provider} | 959 * @implements {WebInspector.ContextMenu.Provider} |
| 960 */ | 960 */ |
| 961 WebInspector.ElementsPanel.ContextMenuProvider = function() | 961 WebInspector.ElementsPanel.ContextMenuProvider = function() |
| 962 { | 962 { |
| 963 } | 963 }; |
| 964 | 964 |
| 965 WebInspector.ElementsPanel.ContextMenuProvider.prototype = { | 965 WebInspector.ElementsPanel.ContextMenuProvider.prototype = { |
| 966 /** | 966 /** |
| 967 * @override | 967 * @override |
| 968 * @param {!Event} event | 968 * @param {!Event} event |
| 969 * @param {!WebInspector.ContextMenu} contextMenu | 969 * @param {!WebInspector.ContextMenu} contextMenu |
| 970 * @param {!Object} object | 970 * @param {!Object} object |
| 971 */ | 971 */ |
| 972 appendApplicableItems: function(event, contextMenu, object) | 972 appendApplicableItems: function(event, contextMenu, object) |
| 973 { | 973 { |
| 974 if (!(object instanceof WebInspector.RemoteObject && (/** @type {!WebIns
pector.RemoteObject} */ (object)).isNode()) | 974 if (!(object instanceof WebInspector.RemoteObject && (/** @type {!WebIns
pector.RemoteObject} */ (object)).isNode()) |
| 975 && !(object instanceof WebInspector.DOMNode) | 975 && !(object instanceof WebInspector.DOMNode) |
| 976 && !(object instanceof WebInspector.DeferredDOMNode)) { | 976 && !(object instanceof WebInspector.DeferredDOMNode)) { |
| 977 return; | 977 return; |
| 978 } | 978 } |
| 979 | 979 |
| 980 // Add debbuging-related actions | 980 // Add debbuging-related actions |
| 981 if (object instanceof WebInspector.DOMNode) { | 981 if (object instanceof WebInspector.DOMNode) { |
| 982 contextMenu.appendSeparator(); | 982 contextMenu.appendSeparator(); |
| 983 WebInspector.domBreakpointsSidebarPane.populateNodeContextMenu(objec
t, contextMenu, true); | 983 WebInspector.domBreakpointsSidebarPane.populateNodeContextMenu(objec
t, contextMenu, true); |
| 984 } | 984 } |
| 985 | 985 |
| 986 // Skip adding "Reveal..." menu item for our own tree outline. | 986 // Skip adding "Reveal..." menu item for our own tree outline. |
| 987 if (WebInspector.ElementsPanel.instance().element.isAncestor(/** @type {
!Node} */ (event.target))) | 987 if (WebInspector.ElementsPanel.instance().element.isAncestor(/** @type {
!Node} */ (event.target))) |
| 988 return; | 988 return; |
| 989 var commandCallback = WebInspector.Revealer.reveal.bind(WebInspector.Rev
ealer, object); | 989 var commandCallback = WebInspector.Revealer.reveal.bind(WebInspector.Rev
ealer, object); |
| 990 contextMenu.appendItem(WebInspector.UIString.capitalize("Reveal in Eleme
nts ^panel"), commandCallback); | 990 contextMenu.appendItem(WebInspector.UIString.capitalize("Reveal in Eleme
nts ^panel"), commandCallback); |
| 991 } | 991 } |
| 992 } | 992 }; |
| 993 | 993 |
| 994 /** | 994 /** |
| 995 * @constructor | 995 * @constructor |
| 996 * @implements {WebInspector.Revealer} | 996 * @implements {WebInspector.Revealer} |
| 997 */ | 997 */ |
| 998 WebInspector.ElementsPanel.DOMNodeRevealer = function() { } | 998 WebInspector.ElementsPanel.DOMNodeRevealer = function() { }; |
| 999 | 999 |
| 1000 WebInspector.ElementsPanel.DOMNodeRevealer.prototype = { | 1000 WebInspector.ElementsPanel.DOMNodeRevealer.prototype = { |
| 1001 /** | 1001 /** |
| 1002 * @override | 1002 * @override |
| 1003 * @param {!Object} node | 1003 * @param {!Object} node |
| 1004 * @return {!Promise} | 1004 * @return {!Promise} |
| 1005 */ | 1005 */ |
| 1006 reveal: function(node) | 1006 reveal: function(node) |
| 1007 { | 1007 { |
| 1008 var panel = WebInspector.ElementsPanel.instance(); | 1008 var panel = WebInspector.ElementsPanel.instance(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1039 panel._pendingNodeReveal = false; | 1039 panel._pendingNodeReveal = false; |
| 1040 | 1040 |
| 1041 if (resolvedNode) { | 1041 if (resolvedNode) { |
| 1042 panel.revealAndSelectNode(resolvedNode).then(resolve); | 1042 panel.revealAndSelectNode(resolvedNode).then(resolve); |
| 1043 return; | 1043 return; |
| 1044 } | 1044 } |
| 1045 reject(new Error("Could not resolve node to reveal.")); | 1045 reject(new Error("Could not resolve node to reveal.")); |
| 1046 } | 1046 } |
| 1047 } | 1047 } |
| 1048 } | 1048 } |
| 1049 } | 1049 }; |
| 1050 | 1050 |
| 1051 /** | 1051 /** |
| 1052 * @constructor | 1052 * @constructor |
| 1053 * @implements {WebInspector.Revealer} | 1053 * @implements {WebInspector.Revealer} |
| 1054 */ | 1054 */ |
| 1055 WebInspector.ElementsPanel.CSSPropertyRevealer = function() { } | 1055 WebInspector.ElementsPanel.CSSPropertyRevealer = function() { }; |
| 1056 | 1056 |
| 1057 WebInspector.ElementsPanel.CSSPropertyRevealer.prototype = { | 1057 WebInspector.ElementsPanel.CSSPropertyRevealer.prototype = { |
| 1058 /** | 1058 /** |
| 1059 * @override | 1059 * @override |
| 1060 * @param {!Object} property | 1060 * @param {!Object} property |
| 1061 * @return {!Promise} | 1061 * @return {!Promise} |
| 1062 */ | 1062 */ |
| 1063 reveal: function(property) | 1063 reveal: function(property) |
| 1064 { | 1064 { |
| 1065 var panel = WebInspector.ElementsPanel.instance(); | 1065 var panel = WebInspector.ElementsPanel.instance(); |
| 1066 return panel._revealProperty(/** @type {!WebInspector.CSSProperty} */ (p
roperty)); | 1066 return panel._revealProperty(/** @type {!WebInspector.CSSProperty} */ (p
roperty)); |
| 1067 } | 1067 } |
| 1068 } | 1068 }; |
| 1069 | 1069 |
| 1070 /** | 1070 /** |
| 1071 * @return {!WebInspector.ElementsPanel} | 1071 * @return {!WebInspector.ElementsPanel} |
| 1072 */ | 1072 */ |
| 1073 WebInspector.ElementsPanel.instance = function() | 1073 WebInspector.ElementsPanel.instance = function() |
| 1074 { | 1074 { |
| 1075 return /** @type {!WebInspector.ElementsPanel} */ (self.runtime.sharedInstan
ce(WebInspector.ElementsPanel)); | 1075 return /** @type {!WebInspector.ElementsPanel} */ (self.runtime.sharedInstan
ce(WebInspector.ElementsPanel)); |
| 1076 } | 1076 }; |
| 1077 | 1077 |
| 1078 /** | 1078 /** |
| 1079 * @constructor | 1079 * @constructor |
| 1080 * @implements {WebInspector.ActionDelegate} | 1080 * @implements {WebInspector.ActionDelegate} |
| 1081 */ | 1081 */ |
| 1082 WebInspector.ElementsActionDelegate = function() { } | 1082 WebInspector.ElementsActionDelegate = function() { }; |
| 1083 | 1083 |
| 1084 WebInspector.ElementsActionDelegate.prototype = { | 1084 WebInspector.ElementsActionDelegate.prototype = { |
| 1085 /** | 1085 /** |
| 1086 * @override | 1086 * @override |
| 1087 * @param {!WebInspector.Context} context | 1087 * @param {!WebInspector.Context} context |
| 1088 * @param {string} actionId | 1088 * @param {string} actionId |
| 1089 * @return {boolean} | 1089 * @return {boolean} |
| 1090 */ | 1090 */ |
| 1091 handleAction: function(context, actionId) | 1091 handleAction: function(context, actionId) |
| 1092 { | 1092 { |
| 1093 var node = WebInspector.context.flavor(WebInspector.DOMNode); | 1093 var node = WebInspector.context.flavor(WebInspector.DOMNode); |
| 1094 if (!node) | 1094 if (!node) |
| 1095 return true; | 1095 return true; |
| 1096 var treeOutline = WebInspector.ElementsTreeOutline.forDOMModel(node.domM
odel()); | 1096 var treeOutline = WebInspector.ElementsTreeOutline.forDOMModel(node.domM
odel()); |
| 1097 if (!treeOutline) | 1097 if (!treeOutline) |
| 1098 return true; | 1098 return true; |
| 1099 | 1099 |
| 1100 switch (actionId) { | 1100 switch (actionId) { |
| 1101 case "elements.hide-element": | 1101 case "elements.hide-element": |
| 1102 treeOutline.toggleHideElement(node); | 1102 treeOutline.toggleHideElement(node); |
| 1103 return true; | 1103 return true; |
| 1104 case "elements.edit-as-html": | 1104 case "elements.edit-as-html": |
| 1105 treeOutline.toggleEditAsHTML(node); | 1105 treeOutline.toggleEditAsHTML(node); |
| 1106 return true; | 1106 return true; |
| 1107 } | 1107 } |
| 1108 return false; | 1108 return false; |
| 1109 } | 1109 } |
| 1110 } | 1110 }; |
| 1111 | 1111 |
| 1112 /** | 1112 /** |
| 1113 * @constructor | 1113 * @constructor |
| 1114 * @implements {WebInspector.DOMPresentationUtils.MarkerDecorator} | 1114 * @implements {WebInspector.DOMPresentationUtils.MarkerDecorator} |
| 1115 */ | 1115 */ |
| 1116 WebInspector.ElementsPanel.PseudoStateMarkerDecorator = function() | 1116 WebInspector.ElementsPanel.PseudoStateMarkerDecorator = function() |
| 1117 { | 1117 { |
| 1118 } | 1118 }; |
| 1119 | 1119 |
| 1120 WebInspector.ElementsPanel.PseudoStateMarkerDecorator.prototype = { | 1120 WebInspector.ElementsPanel.PseudoStateMarkerDecorator.prototype = { |
| 1121 /** | 1121 /** |
| 1122 * @override | 1122 * @override |
| 1123 * @param {!WebInspector.DOMNode} node | 1123 * @param {!WebInspector.DOMNode} node |
| 1124 * @return {?{title: string, color: string}} | 1124 * @return {?{title: string, color: string}} |
| 1125 */ | 1125 */ |
| 1126 decorate: function(node) | 1126 decorate: function(node) |
| 1127 { | 1127 { |
| 1128 return { color: "orange", title: WebInspector.UIString("Element state: %
s", ":" + WebInspector.CSSModel.fromNode(node).pseudoState(node).join(", :")) }; | 1128 return { color: "orange", title: WebInspector.UIString("Element state: %
s", ":" + WebInspector.CSSModel.fromNode(node).pseudoState(node).join(", :")) }; |
| 1129 } | 1129 } |
| 1130 } | 1130 }; |
| OLD | NEW |