Index: chrome/tools/test/reference_build/chrome_linux/resources/inspector/inspector.js |
diff --git a/chrome/tools/test/reference_build/chrome_linux/resources/inspector/inspector.js b/chrome/tools/test/reference_build/chrome_linux/resources/inspector/inspector.js |
index 41888496486f548e80d81cef4134626b26c4251d..eb93e35f9ea6680f589ee5110b916e0e994e05aa 100644 |
--- a/chrome/tools/test/reference_build/chrome_linux/resources/inspector/inspector.js |
+++ b/chrome/tools/test/reference_build/chrome_linux/resources/inspector/inspector.js |
@@ -1,6 +1,7 @@ |
/* |
* Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
* Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
+ * Copyright (C) 2009 Joseph Pecoraro |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
@@ -37,7 +38,8 @@ var Preferences = { |
minScriptsSidebarWidth: 200, |
showInheritedComputedStyleProperties: false, |
styleRulesExpandedState: {}, |
- showMissingLocalizedStrings: false |
+ showMissingLocalizedStrings: false, |
+ heapProfilerPresent: false, |
} |
var WebInspector = { |
@@ -117,6 +119,26 @@ var WebInspector = { |
} |
} |
} |
+ |
+ for (var panelName in WebInspector.panels) { |
+ if (WebInspector.panels[panelName] == x) |
+ InspectorController.storeLastActivePanel(panelName); |
+ } |
+ }, |
+ |
+ _createPanels: function() |
+ { |
+ var hiddenPanels = (InspectorController.hiddenPanels() || "").split(','); |
+ if (hiddenPanels.indexOf("elements") === -1) |
+ this.panels.elements = new WebInspector.ElementsPanel(); |
+ if (hiddenPanels.indexOf("resources") === -1) |
+ this.panels.resources = new WebInspector.ResourcesPanel(); |
+ if (hiddenPanels.indexOf("scripts") === -1) |
+ this.panels.scripts = new WebInspector.ScriptsPanel(); |
+ if (hiddenPanels.indexOf("profiles") === -1) |
+ this.panels.profiles = new WebInspector.ProfilesPanel(); |
+ if (hiddenPanels.indexOf("storage") === -1 && hiddenPanels.indexOf("databases") === -1) |
+ this.panels.storage = new WebInspector.StoragePanel(); |
}, |
get attached() |
@@ -231,6 +253,53 @@ var WebInspector = { |
errorWarningElement.title = null; |
}, |
+ get styleChanges() |
+ { |
+ return this._styleChanges; |
+ }, |
+ |
+ set styleChanges(x) |
+ { |
+ x = Math.max(x, 0); |
+ |
+ if (this._styleChanges === x) |
+ return; |
+ this._styleChanges = x; |
+ this._updateChangesCount(); |
+ }, |
+ |
+ _updateChangesCount: function() |
+ { |
+ // TODO: Remove immediate return when enabling the Changes Panel |
+ return; |
+ |
+ var changesElement = document.getElementById("changes-count"); |
+ if (!changesElement) |
+ return; |
+ |
+ if (!this.styleChanges) { |
+ changesElement.addStyleClass("hidden"); |
+ return; |
+ } |
+ |
+ changesElement.removeStyleClass("hidden"); |
+ changesElement.removeChildren(); |
+ |
+ if (this.styleChanges) { |
+ var styleChangesElement = document.createElement("span"); |
+ styleChangesElement.id = "style-changes-count"; |
+ styleChangesElement.textContent = this.styleChanges; |
+ changesElement.appendChild(styleChangesElement); |
+ } |
+ |
+ if (this.styleChanges) { |
+ if (this.styleChanges === 1) |
+ changesElement.title = WebInspector.UIString("%d style change", this.styleChanges); |
+ else |
+ changesElement.title = WebInspector.UIString("%d style changes", this.styleChanges); |
+ } |
+ }, |
+ |
get hoveredDOMNode() |
{ |
return this._hoveredDOMNode; |
@@ -238,7 +307,7 @@ var WebInspector = { |
set hoveredDOMNode(x) |
{ |
- if (objectsAreSame(this._hoveredDOMNode, x)) |
+ if (this._hoveredDOMNode === x) |
return; |
this._hoveredDOMNode = x; |
@@ -264,7 +333,7 @@ var WebInspector = { |
} |
if (this._hoveredDOMNode) { |
- InspectorController.highlightDOMNode(this._hoveredDOMNode); |
+ InspectorController.highlightDOMNode(this._hoveredDOMNode.id); |
this.showingDOMNodeHighlight = true; |
} else { |
InspectorController.hideDOMNodeHighlight(); |
@@ -278,27 +347,35 @@ WebInspector.loaded = function() |
var platform = InspectorController.platform(); |
document.body.addStyleClass("platform-" + platform); |
- this.console = new WebInspector.Console(); |
+ this.drawer = new WebInspector.Drawer(); |
+ this.console = new WebInspector.ConsoleView(this.drawer); |
+ // TODO: Uncomment when enabling the Changes Panel |
+ // this.changes = new WebInspector.ChangesView(this.drawer); |
+ // TODO: Remove class="hidden" from inspector.html on button#changes-status-bar-item |
+ this.drawer.visibleView = this.console; |
+ this.domAgent = new WebInspector.DOMAgent(); |
+ |
+ this.resourceCategories = { |
+ documents: new WebInspector.ResourceCategory(WebInspector.UIString("Documents"), "documents"), |
+ stylesheets: new WebInspector.ResourceCategory(WebInspector.UIString("Stylesheets"), "stylesheets"), |
+ images: new WebInspector.ResourceCategory(WebInspector.UIString("Images"), "images"), |
+ scripts: new WebInspector.ResourceCategory(WebInspector.UIString("Scripts"), "scripts"), |
+ xhr: new WebInspector.ResourceCategory(WebInspector.UIString("XHR"), "xhr"), |
+ fonts: new WebInspector.ResourceCategory(WebInspector.UIString("Fonts"), "fonts"), |
+ other: new WebInspector.ResourceCategory(WebInspector.UIString("Other"), "other") |
+ }; |
this.panels = {}; |
- var hiddenPanels = (InspectorController.hiddenPanels() || "").split(','); |
- if (hiddenPanels.indexOf("elements") === -1) |
- this.panels.elements = new WebInspector.ElementsPanel(); |
- if (hiddenPanels.indexOf("resources") === -1) |
- this.panels.resources = new WebInspector.ResourcesPanel(); |
- if (hiddenPanels.indexOf("scripts") === -1) |
- this.panels.scripts = new WebInspector.ScriptsPanel(); |
- if (hiddenPanels.indexOf("profiles") === -1) |
- this.panels.profiles = new WebInspector.ProfilesPanel(); |
- if (hiddenPanels.indexOf("databases") === -1) |
- this.panels.databases = new WebInspector.DatabasesPanel(); |
+ this._createPanels(); |
var toolbarElement = document.getElementById("toolbar"); |
var previousToolbarItem = toolbarElement.children[0]; |
+ this.panelOrder = []; |
for (var panelName in this.panels) { |
var panel = this.panels[panelName]; |
var panelToolbarItem = panel.toolbarItem; |
+ this.panelOrder.push(panel); |
panelToolbarItem.addEventListener("click", this._toolbarItemClicked.bind(this)); |
if (previousToolbarItem) |
toolbarElement.insertBefore(panelToolbarItem, previousToolbarItem.nextSibling); |
@@ -307,18 +384,6 @@ WebInspector.loaded = function() |
previousToolbarItem = panelToolbarItem; |
} |
- this.currentPanel = this.panels.elements; |
- |
- this.resourceCategories = { |
- documents: new WebInspector.ResourceCategory(WebInspector.UIString("Documents"), "documents"), |
- stylesheets: new WebInspector.ResourceCategory(WebInspector.UIString("Stylesheets"), "stylesheets"), |
- images: new WebInspector.ResourceCategory(WebInspector.UIString("Images"), "images"), |
- scripts: new WebInspector.ResourceCategory(WebInspector.UIString("Scripts"), "scripts"), |
- xhr: new WebInspector.ResourceCategory(WebInspector.UIString("XHR"), "xhr"), |
- fonts: new WebInspector.ResourceCategory(WebInspector.UIString("Fonts"), "fonts"), |
- other: new WebInspector.ResourceCategory(WebInspector.UIString("Other"), "other") |
- }; |
- |
this.Tips = { |
ResourceNotCompressed: {id: 0, message: WebInspector.UIString("You could save bandwidth by having your web server compress this transfer with gzip or zlib.")} |
}; |
@@ -357,9 +422,15 @@ WebInspector.loaded = function() |
dockToggleButton.title = WebInspector.UIString("Dock to main window."); |
var errorWarningCount = document.getElementById("error-warning-count"); |
- errorWarningCount.addEventListener("click", this.console.show.bind(this.console), false); |
+ errorWarningCount.addEventListener("click", this.showConsole.bind(this), false); |
this._updateErrorAndWarningCounts(); |
+ this.styleChanges = 0; |
+ // TODO: Uncomment when enabling the Changes Panel |
+ // var changesElement = document.getElementById("changes-count"); |
+ // changesElement.addEventListener("click", this.showChanges.bind(this), false); |
+ // this._updateErrorAndWarningCounts(); |
+ |
var searchField = document.getElementById("search"); |
searchField.addEventListener("keydown", this.searchKeyDown.bind(this), false); |
searchField.addEventListener("keyup", this.searchKeyUp.bind(this), false); |
@@ -389,6 +460,12 @@ var windowLoaded = function() |
window.addEventListener("load", windowLoaded, false); |
+WebInspector.dispatch = function() { |
+ var methodName = arguments[0]; |
+ var parameters = Array.prototype.slice.call(arguments, 1); |
+ WebInspector[methodName].apply(this, parameters); |
+} |
+ |
WebInspector.windowUnload = function(event) |
{ |
InspectorController.windowUnloading(); |
@@ -482,7 +559,7 @@ WebInspector.documentKeyDown = function(event) |
switch (event.keyIdentifier) { |
case "U+001B": // Escape key |
- this.console.visible = !this.console.visible; |
+ this.drawer.visible = !this.drawer.visible; |
event.preventDefault(); |
break; |
@@ -517,6 +594,36 @@ WebInspector.documentKeyDown = function(event) |
} |
break; |
+ |
+ case "U+005B": // [ key |
+ if (isMac) |
+ var isRotateLeft = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey; |
+ else |
+ var isRotateLeft = event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey; |
+ |
+ if (isRotateLeft) { |
+ var index = this.panelOrder.indexOf(this.currentPanel); |
+ index = (index === 0) ? this.panelOrder.length - 1 : index - 1; |
+ this.panelOrder[index].toolbarItem.click(); |
+ event.preventDefault(); |
+ } |
+ |
+ break; |
+ |
+ case "U+005D": // ] key |
+ if (isMac) |
+ var isRotateRight = event.metaKey && !event.shiftKey && !event.ctrlKey && !event.altKey; |
+ else |
+ var isRotateRight = event.ctrlKey && !event.shiftKey && !event.metaKey && !event.altKey; |
+ |
+ if (isRotateRight) { |
+ var index = this.panelOrder.indexOf(this.currentPanel); |
+ index = (index + 1) % this.panelOrder.length; |
+ this.panelOrder[index].toolbarItem.click(); |
+ event.preventDefault(); |
+ } |
+ |
+ break; |
} |
} |
} |
@@ -582,6 +689,7 @@ WebInspector.animateStyle = function(animations, duration, callback, complete) |
var start = null; |
var current = null; |
var end = null; |
+ var key = null; |
for (key in animation) { |
if (key === "element") |
element = animation[key]; |
@@ -743,7 +851,12 @@ WebInspector.elementDragEnd = function(event) |
WebInspector.showConsole = function() |
{ |
- this.console.show(); |
+ this.drawer.showView(this.console); |
+} |
+ |
+WebInspector.showChanges = function() |
+{ |
+ this.drawer.showView(this.changes); |
} |
WebInspector.showElementsPanel = function() |
@@ -766,9 +879,9 @@ WebInspector.showProfilesPanel = function() |
this.currentPanel = this.panels.profiles; |
} |
-WebInspector.showDatabasesPanel = function() |
+WebInspector.showStoragePanel = function() |
{ |
- this.currentPanel = this.panels.databases; |
+ this.currentPanel = this.panels.storage; |
} |
WebInspector.addResource = function(identifier, payload) |
@@ -794,6 +907,23 @@ WebInspector.addResource = function(identifier, payload) |
this.panels.resources.addResource(resource); |
} |
+WebInspector.clearConsoleMessages = function() |
+{ |
+ WebInspector.console.clearMessages(false); |
+} |
+ |
+WebInspector.selectDatabase = function(o) |
+{ |
+ WebInspector.showStoragePanel(); |
+ WebInspector.panels.storage.selectDatabase(o); |
+} |
+ |
+WebInspector.selectDOMStorage = function(o) |
+{ |
+ WebInspector.showStoragePanel(); |
+ WebInspector.panels.storage.selectDOMStorage(o); |
+} |
+ |
WebInspector.updateResource = function(identifier, payload) |
{ |
var resource = this.resources[identifier]; |
@@ -862,7 +992,7 @@ WebInspector.addDatabase = function(payload) |
payload.domain, |
payload.name, |
payload.version); |
- this.panels.databases.addDatabase(database); |
+ this.panels.storage.addDatabase(database); |
} |
WebInspector.addDOMStorage = function(payload) |
@@ -871,7 +1001,22 @@ WebInspector.addDOMStorage = function(payload) |
payload.domStorage, |
payload.host, |
payload.isLocalStorage); |
- this.panels.databases.addDOMStorage(domStorage); |
+ this.panels.storage.addDOMStorage(domStorage); |
+} |
+ |
+WebInspector.resourceTrackingWasEnabled = function() |
+{ |
+ this.panels.resources.resourceTrackingWasEnabled(); |
+} |
+ |
+WebInspector.resourceTrackingWasDisabled = function() |
+{ |
+ this.panels.resources.resourceTrackingWasDisabled(); |
+} |
+ |
+WebInspector.attachDebuggerWhenShown = function() |
+{ |
+ this.panels.scripts.attachDebuggerWhenShown(); |
} |
WebInspector.debuggerWasEnabled = function() |
@@ -943,11 +1088,6 @@ WebInspector.reset = function() |
this.console.clearMessages(); |
} |
-WebInspector.inspectedWindowCleared = function(inspectedWindow) |
-{ |
- this.panels.elements.inspectedWindowCleared(inspectedWindow); |
-} |
- |
WebInspector.resourceURLChanged = function(resource, oldURL) |
{ |
delete this.resourceURLMap[oldURL]; |
@@ -958,6 +1098,7 @@ WebInspector.addMessageToConsole = function(payload) |
{ |
var consoleMessage = new WebInspector.ConsoleMessage( |
payload.source, |
+ payload.type, |
payload.level, |
payload.line, |
payload.url, |
@@ -1007,8 +1148,9 @@ WebInspector.drawLoadingPieChart = function(canvas, percent) { |
g.fill(); |
} |
-WebInspector.updateFocusedNode = function(node) |
+WebInspector.updateFocusedNode = function(nodeId) |
{ |
+ var node = WebInspector.domAgent.nodeForId(nodeId); |
if (!node) |
// FIXME: Should we deselect if null is passed in? |
return; |
@@ -1198,6 +1340,11 @@ WebInspector.performSearch = function(event) |
this.currentPanel.performSearch(query); |
} |
+WebInspector.addNodesToSearchResult = function(nodeIds) |
+{ |
+ WebInspector.panels.elements.addNodesToSearchResult(nodeIds); |
+} |
+ |
WebInspector.updateSearchMatchesCount = function(matches, panel) |
{ |
if (!panel) |
@@ -1256,6 +1403,7 @@ WebInspector.startEditing = function(element, committedCallback, cancelledCallba |
var oldText = element.textContent; |
var oldHandleKeyEvent = element.handleKeyEvent; |
+ var moveDirection = ""; |
element.addStyleClass("editing"); |
@@ -1293,7 +1441,7 @@ WebInspector.startEditing = function(element, committedCallback, cancelledCallba |
function editingCommitted() { |
cleanUpAfterEditing.call(this); |
- committedCallback(this, this.textContent, oldText, context); |
+ committedCallback(this, this.textContent, oldText, context, moveDirection); |
} |
element.handleKeyEvent = function(event) { |
@@ -1309,7 +1457,8 @@ WebInspector.startEditing = function(element, committedCallback, cancelledCallba |
editingCancelled.call(element); |
event.preventDefault(); |
event.handled = true; |
- } |
+ } else if (event.keyIdentifier === "U+0009") // Tab key |
+ moveDirection = (event.shiftKey ? "backward" : "forward"); |
} |
element.addEventListener("blur", blurEventListener, false); |