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 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 // Compact the selected crumb. | 1044 // Compact the selected crumb. |
1045 compact(selectedCrumb); | 1045 compact(selectedCrumb); |
1046 if (crumbsAreSmallerThanContainer()) | 1046 if (crumbsAreSmallerThanContainer()) |
1047 return; | 1047 return; |
1048 | 1048 |
1049 // Collapse the selected crumb as a last resort. Pass true to prevent co
alescing. | 1049 // Collapse the selected crumb as a last resort. Pass true to prevent co
alescing. |
1050 collapse(selectedCrumb, true); | 1050 collapse(selectedCrumb, true); |
1051 }, | 1051 }, |
1052 | 1052 |
1053 /** | 1053 /** |
| 1054 * @return {boolean} |
| 1055 */ |
| 1056 _cssModelEnabledForSelectedNode: function() |
| 1057 { |
| 1058 if (!this.selectedDOMNode()) |
| 1059 return true; |
| 1060 return this.selectedDOMNode().target().cssModel.isEnabled(); |
| 1061 }, |
| 1062 |
| 1063 /** |
1054 * @param {boolean=} forceUpdate | 1064 * @param {boolean=} forceUpdate |
1055 */ | 1065 */ |
1056 updateStyles: function(forceUpdate) | 1066 updateStyles: function(forceUpdate) |
1057 { | 1067 { |
1058 if (!WebInspector.cssModel.isEnabled()) | 1068 if (!this._cssModelEnabledForSelectedNode()) |
1059 return; | 1069 return; |
1060 var stylesSidebarPane = this.sidebarPanes.styles; | 1070 var stylesSidebarPane = this.sidebarPanes.styles; |
1061 var computedStylePane = this.sidebarPanes.computedStyle; | 1071 var computedStylePane = this.sidebarPanes.computedStyle; |
1062 if ((!stylesSidebarPane.isShowing() && !computedStylePane.isShowing()) |
| !stylesSidebarPane.needsUpdate) | 1072 if ((!stylesSidebarPane.isShowing() && !computedStylePane.isShowing()) |
| !stylesSidebarPane.needsUpdate) |
1063 return; | 1073 return; |
1064 | 1074 |
1065 stylesSidebarPane.update(this.selectedDOMNode(), forceUpdate); | 1075 stylesSidebarPane.update(this.selectedDOMNode(), forceUpdate); |
1066 stylesSidebarPane.needsUpdate = false; | 1076 stylesSidebarPane.needsUpdate = false; |
1067 }, | 1077 }, |
1068 | 1078 |
1069 updateMetrics: function() | 1079 updateMetrics: function() |
1070 { | 1080 { |
1071 if (!WebInspector.cssModel.isEnabled()) | 1081 if (!this._cssModelEnabledForSelectedNode()) |
1072 return; | 1082 return; |
1073 var metricsSidebarPane = this.sidebarPanes.metrics; | 1083 var metricsSidebarPane = this.sidebarPanes.metrics; |
1074 if (!metricsSidebarPane.isShowing() || !metricsSidebarPane.needsUpdate) | 1084 if (!metricsSidebarPane.isShowing() || !metricsSidebarPane.needsUpdate) |
1075 return; | 1085 return; |
1076 | 1086 |
1077 metricsSidebarPane.update(this.selectedDOMNode()); | 1087 metricsSidebarPane.update(this.selectedDOMNode()); |
1078 metricsSidebarPane.needsUpdate = false; | 1088 metricsSidebarPane.needsUpdate = false; |
1079 }, | 1089 }, |
1080 | 1090 |
1081 updatePlatformFonts: function() | 1091 updatePlatformFonts: function() |
1082 { | 1092 { |
1083 if (!WebInspector.cssModel.isEnabled()) | 1093 if (!this._cssModelEnabledForSelectedNode()) |
1084 return; | 1094 return; |
1085 var platformFontsSidebar = this.sidebarPanes.platformFonts; | 1095 var platformFontsSidebar = this.sidebarPanes.platformFonts; |
1086 if (!platformFontsSidebar.isShowing() || !platformFontsSidebar.needsUpda
te) | 1096 if (!platformFontsSidebar.isShowing() || !platformFontsSidebar.needsUpda
te) |
1087 return; | 1097 return; |
1088 | 1098 |
1089 platformFontsSidebar.update(this.selectedDOMNode()); | 1099 platformFontsSidebar.update(this.selectedDOMNode()); |
1090 platformFontsSidebar.needsUpdate = false; | 1100 platformFontsSidebar.needsUpdate = false; |
1091 }, | 1101 }, |
1092 | 1102 |
1093 updateProperties: function() | 1103 updateProperties: function() |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 return; | 1421 return; |
1412 | 1422 |
1413 if (WebInspector.inspectElementModeController && WebInspector.inspectEle
mentModeController.enabled()) { | 1423 if (WebInspector.inspectElementModeController && WebInspector.inspectEle
mentModeController.enabled()) { |
1414 InspectorFrontendHost.bringToFront(); | 1424 InspectorFrontendHost.bringToFront(); |
1415 WebInspector.inspectElementModeController.disable(); | 1425 WebInspector.inspectElementModeController.disable(); |
1416 } | 1426 } |
1417 | 1427 |
1418 /** @type {!WebInspector.ElementsPanel} */ (WebInspector.inspectorView.p
anel("elements")).revealAndSelectNode(node); | 1428 /** @type {!WebInspector.ElementsPanel} */ (WebInspector.inspectorView.p
anel("elements")).revealAndSelectNode(node); |
1419 } | 1429 } |
1420 } | 1430 } |
OLD | NEW |