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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 targetAdded: function(target) | 128 targetAdded: function(target) |
129 { | 129 { |
130 var treeOutline = new WebInspector.ElementsTreeOutline(target, true, tru
e, this._populateContextMenu.bind(this), this._setPseudoClassForNode.bind(this))
; | 130 var treeOutline = new WebInspector.ElementsTreeOutline(target, true, tru
e, this._populateContextMenu.bind(this), this._setPseudoClassForNode.bind(this))
; |
131 treeOutline.wireToDOMModel(); | 131 treeOutline.wireToDOMModel(); |
132 treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.Sel
ectedNodeChanged, this._selectedNodeChanged, this); | 132 treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.Sel
ectedNodeChanged, this._selectedNodeChanged, this); |
133 treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.Ele
mentsTreeUpdated, this._updateBreadcrumbIfNeeded, this); | 133 treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.Ele
mentsTreeUpdated, this._updateBreadcrumbIfNeeded, this); |
134 this._treeOutlines.push(treeOutline); | 134 this._treeOutlines.push(treeOutline); |
135 this._targetToTreeOutline.put(target, treeOutline); | 135 this._targetToTreeOutline.put(target, treeOutline); |
136 | 136 |
137 target.domModel.addEventListener(WebInspector.DOMModel.Events.DocumentUp
dated, this._documentUpdatedEvent, this); | 137 target.domModel.addEventListener(WebInspector.DOMModel.Events.DocumentUp
dated, this._documentUpdatedEvent, this); |
138 target.cssModel.addEventListener(WebInspector.CSSStyleModel.Events.Model
WasEnabled, this._updateSidebars, this); | |
139 | 138 |
140 // Perform attach if necessary. | 139 // Perform attach if necessary. |
141 if (this.isShowing()) | 140 if (this.isShowing()) |
142 this.wasShown(); | 141 this.wasShown(); |
143 }, | 142 }, |
144 | 143 |
145 /** | 144 /** |
146 * @param {!WebInspector.Target} target | 145 * @param {!WebInspector.Target} target |
147 */ | 146 */ |
148 targetRemoved: function(target) | 147 targetRemoved: function(target) |
149 { | 148 { |
150 var treeOutline = this._targetToTreeOutline.get(target); | 149 var treeOutline = this._targetToTreeOutline.get(target); |
151 treeOutline.unwireFromDOMModel(); | 150 treeOutline.unwireFromDOMModel(); |
152 this._treeOutlines.remove(treeOutline); | 151 this._treeOutlines.remove(treeOutline); |
153 treeOutline.element.remove(); | 152 treeOutline.element.remove(); |
154 | 153 |
155 target.domModel.removeEventListener(WebInspector.DOMModel.Events.Documen
tUpdated, this._documentUpdatedEvent, this); | 154 target.domModel.removeEventListener(WebInspector.DOMModel.Events.Documen
tUpdated, this._documentUpdatedEvent, this); |
156 target.cssModel.removeEventListener(WebInspector.CSSStyleModel.Events.Mo
delWasEnabled, this._updateSidebars, this); | |
157 }, | 155 }, |
158 | 156 |
159 /** | 157 /** |
160 * @return {?WebInspector.ElementsTreeOutline} | 158 * @return {?WebInspector.ElementsTreeOutline} |
161 */ | 159 */ |
162 _firstTreeOutlineDeprecated: function() | 160 _firstTreeOutlineDeprecated: function() |
163 { | 161 { |
164 return this._treeOutlines[0] || null; | 162 return this._treeOutlines[0] || null; |
165 }, | 163 }, |
166 | 164 |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1061 // Compact the selected crumb. | 1059 // Compact the selected crumb. |
1062 compact(selectedCrumb); | 1060 compact(selectedCrumb); |
1063 if (crumbsAreSmallerThanContainer()) | 1061 if (crumbsAreSmallerThanContainer()) |
1064 return; | 1062 return; |
1065 | 1063 |
1066 // Collapse the selected crumb as a last resort. Pass true to prevent co
alescing. | 1064 // Collapse the selected crumb as a last resort. Pass true to prevent co
alescing. |
1067 collapse(selectedCrumb, true); | 1065 collapse(selectedCrumb, true); |
1068 }, | 1066 }, |
1069 | 1067 |
1070 /** | 1068 /** |
1071 * @return {boolean} | |
1072 */ | |
1073 _cssModelEnabledForSelectedNode: function() | |
1074 { | |
1075 if (!this.selectedDOMNode()) | |
1076 return true; | |
1077 return this.selectedDOMNode().target().cssModel.isEnabled(); | |
1078 }, | |
1079 | |
1080 /** | |
1081 * @param {boolean=} forceUpdate | 1069 * @param {boolean=} forceUpdate |
1082 */ | 1070 */ |
1083 updateStyles: function(forceUpdate) | 1071 updateStyles: function(forceUpdate) |
1084 { | 1072 { |
1085 if (!this._cssModelEnabledForSelectedNode()) | |
1086 return; | |
1087 var stylesSidebarPane = this.sidebarPanes.styles; | 1073 var stylesSidebarPane = this.sidebarPanes.styles; |
1088 var computedStylePane = this.sidebarPanes.computedStyle; | 1074 var computedStylePane = this.sidebarPanes.computedStyle; |
1089 if ((!stylesSidebarPane.isShowing() && !computedStylePane.isShowing()) |
| !stylesSidebarPane.needsUpdate) | 1075 if ((!stylesSidebarPane.isShowing() && !computedStylePane.isShowing()) |
| !stylesSidebarPane.needsUpdate) |
1090 return; | 1076 return; |
1091 | 1077 |
1092 stylesSidebarPane.update(this.selectedDOMNode(), forceUpdate); | 1078 stylesSidebarPane.update(this.selectedDOMNode(), forceUpdate); |
1093 stylesSidebarPane.needsUpdate = false; | 1079 stylesSidebarPane.needsUpdate = false; |
1094 }, | 1080 }, |
1095 | 1081 |
1096 updateMetrics: function() | 1082 updateMetrics: function() |
1097 { | 1083 { |
1098 if (!this._cssModelEnabledForSelectedNode()) | |
1099 return; | |
1100 var metricsSidebarPane = this.sidebarPanes.metrics; | 1084 var metricsSidebarPane = this.sidebarPanes.metrics; |
1101 if (!metricsSidebarPane.isShowing() || !metricsSidebarPane.needsUpdate) | 1085 if (!metricsSidebarPane.isShowing() || !metricsSidebarPane.needsUpdate) |
1102 return; | 1086 return; |
1103 | 1087 |
1104 metricsSidebarPane.update(this.selectedDOMNode()); | 1088 metricsSidebarPane.update(this.selectedDOMNode()); |
1105 metricsSidebarPane.needsUpdate = false; | 1089 metricsSidebarPane.needsUpdate = false; |
1106 }, | 1090 }, |
1107 | 1091 |
1108 updatePlatformFonts: function() | 1092 updatePlatformFonts: function() |
1109 { | 1093 { |
1110 if (!this._cssModelEnabledForSelectedNode()) | |
1111 return; | |
1112 var platformFontsSidebar = this.sidebarPanes.platformFonts; | 1094 var platformFontsSidebar = this.sidebarPanes.platformFonts; |
1113 if (!platformFontsSidebar.isShowing() || !platformFontsSidebar.needsUpda
te) | 1095 if (!platformFontsSidebar.isShowing() || !platformFontsSidebar.needsUpda
te) |
1114 return; | 1096 return; |
1115 | 1097 |
1116 platformFontsSidebar.update(this.selectedDOMNode()); | 1098 platformFontsSidebar.update(this.selectedDOMNode()); |
1117 platformFontsSidebar.needsUpdate = false; | 1099 platformFontsSidebar.needsUpdate = false; |
1118 }, | 1100 }, |
1119 | 1101 |
1120 updateProperties: function() | 1102 updateProperties: function() |
1121 { | 1103 { |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 /** | 1450 /** |
1469 * @suppressReceiverCheck | 1451 * @suppressReceiverCheck |
1470 * @this {Element} | 1452 * @this {Element} |
1471 */ | 1453 */ |
1472 function parentElement() | 1454 function parentElement() |
1473 { | 1455 { |
1474 return this.parentElement; | 1456 return this.parentElement; |
1475 } | 1457 } |
1476 } | 1458 } |
1477 } | 1459 } |
OLD | NEW |