| 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 14 matching lines...) Expand all Loading... |
| 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 importScript("CSSNamedFlowCollectionsView.js"); | 31 importScript("CSSNamedFlowCollectionsView.js"); |
| 32 importScript("CSSNamedFlowView.js"); | 32 importScript("CSSNamedFlowView.js"); |
| 33 importScript("EventListenersSidebarPane.js"); | 33 importScript("EventListenersSidebarPane.js"); |
| 34 importScript("MetricsSidebarPane.js"); | 34 importScript("MetricsSidebarPane.js"); |
| 35 importScript("PlatformFontsSidebarPane.js"); |
| 35 importScript("PropertiesSidebarPane.js"); | 36 importScript("PropertiesSidebarPane.js"); |
| 36 importScript("StylesSidebarPane.js"); | 37 importScript("StylesSidebarPane.js"); |
| 37 | 38 |
| 38 /** | 39 /** |
| 39 * @constructor | 40 * @constructor |
| 40 * @extends {WebInspector.Panel} | 41 * @extends {WebInspector.Panel} |
| 41 */ | 42 */ |
| 42 WebInspector.ElementsPanel = function() | 43 WebInspector.ElementsPanel = function() |
| 43 { | 44 { |
| 44 WebInspector.Panel.call(this, "elements"); | 45 WebInspector.Panel.call(this, "elements"); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 72 | 73 |
| 73 this.treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.Se
lectedNodeChanged, this._selectedNodeChanged, this); | 74 this.treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.Se
lectedNodeChanged, this._selectedNodeChanged, this); |
| 74 this.treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.El
ementsTreeUpdated, this._updateBreadcrumbIfNeeded, this); | 75 this.treeOutline.addEventListener(WebInspector.ElementsTreeOutline.Events.El
ementsTreeUpdated, this._updateBreadcrumbIfNeeded, this); |
| 75 | 76 |
| 76 this.crumbsElement = document.createElement("div"); | 77 this.crumbsElement = document.createElement("div"); |
| 77 this.crumbsElement.className = "crumbs"; | 78 this.crumbsElement.className = "crumbs"; |
| 78 this.crumbsElement.addEventListener("mousemove", this._mouseMovedInCrumbs.bi
nd(this), false); | 79 this.crumbsElement.addEventListener("mousemove", this._mouseMovedInCrumbs.bi
nd(this), false); |
| 79 this.crumbsElement.addEventListener("mouseout", this._mouseMovedOutOfCrumbs.
bind(this), false); | 80 this.crumbsElement.addEventListener("mouseout", this._mouseMovedOutOfCrumbs.
bind(this), false); |
| 80 | 81 |
| 81 this.sidebarPanes = {}; | 82 this.sidebarPanes = {}; |
| 83 this.sidebarPanes.platformFonts = new WebInspector.PlatformFontsSidebarPane(
); |
| 82 this.sidebarPanes.computedStyle = new WebInspector.ComputedStyleSidebarPane(
); | 84 this.sidebarPanes.computedStyle = new WebInspector.ComputedStyleSidebarPane(
); |
| 83 this.sidebarPanes.styles = new WebInspector.StylesSidebarPane(this.sidebarPa
nes.computedStyle, this._setPseudoClassForNodeId.bind(this)); | 85 this.sidebarPanes.styles = new WebInspector.StylesSidebarPane(this.sidebarPa
nes.computedStyle, this._setPseudoClassForNodeId.bind(this)); |
| 84 this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane(); | 86 this.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane(); |
| 85 this.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane(); | 87 this.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane(); |
| 86 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr
eateProxy(this); | 88 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr
eateProxy(this); |
| 87 this.sidebarPanes.eventListeners = new WebInspector.EventListenersSidebarPan
e(); | 89 this.sidebarPanes.eventListeners = new WebInspector.EventListenersSidebarPan
e(); |
| 88 | 90 |
| 89 this.sidebarPanes.styles.addEventListener(WebInspector.SidebarPane.EventType
s.wasShown, this.updateStyles.bind(this, false)); | 91 this.sidebarPanes.styles.addEventListener(WebInspector.SidebarPane.EventType
s.wasShown, this.updateStyles.bind(this, false)); |
| 90 this.sidebarPanes.metrics.addEventListener(WebInspector.SidebarPane.EventTyp
es.wasShown, this.updateMetrics.bind(this)); | 92 this.sidebarPanes.metrics.addEventListener(WebInspector.SidebarPane.EventTyp
es.wasShown, this.updateMetrics.bind(this)); |
| 93 this.sidebarPanes.platformFonts.addEventListener(WebInspector.SidebarPane.Ev
entTypes.wasShown, this.updatePlatformFonts.bind(this)); |
| 91 this.sidebarPanes.properties.addEventListener(WebInspector.SidebarPane.Event
Types.wasShown, this.updateProperties.bind(this)); | 94 this.sidebarPanes.properties.addEventListener(WebInspector.SidebarPane.Event
Types.wasShown, this.updateProperties.bind(this)); |
| 92 this.sidebarPanes.eventListeners.addEventListener(WebInspector.SidebarPane.E
ventTypes.wasShown, this.updateEventListeners.bind(this)); | 95 this.sidebarPanes.eventListeners.addEventListener(WebInspector.SidebarPane.E
ventTypes.wasShown, this.updateEventListeners.bind(this)); |
| 93 | 96 |
| 94 this.sidebarPanes.styles.addEventListener("style edited", this._stylesPaneEd
ited, this); | 97 this.sidebarPanes.styles.addEventListener("style edited", this._stylesPaneEd
ited, this); |
| 95 this.sidebarPanes.styles.addEventListener("style property toggled", this._st
ylesPaneEdited, this); | 98 this.sidebarPanes.styles.addEventListener("style property toggled", this._st
ylesPaneEdited, this); |
| 96 this.sidebarPanes.metrics.addEventListener("metrics edited", this._metricsPa
neEdited, this); | 99 this.sidebarPanes.metrics.addEventListener("metrics edited", this._metricsPa
neEdited, this); |
| 97 | 100 |
| 98 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve
nts.DockSideChanged, this._dockSideChanged.bind(this)); | 101 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve
nts.DockSideChanged, this._dockSideChanged.bind(this)); |
| 99 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi
s._dockSideChanged.bind(this)); | 102 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi
s._dockSideChanged.bind(this)); |
| 100 this._dockSideChanged(); | 103 this._dockSideChanged(); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 WebInspector.notifications.dispatchEventToListeners(WebInspector.Element
sTreeOutline.Events.SelectedNodeChanged); | 229 WebInspector.notifications.dispatchEventToListeners(WebInspector.Element
sTreeOutline.Events.SelectedNodeChanged); |
| 227 }, | 230 }, |
| 228 | 231 |
| 229 _updateSidebars: function() | 232 _updateSidebars: function() |
| 230 { | 233 { |
| 231 for (var pane in this.sidebarPanes) | 234 for (var pane in this.sidebarPanes) |
| 232 this.sidebarPanes[pane].needsUpdate = true; | 235 this.sidebarPanes[pane].needsUpdate = true; |
| 233 | 236 |
| 234 this.updateStyles(true); | 237 this.updateStyles(true); |
| 235 this.updateMetrics(); | 238 this.updateMetrics(); |
| 239 this.updatePlatformFonts(); |
| 236 this.updateProperties(); | 240 this.updateProperties(); |
| 237 this.updateEventListeners(); | 241 this.updateEventListeners(); |
| 238 }, | 242 }, |
| 239 | 243 |
| 240 _reset: function() | 244 _reset: function() |
| 241 { | 245 { |
| 242 delete this.currentQuery; | 246 delete this.currentQuery; |
| 243 }, | 247 }, |
| 244 | 248 |
| 245 _documentUpdatedEvent: function(event) | 249 _documentUpdatedEvent: function(event) |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 return; | 583 return; |
| 580 } | 584 } |
| 581 } | 585 } |
| 582 }, | 586 }, |
| 583 | 587 |
| 584 _stylesPaneEdited: function() | 588 _stylesPaneEdited: function() |
| 585 { | 589 { |
| 586 // Once styles are edited, the Metrics pane should be updated. | 590 // Once styles are edited, the Metrics pane should be updated. |
| 587 this.sidebarPanes.metrics.needsUpdate = true; | 591 this.sidebarPanes.metrics.needsUpdate = true; |
| 588 this.updateMetrics(); | 592 this.updateMetrics(); |
| 593 this.sidebarPanes.platformFonts.needsUpdate = true; |
| 594 this.updatePlatformFonts(); |
| 589 }, | 595 }, |
| 590 | 596 |
| 591 _metricsPaneEdited: function() | 597 _metricsPaneEdited: function() |
| 592 { | 598 { |
| 593 // Once metrics are edited, the Styles pane should be updated. | 599 // Once metrics are edited, the Styles pane should be updated. |
| 594 this.sidebarPanes.styles.needsUpdate = true; | 600 this.sidebarPanes.styles.needsUpdate = true; |
| 595 this.updateStyles(true); | 601 this.updateStyles(true); |
| 596 }, | 602 }, |
| 597 | 603 |
| 598 _mouseMovedInCrumbs: function(event) | 604 _mouseMovedInCrumbs: function(event) |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 updateMetrics: function() | 996 updateMetrics: function() |
| 991 { | 997 { |
| 992 var metricsSidebarPane = this.sidebarPanes.metrics; | 998 var metricsSidebarPane = this.sidebarPanes.metrics; |
| 993 if (!metricsSidebarPane.isShowing() || !metricsSidebarPane.needsUpdate) | 999 if (!metricsSidebarPane.isShowing() || !metricsSidebarPane.needsUpdate) |
| 994 return; | 1000 return; |
| 995 | 1001 |
| 996 metricsSidebarPane.update(this.selectedDOMNode()); | 1002 metricsSidebarPane.update(this.selectedDOMNode()); |
| 997 metricsSidebarPane.needsUpdate = false; | 1003 metricsSidebarPane.needsUpdate = false; |
| 998 }, | 1004 }, |
| 999 | 1005 |
| 1006 updatePlatformFonts: function() |
| 1007 { |
| 1008 var platformFontsSidebar = this.sidebarPanes.platformFonts; |
| 1009 if (!platformFontsSidebar.isShowing() || !platformFontsSidebar.needsUpda
te) |
| 1010 return; |
| 1011 |
| 1012 platformFontsSidebar.update(this.selectedDOMNode()); |
| 1013 platformFontsSidebar.needsUpdate = false; |
| 1014 }, |
| 1015 |
| 1000 updateProperties: function() | 1016 updateProperties: function() |
| 1001 { | 1017 { |
| 1002 var propertiesSidebarPane = this.sidebarPanes.properties; | 1018 var propertiesSidebarPane = this.sidebarPanes.properties; |
| 1003 if (!propertiesSidebarPane.isShowing() || !propertiesSidebarPane.needsUp
date) | 1019 if (!propertiesSidebarPane.isShowing() || !propertiesSidebarPane.needsUp
date) |
| 1004 return; | 1020 return; |
| 1005 | 1021 |
| 1006 propertiesSidebarPane.update(this.selectedDOMNode()); | 1022 propertiesSidebarPane.update(this.selectedDOMNode()); |
| 1007 propertiesSidebarPane.needsUpdate = false; | 1023 propertiesSidebarPane.needsUpdate = false; |
| 1008 }, | 1024 }, |
| 1009 | 1025 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1141 var expandComputed = computedPane.expand.bind(computedPane); | 1157 var expandComputed = computedPane.expand.bind(computedPane); |
| 1142 | 1158 |
| 1143 this.sidebarPanes.metrics.show(computedPane.bodyElement); | 1159 this.sidebarPanes.metrics.show(computedPane.bodyElement); |
| 1144 this.sidebarPanes.metrics.setExpandCallback(expandComputed); | 1160 this.sidebarPanes.metrics.setExpandCallback(expandComputed); |
| 1145 | 1161 |
| 1146 computedPane.bodyElement.appendChild(this.sidebarPanes.computedStyle.tit
leElement); | 1162 computedPane.bodyElement.appendChild(this.sidebarPanes.computedStyle.tit
leElement); |
| 1147 computedPane.bodyElement.addStyleClass("metrics-and-computed"); | 1163 computedPane.bodyElement.addStyleClass("metrics-and-computed"); |
| 1148 this.sidebarPanes.computedStyle.show(computedPane.bodyElement); | 1164 this.sidebarPanes.computedStyle.show(computedPane.bodyElement); |
| 1149 this.sidebarPanes.computedStyle.setExpandCallback(expandComputed); | 1165 this.sidebarPanes.computedStyle.setExpandCallback(expandComputed); |
| 1150 | 1166 |
| 1167 this.sidebarPanes.platformFonts.show(computedPane.bodyElement); |
| 1168 |
| 1151 if (vertically) { | 1169 if (vertically) { |
| 1152 this.sidebarPaneView = new WebInspector.SidebarTabbedPane(); | 1170 this.sidebarPaneView = new WebInspector.SidebarTabbedPane(); |
| 1153 | 1171 |
| 1154 var compositePane = new WebInspector.SidebarPane(this.sidebarPanes.s
tyles.title()); | 1172 var compositePane = new WebInspector.SidebarPane(this.sidebarPanes.s
tyles.title()); |
| 1155 compositePane.element.addStyleClass("composite"); | 1173 compositePane.element.addStyleClass("composite"); |
| 1156 compositePane.element.addStyleClass("fill"); | 1174 compositePane.element.addStyleClass("fill"); |
| 1157 var expandComposite = compositePane.expand.bind(compositePane); | 1175 var expandComposite = compositePane.expand.bind(compositePane); |
| 1158 | 1176 |
| 1159 var splitView = new WebInspector.SplitView(true, "StylesPaneSplitRat
io", 0.5); | 1177 var splitView = new WebInspector.SplitView(true, "StylesPaneSplitRat
io", 0.5); |
| 1160 splitView.show(compositePane.bodyElement); | 1178 splitView.show(compositePane.bodyElement); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1189 * @param {WebInspector.SidebarPane} pane | 1207 * @param {WebInspector.SidebarPane} pane |
| 1190 */ | 1208 */ |
| 1191 addExtensionSidebarPane: function(id, pane) | 1209 addExtensionSidebarPane: function(id, pane) |
| 1192 { | 1210 { |
| 1193 this.sidebarPanes[id] = pane; | 1211 this.sidebarPanes[id] = pane; |
| 1194 this.sidebarPaneView.addPane(pane); | 1212 this.sidebarPaneView.addPane(pane); |
| 1195 }, | 1213 }, |
| 1196 | 1214 |
| 1197 __proto__: WebInspector.Panel.prototype | 1215 __proto__: WebInspector.Panel.prototype |
| 1198 } | 1216 } |
| OLD | NEW |