Index: chrome_linux64/resources/inspector/inspector.js |
=================================================================== |
--- chrome_linux64/resources/inspector/inspector.js (revision 197568) |
+++ chrome_linux64/resources/inspector/inspector.js (working copy) |
@@ -1797,12 +1797,9 @@ |
this.selected = false; |
this.treeOutline = this; |
this.comparator = null; |
-this.searchable = false; |
-this.searchInputElement = null; |
this.setFocusable(!nonFocusable); |
this._childrenListNode.addEventListener("keydown", this._treeKeyDown.bind(this), true); |
-this._childrenListNode.addEventListener("keypress", this._treeKeyPress.bind(this), true); |
this._treeElementsMap = new Map(); |
this._expandedStateMap = new Map(); |
@@ -2028,20 +2025,6 @@ |
return null; |
} |
-TreeOutline.prototype._treeKeyPress = function(event) |
-{ |
-if (!this.searchable || WebInspector.isBeingEdited(this._childrenListNode)) |
-return; |
- |
-var searchText = String.fromCharCode(event.charCode); |
- |
-if (searchText.trim() !== searchText) |
-return; |
- |
-this._startSearch(searchText); |
-event.consume(true); |
-} |
- |
TreeOutline.prototype._treeKeyDown = function(event) |
{ |
if (event.target !== this._childrenListNode) |
@@ -2145,156 +2128,6 @@ |
} |
-TreeOutline.prototype._startSearch = function(searchText) |
-{ |
-if (!this.searchInputElement || !this.searchable) |
-return; |
- |
-this._searching = true; |
- |
-if (this.searchStarted) |
-this.searchStarted(); |
- |
-this.searchInputElement.value = searchText; |
- |
-function focusSearchInput() |
-{ |
-this.searchInputElement.focus(); |
-} |
-window.setTimeout(focusSearchInput.bind(this), 0); |
-this._searchTextChanged(); |
-this._boundSearchTextChanged = this._searchTextChanged.bind(this); |
-this.searchInputElement.addEventListener("paste", this._boundSearchTextChanged); |
-this.searchInputElement.addEventListener("cut", this._boundSearchTextChanged); |
-this.searchInputElement.addEventListener("keypress", this._boundSearchTextChanged); |
-this._boundSearchInputKeyDown = this._searchInputKeyDown.bind(this); |
-this.searchInputElement.addEventListener("keydown", this._boundSearchInputKeyDown); |
-this._boundSearchInputBlur = this._searchInputBlur.bind(this); |
-this.searchInputElement.addEventListener("blur", this._boundSearchInputBlur); |
-} |
- |
-TreeOutline.prototype._searchTextChanged = function() |
-{ |
-function updateSearch() |
-{ |
-var nextSelectedElement = this._nextSearchMatch(this.searchInputElement.value, this.selectedTreeElement, false); |
-if (!nextSelectedElement) |
-nextSelectedElement = this._nextSearchMatch(this.searchInputElement.value, this.children[0], false); |
-this._showSearchMatchElement(nextSelectedElement); |
-} |
- |
-window.setTimeout(updateSearch.bind(this), 0); |
-} |
- |
-TreeOutline.prototype._showSearchMatchElement = function(treeElement) |
-{ |
-this._currentSearchMatchElement = treeElement; |
-if (treeElement) { |
-this._childrenListNode.classList.add("search-match-found"); |
-this._childrenListNode.classList.remove("search-match-not-found"); |
-treeElement.revealAndSelect(true); |
-} else { |
-this._childrenListNode.classList.remove("search-match-found"); |
-this._childrenListNode.classList.add("search-match-not-found"); |
-} |
-} |
- |
-TreeOutline.prototype._searchInputKeyDown = function(event) |
-{ |
-if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) |
-return; |
- |
-var handled = false; |
-var nextSelectedElement; |
-if (event.keyIdentifier === "Down") { |
-nextSelectedElement = this._nextSearchMatch(this.searchInputElement.value, this.selectedTreeElement, true); |
-handled = true; |
-} else if (event.keyIdentifier === "Up") { |
-nextSelectedElement = this._previousSearchMatch(this.searchInputElement.value, this.selectedTreeElement); |
-handled = true; |
-} else if (event.keyCode === 27 ) { |
-this._searchFinished(); |
-handled = true; |
-} else if (isEnterKey(event)) { |
-var lastSearchMatchElement = this._currentSearchMatchElement; |
-this._searchFinished(); |
-lastSearchMatchElement.onenter(); |
-handled = true; |
-} |
- |
-if (nextSelectedElement) |
-this._showSearchMatchElement(nextSelectedElement); |
- |
-if (handled) |
-event.consume(true); |
-else |
-window.setTimeout(this._boundSearchTextChanged, 0); |
-} |
- |
- |
-TreeOutline.prototype._nextSearchMatch = function(searchText, startTreeElement, skipStartTreeElement) |
-{ |
-var currentTreeElement = startTreeElement; |
-var skipCurrentTreeElement = skipStartTreeElement; |
-while (currentTreeElement && (skipCurrentTreeElement || !currentTreeElement.matchesSearchText || !currentTreeElement.matchesSearchText(searchText))) { |
-currentTreeElement = currentTreeElement.traverseNextTreeElement(true, null, true); |
-skipCurrentTreeElement = false; |
-} |
- |
-return currentTreeElement; |
-} |
- |
- |
-TreeOutline.prototype._previousSearchMatch = function(searchText, startTreeElement) |
-{ |
-var currentTreeElement = startTreeElement; |
-var skipCurrentTreeElement = true; |
-while (currentTreeElement && (skipCurrentTreeElement || !currentTreeElement.matchesSearchText || !currentTreeElement.matchesSearchText(searchText))) { |
-currentTreeElement = currentTreeElement.traversePreviousTreeElement(true, true); |
-skipCurrentTreeElement = false; |
-} |
- |
-return currentTreeElement; |
-} |
- |
-TreeOutline.prototype._searchInputBlur = function(event) |
-{ |
-this._searchFinished(); |
-} |
- |
-TreeOutline.prototype._searchFinished = function() |
-{ |
-if (!this._searching) |
-return; |
- |
-delete this._searching; |
-this._childrenListNode.classList.remove("search-match-found"); |
-this._childrenListNode.classList.remove("search-match-not-found"); |
-delete this._currentSearchMatchElement; |
- |
-this.searchInputElement.value = ""; |
-this.searchInputElement.removeEventListener("paste", this._boundSearchTextChanged); |
-this.searchInputElement.removeEventListener("cut", this._boundSearchTextChanged); |
-delete this._boundSearchTextChanged; |
- |
-this.searchInputElement.removeEventListener("keydown", this._boundSearchInputKeyDown); |
-delete this._boundSearchInputKeyDown; |
- |
-this.searchInputElement.removeEventListener("blur", this._boundSearchInputBlur); |
-delete this._boundSearchInputBlur; |
- |
-if (this.searchFinished) |
-this.searchFinished(); |
- |
-this.treeOutline._childrenListNode.focus(); |
-} |
- |
-TreeOutline.prototype.stopSearch = function() |
-{ |
-this._searchFinished(); |
-} |
- |
- |
function TreeElement(title, representedObject, hasChildren) |
{ |
this._title = title; |
@@ -2861,35 +2694,27 @@ |
if (!this._toggleConsoleButton.enabled()) |
return; |
-this._toggleConsoleButton.toggled = !this._toggleConsoleButton.toggled; |
+var animationType = window.event && window.event.shiftKey ? WebInspector.Drawer.AnimationType.Slow : WebInspector.Drawer.AnimationType.Normal; |
-var animationType = window.event && window.event.shiftKey ? WebInspector.Drawer.AnimationType.Slow : WebInspector.Drawer.AnimationType.Normal; |
-if (this._toggleConsoleButton.toggled) { |
-this._toggleConsoleButton.title = WebInspector.UIString("Hide console."); |
-this.drawer.show(this.consoleView, animationType); |
-this._consoleWasShown = true; |
-} else { |
-this._toggleConsoleButton.title = WebInspector.UIString("Show console."); |
-this.drawer.hide(animationType); |
-delete this._consoleWasShown; |
-} |
+if (this._toggleConsoleButton.toggled) |
+this.closeConsole(animationType); |
+else |
+this.showConsole(animationType); |
}, |
showViewInDrawer: function(statusBarElement, view, onclose) |
{ |
-this._toggleConsoleButton.title = WebInspector.UIString("Hide console."); |
+this._toggleConsoleButton.title = WebInspector.UIString("Show console."); |
this._toggleConsoleButton.toggled = false; |
-this._closePreviousDrawerView(); |
+this._removeDrawerView(); |
var drawerStatusBarHeader = document.createElement("div"); |
drawerStatusBarHeader.className = "drawer-header status-bar-item"; |
drawerStatusBarHeader.appendChild(statusBarElement); |
drawerStatusBarHeader.onclose = onclose; |
-var closeButton = drawerStatusBarHeader.createChild("span"); |
-closeButton.textContent = WebInspector.UIString("\u00D7"); |
-closeButton.addStyleClass("drawer-header-close-button"); |
+var closeButton = drawerStatusBarHeader.createChild("div", "close-button"); |
closeButton.addEventListener("click", this.closeViewInDrawer.bind(this), false); |
var panelStatusBar = document.getElementById("panel-status-bar"); |
@@ -2902,26 +2727,58 @@ |
closeViewInDrawer: function() |
{ |
if (this._drawerStatusBarHeader) { |
-this._closePreviousDrawerView(); |
+this._removeDrawerView(); |
-if (!this._consoleWasShown) |
+if (this._consoleWasShown) |
+this.showConsole(); |
+else |
this.drawer.hide(WebInspector.Drawer.AnimationType.Immediately); |
-else |
-this._toggleConsoleButtonClicked(); |
} |
}, |
-_closePreviousDrawerView: function() |
+_removeDrawerView: function() |
{ |
if (this._drawerStatusBarHeader) { |
-this._drawerStatusBarHeader.parentElement.removeChild(this._drawerStatusBarHeader); |
+this._drawerStatusBarHeader.removeSelf(); |
if (this._drawerStatusBarHeader.onclose) |
this._drawerStatusBarHeader.onclose(); |
delete this._drawerStatusBarHeader; |
} |
}, |
+ |
+showConsole: function(animationType) |
+{ |
+animationType = animationType || WebInspector.Drawer.AnimationType.Normal; |
+ |
+if (this.consoleView.isShowing()) |
+return; |
+ |
+if (WebInspector.drawer.visible) |
+this._removeDrawerView(); |
+ |
+this._toggleConsoleButton.toggled = true; |
+this._toggleConsoleButton.title = WebInspector.UIString("Hide console."); |
+this.drawer.show(this.consoleView, animationType); |
+this._consoleWasShown = true; |
+}, |
+ |
+ |
+closeConsole: function(animationType) |
+{ |
+animationType = animationType || WebInspector.Drawer.AnimationType.Normal; |
+ |
+if (!this.consoleView.isShowing() || !WebInspector.drawer.visible) |
+return; |
+ |
+this._toggleConsoleButton.toggled = false; |
+this._toggleConsoleButton.title = WebInspector.UIString("Show console."); |
+this.drawer.hide(animationType); |
+this._consoleWasShown = false; |
+}, |
+ |
+ |
_updateErrorAndWarningCounts: function() |
{ |
var errorWarningElement = document.getElementById("error-warning-count"); |
@@ -2940,23 +2797,17 @@ |
errorWarningElement.removeChildren(); |
if (errors) { |
-var errorImageElement = document.createElement("img"); |
-errorImageElement.id = "error-count-img"; |
-errorWarningElement.appendChild(errorImageElement); |
-var errorElement = document.createElement("span"); |
+var errorImageElement = errorWarningElement.createChild("div", "error-icon-small"); |
+var errorElement = errorWarningElement.createChild("span"); |
errorElement.id = "error-count"; |
errorElement.textContent = errors; |
-errorWarningElement.appendChild(errorElement); |
} |
if (warnings) { |
-var warningsImageElement = document.createElement("img"); |
-warningsImageElement.id = "warning-count-img"; |
-errorWarningElement.appendChild(warningsImageElement); |
-var warningsElement = document.createElement("span"); |
+var warningsImageElement = errorWarningElement.createChild("div", "warning-icon-small"); |
+var warningsElement = errorWarningElement.createChild("span"); |
warningsElement.id = "warning-count"; |
warningsElement.textContent = warnings; |
-errorWarningElement.appendChild(warningsElement); |
} |
if (errors) { |
@@ -3027,9 +2878,49 @@ |
{ |
WebInspector.panel("scripts"); |
+}, |
+ |
+_setupTethering: function() |
+{ |
+if (!this._portForwardings) { |
+this._portForwardings = {}; |
+WebInspector.settings.portForwardings.addChangeListener(this._setupTethering.bind(this)); |
} |
+var entries = WebInspector.settings.portForwardings.get(); |
+var newForwardings = {}; |
+for (var i = 0; i < entries.length; ++i) |
+newForwardings[entries[i].port] = entries[i].location; |
+ |
+for (var port in this._portForwardings) { |
+if (!newForwardings[port]) |
+unbind(port); |
} |
+for (var port in newForwardings) { |
+if (this._portForwardings[port] && newForwardings[port] === this._portForwardings[port]) |
+continue; |
+if (this._portForwardings[port]) |
+unbind(port); |
+bind(port, newForwardings[port]); |
+} |
+this._portForwardings = newForwardings; |
+ |
+ |
+function bind(port, location) |
+{ |
+var command = { method: "Tethering.bind", params: { port: parseInt(port, 10), location: location }, id: InspectorBackend.nextCallbackId() }; |
+InspectorBackend.sendMessageObjectToBackend(command); |
+} |
+ |
+ |
+function unbind(port) |
+{ |
+var command = { method: "Tethering.unbind", params: { port: parseInt(port, 10) }, id: InspectorBackend.nextCallbackId() }; |
+InspectorBackend.sendMessageObjectToBackend(command); |
+} |
+} |
+} |
+ |
WebInspector.Events = { |
InspectorLoaded: "InspectorLoaded", |
InspectorClosing: "InspectorClosing" |
@@ -3163,6 +3054,7 @@ |
this.debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPaused, this); |
this.networkLog = new WebInspector.NetworkLog(); |
this.domAgent = new WebInspector.DOMAgent(); |
+this.domAgent.addEventListener(WebInspector.DOMAgent.Events.InspectNodeRequested, this._inspectNodeRequested, this); |
this.runtimeModel = new WebInspector.RuntimeModel(this.resourceTreeModel); |
this.consoleView = new WebInspector.ConsoleView(WebInspector.WorkerManager.isWorkerFrontend()); |
@@ -3257,9 +3149,6 @@ |
if (WebInspector.settings.continuousPainting.get()) |
PageAgent.setContinuousPaintingEnabled(true); |
-if (WebInspector.settings.javaScriptDisabled.get()) |
-PageAgent.setScriptExecutionDisabled(true); |
- |
if (WebInspector.settings.showFPSCounter.get()) |
PageAgent.setShowFPSCounter(true); |
@@ -3268,6 +3157,9 @@ |
WebInspector.WorkerManager.loadCompleted(); |
InspectorFrontendAPI.loadCompleted(); |
+if (WebInspector.experimentsSettings.tethering.isEnabled()) |
+this._setupTethering(); |
+ |
WebInspector.notifications.dispatchEventToListeners(WebInspector.Events.InspectorLoaded); |
} |
@@ -3435,7 +3327,7 @@ |
if (event.keyIdentifier === "F1" || |
(event.keyIdentifier === helpKey && event.shiftKey && (!WebInspector.isBeingEdited(event.target) || event.metaKey))) { |
-this.settingsController.showSettingsScreen(WebInspector.SettingsScreen.Tabs.Shortcuts); |
+this.settingsController.showSettingsScreen(WebInspector.SettingsScreen.Tabs.General); |
event.consume(true); |
return; |
} |
@@ -3553,15 +3445,6 @@ |
event.preventDefault(); |
} |
-WebInspector.showConsole = function() |
-{ |
-if (WebInspector._toggleConsoleButton && !WebInspector._toggleConsoleButton.toggled) { |
-if (WebInspector.drawer.visible) |
-this._closePreviousDrawerView(); |
-WebInspector._toggleConsoleButtonClicked(); |
-} |
-} |
- |
WebInspector.showPanel = function(panel) |
{ |
return WebInspector.inspectorView.showPanel(panel); |
@@ -3690,6 +3573,11 @@ |
WebInspector.UIString("Inspected target has crashed. Once it reloads we will attach to it automatically."))).showModal(); |
} |
+WebInspector._inspectNodeRequested = function(event) |
+{ |
+WebInspector._updateFocusedNode(event.data); |
+} |
+ |
WebInspector._updateFocusedNode = function(nodeId) |
{ |
if (WebInspector.inspectElementModeController && WebInspector.inspectElementModeController.enabled()) { |
@@ -3812,9 +3700,15 @@ |
} |
InspectorBackendClass.prototype = { |
+ |
+nextCallbackId: function() |
+{ |
+return this._lastCallbackId++; |
+}, |
+ |
_wrap: function(callback, method) |
{ |
-var callbackId = this._lastCallbackId++; |
+var callbackId = this.nextCallbackId(); |
if (!callback) |
callback = function() {}; |
@@ -4245,7 +4139,7 @@ |
InspectorBackend.registerConsoleDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Console"); |
-InspectorBackend.registerEnum("Console.ConsoleMessageSource", {XML: "xml", Javascript: "javascript", Network: "network", ConsoleAPI: "console-api", Storage: "storage", Appcache: "appcache", Rendering: "rendering", Css: "css", Security: "security", Other: "other"}); |
+InspectorBackend.registerEnum("Console.ConsoleMessageSource", {XML: "xml", Javascript: "javascript", Network: "network", ConsoleAPI: "console-api", Storage: "storage", Appcache: "appcache", Rendering: "rendering", Css: "css", Security: "security", Other: "other", Deprecation: "deprecation"}); |
InspectorBackend.registerEnum("Console.ConsoleMessageLevel", {Log: "log", Warning: "warning", Error: "error", Debug: "debug"}); |
InspectorBackend.registerEnum("Console.ConsoleMessageType", {Log: "log", Dir: "dir", DirXML: "dirxml", Table: "table", Trace: "trace", Clear: "clear", StartGroup: "startGroup", StartGroupCollapsed: "startGroupCollapsed", EndGroup: "endGroup", Assert: "assert", Timing: "timing", Profile: "profile", ProfileEnd: "profileEnd"}); |
InspectorBackend.registerEvent("Console.messageAdded", ["message"]); |
@@ -4340,6 +4234,7 @@ |
InspectorBackend.registerDOMDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "DOM"); |
InspectorBackend.registerEvent("DOM.documentUpdated", []); |
+InspectorBackend.registerEvent("DOM.inspectNodeRequested", ["nodeId"]); |
InspectorBackend.registerEvent("DOM.setChildNodes", ["parentId", "nodes"]); |
InspectorBackend.registerEvent("DOM.attributeModified", ["nodeId", "name", "value"]); |
InspectorBackend.registerEvent("DOM.attributeRemoved", ["nodeId", "name"]); |
@@ -4393,6 +4288,8 @@ |
InspectorBackend.registerEnum("CSS.RegionRegionOverset", {Overset: "overset", Fit: "fit", Empty: "empty"}); |
InspectorBackend.registerEvent("CSS.mediaQueryResultChanged", []); |
InspectorBackend.registerEvent("CSS.styleSheetChanged", ["styleSheetId"]); |
+InspectorBackend.registerEvent("CSS.styleSheetAdded", ["header"]); |
+InspectorBackend.registerEvent("CSS.styleSheetRemoved", ["styleSheetId"]); |
InspectorBackend.registerEvent("CSS.namedFlowCreated", ["namedFlow"]); |
InspectorBackend.registerEvent("CSS.namedFlowRemoved", ["documentNodeId", "flowName"]); |
InspectorBackend.registerEvent("CSS.regionLayoutUpdated", ["namedFlow"]); |
@@ -4490,7 +4387,11 @@ |
InspectorBackend.registerEvent("HeapProfiler.finishHeapSnapshot", ["uid"]); |
InspectorBackend.registerEvent("HeapProfiler.resetProfiles", []); |
InspectorBackend.registerEvent("HeapProfiler.reportHeapSnapshotProgress", ["done", "total"]); |
+InspectorBackend.registerEvent("HeapProfiler.lastSeenObjectId", ["lastSeenObjectId", "timestamp"]); |
+InspectorBackend.registerEvent("HeapProfiler.heapStatsUpdate", ["statsUpdate"]); |
InspectorBackend.registerCommand("HeapProfiler.getProfileHeaders", [], ["headers"]); |
+InspectorBackend.registerCommand("HeapProfiler.startTrackingHeapObjects", [], []); |
+InspectorBackend.registerCommand("HeapProfiler.stopTrackingHeapObjects", [], []); |
InspectorBackend.registerCommand("HeapProfiler.getHeapSnapshot", [{"name": "uid", "type": "number", "optional": false}], []); |
InspectorBackend.registerCommand("HeapProfiler.removeProfile", [{"name": "uid", "type": "number", "optional": false}], []); |
InspectorBackend.registerCommand("HeapProfiler.clearProfiles", [], []); |
@@ -4877,7 +4778,7 @@ |
this.eventListenerBreakpoints = this.createSetting("eventListenerBreakpoints", []); |
this.domBreakpoints = this.createSetting("domBreakpoints", []); |
this.xhrBreakpoints = this.createSetting("xhrBreakpoints", []); |
-this.sourceMapsEnabled = this.createSetting("sourceMapsEnabled", false); |
+this.sourceMapsEnabled = this.createSetting("sourceMapsEnabled", true); |
this.cacheDisabled = this.createSetting("cacheDisabled", false); |
this.overrideUserAgent = this.createSetting("overrideUserAgent", ""); |
this.userAgent = this.createSetting("userAgent", ""); |
@@ -4912,6 +4813,8 @@ |
this.messageURLFilters = this.createSetting("messageURLFilters", {}); |
this.splitVerticallyWhenDockedToRight = this.createSetting("splitVerticallyWhenDockedToRight", true); |
this.visiblePanels = this.createSetting("visiblePanels", {}); |
+this.shortcutPanelSwitch = this.createSetting("shortcutPanelSwitch", false); |
+this.portForwardings = this.createSetting("portForwardings", []); |
} |
WebInspector.Settings.prototype = { |
@@ -4987,21 +4890,20 @@ |
this._enabledForTest = {}; |
-this.snippetsSupport = this._createExperiment("snippetsSupport", "Snippets support"); |
this.nativeMemorySnapshots = this._createExperiment("nativeMemorySnapshots", "Native memory profiling"); |
this.nativeMemoryTimeline = this._createExperiment("nativeMemoryTimeline", "Native memory timeline"); |
this.fileSystemInspection = this._createExperiment("fileSystemInspection", "FileSystem inspection"); |
this.canvasInspection = this._createExperiment("canvasInspection ", "Canvas inspection"); |
this.sass = this._createExperiment("sass", "Support for Sass"); |
-this.codemirror = this._createExperiment("codemirror", "Use CodeMirror editor"); |
this.cssRegions = this._createExperiment("cssRegions", "CSS Regions Support"); |
this.showOverridesInDrawer = this._createExperiment("showOverridesInDrawer", "Show Overrides in drawer"); |
this.fileSystemProject = this._createExperiment("fileSystemProject", "File system folders in Sources Panel"); |
this.showWhitespaceInEditor = this._createExperiment("showWhitespaceInEditor", "Show whitespace characters in editor"); |
-this.textEditorSmartBraces = this._createExperiment("textEditorSmartBraces", "Enable smart braces in text editor"); |
this.customizableToolbar = this._createExperiment("customizableToolbar", "Enable toolbar customization"); |
this.cpuFlameChart = this._createExperiment("cpuFlameChart", "Show Flame Chart in CPU Profiler"); |
-this.shortcutPanelSwitch = this._createExperiment("shortcutPanelSwitch", "Enable Ctrl/Cmd + 1-9 shortcut to switch panels"); |
+this.tethering = this._createExperiment("tethering", "Enable reverse port forwarding"); |
+this.drawerOverlay = this._createExperiment("drawerOverlay", "Open console as overlay"); |
+this.heapObjectsTracking = this._createExperiment("heapObjectsTracking", "Enable heap objects tracking profile type"); |
this._cleanUpSetting(); |
} |
@@ -5732,7 +5634,7 @@ |
WebInspector.isBeingEdited = function(element) |
{ |
-if (element.hasStyleClass("text-prompt") || element.nodeName === "INPUT") |
+if (element.hasStyleClass("text-prompt") || element.nodeName === "INPUT" || element.nodeName === "TEXTAREA") |
return true; |
if (!WebInspector.__editingCount) |
@@ -5751,11 +5653,13 @@ |
if (value) { |
if (element.__editing) |
return false; |
+element.addStyleClass("being-edited"); |
element.__editing = true; |
WebInspector.__editingCount = (WebInspector.__editingCount || 0) + 1; |
} else { |
if (!element.__editing) |
return false; |
+element.removeStyleClass("being-edited"); |
delete element.__editing; |
--WebInspector.__editingCount; |
} |
@@ -6009,6 +5913,7 @@ |
theme: config.theme, |
value: oldText |
}); |
+codeMirror.getWrapperElement().addStyleClass("source-code"); |
} else { |
element.addStyleClass("editing"); |
@@ -6627,9 +6532,8 @@ |
WebInspector.HelpScreen.prototype = { |
_createCloseButton: function() |
{ |
-var closeButton = document.createElement("button"); |
-closeButton.className = "help-close-button"; |
-closeButton.textContent = "\u2716"; |
+var closeButton = document.createElement("div"); |
+closeButton.className = "help-close-button close-button-gray"; |
closeButton.addEventListener("click", this.hide.bind(this), false); |
return closeButton; |
}, |
@@ -6769,10 +6673,6 @@ |
{ |
}, |
-setAttachedWindowWidth: function(width) |
-{ |
-}, |
- |
moveWindowBy: function(x, y) |
{ |
}, |
@@ -9472,7 +9372,7 @@ |
this._tabs = []; |
this._tabsHistory = []; |
this._tabsById = {}; |
-this.element.addEventListener("click", this.focus.bind(this), false); |
+this.element.addEventListener("click", this.focus.bind(this), true); |
this.element.addEventListener("mouseup", this.onMouseUp.bind(this), false); |
this._dropDownButton = this._createDropDownButton(); |
@@ -10041,10 +9941,8 @@ |
if (!measuring) |
this._titleElement = titleElement; |
-if (this._closeable) { |
-var closeButtonSpan = tabElement.createChild("span", "tabbed-pane-header-tab-close-button"); |
-closeButtonSpan.textContent = "\u00D7"; |
-} |
+if (this._closeable) |
+tabElement.createChild("div", "close-button-gray"); |
if (measuring) |
tabElement.addStyleClass("measuring"); |
@@ -10064,14 +9962,14 @@ |
_tabClicked: function(event) |
{ |
-if (this._closeable && (event.button === 1 || event.target.hasStyleClass("tabbed-pane-header-tab-close-button"))) |
+if (this._closeable && (event.button === 1 || event.target.hasStyleClass("close-button-gray"))) |
this._closeTabs([this.id]); |
}, |
_tabMouseDown: function(event) |
{ |
-if (event.target.hasStyleClass("tabbed-pane-header-tab-close-button") || event.button === 1) |
+if (event.target.hasStyleClass("close-button-gray") || event.button === 1) |
return; |
this._tabbedPane.selectTab(this.id, true); |
}, |
@@ -10113,7 +10011,7 @@ |
_startTabDragging: function(event) |
{ |
-if (event.target.hasStyleClass("tabbed-pane-header-tab-close-button")) |
+if (event.target.hasStyleClass("close-button-gray")) |
return false; |
this._dragStartX = event.pageX; |
return true; |
@@ -10224,9 +10122,13 @@ |
if (!this.element.clientHeight) |
return; |
+this._contentElement.removeChildren(); |
var itemCount = this._provider.itemCount(); |
-if (!itemCount) |
+if (!itemCount) { |
+this._firstVisibleIndex = -1; |
+this._lastVisibleIndex = -1; |
return; |
+} |
if (!this._rowHeight) { |
var firstElement = this._provider.itemElement(0); |
@@ -10242,7 +10144,6 @@ |
this._topGapElement.style.height = (this._rowHeight * this._firstVisibleIndex) + "px"; |
this._bottomGapElement.style.height = (this._rowHeight * (itemCount - this._lastVisibleIndex - 1)) + "px"; |
-this._contentElement.removeChildren(); |
for (var i = this._firstVisibleIndex; i <= this._lastVisibleIndex; ++i) |
this._contentElement.appendChild(this._provider.itemElement(i)); |
}, |
@@ -10302,6 +10203,8 @@ |
WebInspector.Drawer = function() |
{ |
this.element = document.getElementById("drawer"); |
+this.element.style.height = 0; |
+ |
this._savedHeight = 200; |
this._mainElement = document.getElementById("main"); |
this._toolbarElement = document.getElementById("toolbar"); |
@@ -10317,6 +10220,11 @@ |
this._viewStatusBar.addEventListener("webkitTransitionEnd", this.immediatelyFinishAnimation.bind(this), false); |
this._viewStatusBar.style.opacity = 0; |
this._bottomStatusBar = document.getElementById("bottom-status-bar-container"); |
+ |
+var drawerIsOverlay = WebInspector.experimentsSettings.drawerOverlay.isEnabled(); |
+this._elementToAdjust = drawerIsOverlay ? this._floatingStatusBarContainer : this._mainElement; |
+ |
+document.body.enableStyleClass("drawer-overlay", drawerIsOverlay); |
} |
WebInspector.Drawer.AnimationType = { |
@@ -10368,8 +10276,6 @@ |
this._floatingStatusBarContainer.style.paddingLeft = this._bottomStatusBar.offsetLeft + "px"; |
-this._getAnimationStyles(animationType).forEach(document.body.addStyleClass, document.body); |
- |
function animationFinished() |
{ |
WebInspector.inspectorView.currentPanel().doResize(); |
@@ -10382,13 +10288,21 @@ |
console.assert(this._viewStatusBar.style.opacity === "0"); |
-if (animationType === WebInspector.Drawer.AnimationType.Immediately) |
-this.immediatelyFinishAnimation(); |
+function adjustStyles() |
+{ |
+this._animationStyles(animationType).forEach(document.body.addStyleClass, document.body); |
this.element.style.height = height + "px"; |
-this._mainElement.style.bottom = height + "px"; |
+this._elementToAdjust.style.bottom = height + "px"; |
this._floatingStatusBarContainer.style.paddingLeft = 0; |
this._viewStatusBar.style.opacity = 1; |
+} |
+ |
+if (animationType === WebInspector.Drawer.AnimationType.Immediately) { |
+adjustStyles.call(this); |
+this.immediatelyFinishAnimation(); |
+} else |
+setTimeout(adjustStyles.bind(this), 0); |
}, |
hide: function(animationType) |
@@ -10407,8 +10321,6 @@ |
WebInspector.inspectorView.currentPanel().statusBarResized(); |
document.body.addStyleClass("drawer-visible"); |
-this._getAnimationStyles(animationType).forEach(document.body.addStyleClass, document.body); |
- |
function animationFinished() |
{ |
WebInspector.inspectorView.currentPanel().doResize(); |
@@ -10425,13 +10337,21 @@ |
console.assert(this._viewStatusBar.style.opacity === "1"); |
-if (animationType === WebInspector.Drawer.AnimationType.Immediately) |
-this.immediatelyFinishAnimation(); |
+function adjustStyles() |
+{ |
+this._animationStyles(animationType).forEach(document.body.addStyleClass, document.body); |
this.element.style.height = 0; |
-this._mainElement.style.bottom = 0; |
+this._elementToAdjust.style.bottom = 0; |
this._floatingStatusBarContainer.style.paddingLeft = this._bottomStatusBar.offsetLeft + "px"; |
this._viewStatusBar.style.opacity = 0; |
+} |
+ |
+if (animationType === WebInspector.Drawer.AnimationType.Immediately) { |
+adjustStyles.call(this); |
+this.immediatelyFinishAnimation(); |
+} else |
+setTimeout(adjustStyles.bind(this), 0); |
}, |
resize: function() |
@@ -10441,7 +10361,7 @@ |
this._view.storeScrollPositions(); |
var height = this._constrainHeight(parseInt(this.element.style.height, 10)); |
-this._mainElement.style.bottom = height + "px"; |
+this._elementToAdjust.style.bottom = height + "px"; |
this.element.style.height = height + "px"; |
this._view.doResize(); |
}, |
@@ -10456,7 +10376,7 @@ |
} |
}, |
-_getAnimationStyles: function(animationType) |
+_animationStyles: function(animationType) |
{ |
switch (animationType) { |
case WebInspector.Drawer.AnimationType.Slow: |
@@ -10484,7 +10404,7 @@ |
var height = window.innerHeight - event.pageY + this._statusBarDragOffset; |
height = Number.constrain(height, Preferences.minConsoleHeight, window.innerHeight - this._mainElement.totalOffsetTop() - Preferences.minConsoleHeight); |
-this._mainElement.style.bottom = height + "px"; |
+this._elementToAdjust.style.bottom = height + "px"; |
this.element.style.height = height + "px"; |
if (WebInspector.inspectorView.currentPanel()) |
WebInspector.inspectorView.currentPanel().doResize(); |
@@ -10675,7 +10595,8 @@ |
Rendering: "rendering", |
CSS: "css", |
Security: "security", |
-Other: "other" |
+Other: "other", |
+Deprecation: "deprecation" |
} |
WebInspector.ConsoleMessage.MessageType = { |
@@ -12791,7 +12712,7 @@ |
return; |
-var panelShortcutEnabled = WebInspector.experimentsSettings.shortcutPanelSwitch.isEnabled(); |
+var panelShortcutEnabled = WebInspector.settings.shortcutPanelSwitch.get(); |
if (panelShortcutEnabled && !event.shiftKey && !event.altKey && event.keyCode > 0x30 && event.keyCode < 0x3A) { |
var panelName = this._panelOrder[event.keyCode - 0x31]; |
if (panelName) { |
@@ -13943,41 +13864,42 @@ |
}, |
-_setWindow: function(left, right) |
+_setWindow: function(windowLeft, windowRight) |
{ |
var clientWidth = this._parentElement.clientWidth; |
-this._setWindowPosition(left * clientWidth, right * clientWidth); |
-}, |
+const rulerAdjustment = 1 / clientWidth; |
+this.windowLeft = windowLeft; |
+this._leftResizeElement.style.left = this.windowLeft * 100 + "%"; |
+this.windowRight = windowRight; |
+this._rightResizeElement.style.left = this.windowRight * 100 + "%"; |
-_setWindowPosition: function(start, end) |
-{ |
-var clientWidth = this._parentElement.clientWidth; |
-const rulerAdjustment = 1 / clientWidth; |
-if (typeof start === "number") { |
-this.windowLeft = start / clientWidth; |
-this._leftResizeElement.style.left = this.windowLeft * 100 + "%"; |
this._overviewWindowElement.style.left = this.windowLeft * 100 + "%"; |
this._overviewWindowBordersElement.style.left = (this.windowLeft - rulerAdjustment) * 100 + "%"; |
-} |
-if (typeof end === "number") { |
-this.windowRight = end / clientWidth; |
-this._rightResizeElement.style.left = this.windowRight * 100 + "%"; |
-} |
this._overviewWindowElement.style.width = (this.windowRight - this.windowLeft) * 100 + "%"; |
this._overviewWindowBordersElement.style.right = (1 - this.windowRight + 2 * rulerAdjustment) * 100 + "%"; |
+ |
this.dispatchEventToListeners(WebInspector.OverviewGrid.Events.WindowChanged); |
}, |
+_setWindowPosition: function(start, end) |
+{ |
+var clientWidth = this._parentElement.clientWidth; |
+var windowLeft = typeof start === "number" ? start / clientWidth : this.windowLeft; |
+var windowRight = typeof end === "number" ? end / clientWidth : this.windowRight; |
+this._setWindow(windowLeft, windowRight); |
+}, |
+ |
+ |
_onMouseWheel: function(event) |
{ |
+if (typeof event.wheelDeltaY === "number" && event.wheelDeltaY) { |
const zoomFactor = 1.1; |
const mouseWheelZoomSpeed = 1 / 120; |
-if (typeof event.wheelDeltaY === "number" && event.wheelDeltaY) { |
-var referencePoint = event.offsetX; |
-this._zoom(Math.pow(zoomFactor, -event.wheelDeltaY * mouseWheelZoomSpeed), referencePoint); |
+var reference = event.offsetX / event.target.clientWidth; |
+this._zoom(Math.pow(zoomFactor, -event.wheelDeltaY * mouseWheelZoomSpeed), reference); |
} |
if (typeof event.wheelDeltaX === "number" && event.wheelDeltaX) { |
var offset = Math.round(event.wheelDeltaX * WebInspector.OverviewGrid.WindowScrollSpeedFactor); |
@@ -13997,20 +13919,23 @@ |
}, |
-_zoom: function(factor, referencePoint) |
+_zoom: function(factor, reference) |
{ |
-var left = this._leftResizeElement.offsetLeft + WebInspector.OverviewGrid.ResizerOffset; |
-var right = this._rightResizeElement.offsetLeft + WebInspector.OverviewGrid.ResizerOffset; |
+var left = this.windowLeft; |
+var right = this.windowRight; |
+var windowSize = right - left; |
+var newWindowSize = factor * windowSize; |
+var minWindowSize = WebInspector.OverviewGrid.MinSelectableSize / this._parentElement.clientWidth; |
-var delta = factor * (right - left); |
-if (factor < 1 && delta < WebInspector.OverviewGrid.MinSelectableSize) |
-return; |
-var max = this._parentElement.clientWidth; |
-if (typeof referencePoint !== "number") |
-referencePoint = (right + left) / 2; |
-left = Math.max(0, Math.min(max - delta, referencePoint + (left - referencePoint) * factor)); |
-right = Math.min(max, left + delta); |
-this._setWindowPosition(left, right); |
+newWindowSize = Number.constrain(newWindowSize, minWindowSize, 1); |
+factor = newWindowSize / windowSize; |
+ |
+left = reference + (left - reference) * factor; |
+left = Number.constrain(left, 0, 1 - newWindowSize); |
+ |
+right = reference + (right - reference) * factor; |
+right = Number.constrain(right, newWindowSize, 1); |
+this._setWindow(left, right); |
}, |
__proto__: WebInspector.Object.prototype |
@@ -14102,6 +14027,7 @@ |
if (lineContent.length > 0 && lineContent.charAt(lineContent.length - 1) === "\r") |
lineContent = lineContent.substring(0, lineContent.length - 1) |
+regex.lastIndex = 0; |
if (regex.exec(lineContent)) |
result.push(new WebInspector.ContentProvider.SearchMatch(i, lineContent)); |
} |
@@ -15006,7 +14932,7 @@ |
return; |
} |
if (typeof this._content !== "undefined") { |
-callback(this.content || null, this._contentEncoded, this.type.canonicalMimeType()); |
+callback(this.content || null, this._contentEncoded, this.type.canonicalMimeType() || this._mimeType); |
return; |
} |
this._pendingContentCallbacks.push(callback); |
@@ -15365,9 +15291,8 @@ |
revision._persist(); |
} |
-var oldWorkingCopy = this._workingCopy; |
-delete this._workingCopy; |
-this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyCommitted, {oldWorkingCopy: oldWorkingCopy, workingCopy: this.workingCopy()}); |
+this._innerResetWorkingCopy(); |
+this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyCommitted); |
if (this._url && WebInspector.fileManager.isURLSaved(this._url)) { |
WebInspector.fileManager.save(this._url, this._content, false); |
WebInspector.fileManager.close(this._url); |
@@ -15476,6 +15401,10 @@ |
workingCopy: function() |
{ |
+if (this._workingCopyGetter) { |
+this._workingCopy = this._workingCopyGetter(); |
+delete this._workingCopyGetter; |
+} |
if (this.isDirty()) |
return this._workingCopy; |
return this._content; |
@@ -15483,23 +15412,40 @@ |
resetWorkingCopy: function() |
{ |
-this.setWorkingCopy(this._content); |
+this._innerResetWorkingCopy(); |
+this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyChanged); |
}, |
+_innerResetWorkingCopy: function() |
+{ |
+delete this._workingCopy; |
+delete this._workingCopyGetter; |
+}, |
+ |
setWorkingCopy: function(newWorkingCopy) |
{ |
-var wasDirty = this.isDirty(); |
this._mimeType = this.canonicalMimeType(); |
-var oldWorkingCopy = this._workingCopy; |
-if (this._content === newWorkingCopy) |
-delete this._workingCopy; |
-else |
this._workingCopy = newWorkingCopy; |
-this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyChanged, {oldWorkingCopy: oldWorkingCopy, workingCopy: this.workingCopy(), wasDirty: wasDirty}); |
+delete this._workingCopyGetter; |
+this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyChanged); |
}, |
+setWorkingCopyGetter: function(workingCopyGetter) |
+{ |
+this._workingCopyGetter = workingCopyGetter; |
+this.dispatchEventToListeners(WebInspector.UISourceCode.Events.WorkingCopyChanged); |
+}, |
+removeWorkingCopyGetter: function() |
+{ |
+if (!this._workingCopyGetter) |
+return; |
+this._workingCopy = this._workingCopyGetter(); |
+delete this._workingCopyGetter; |
+}, |
+ |
+ |
commitWorkingCopy: function(callback) |
{ |
if (!this.isDirty()) { |
@@ -15507,7 +15453,7 @@ |
return; |
} |
-this._commitContent(this._workingCopy, true); |
+this._commitContent(this.workingCopy(), true); |
callback(null); |
WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, { |
@@ -15519,7 +15465,7 @@ |
isDirty: function() |
{ |
-return typeof this._workingCopy !== "undefined" && this._workingCopy !== this._content; |
+return typeof this._workingCopy !== "undefined" || typeof this._workingCopyGetter !== "undefined"; |
}, |
@@ -15678,7 +15624,7 @@ |
function formattedChanged(content, formatterMapping) |
{ |
this._content = content; |
-delete this._workingCopy; |
+this._innerResetWorkingCopy(); |
this._formatterMapping = formatterMapping; |
this.dispatchEventToListeners(WebInspector.UISourceCode.Events.FormattedChanged, {content: content}); |
this.updateLiveLocations(); |
@@ -15983,7 +15929,9 @@ |
} |
WebInspector.CSSStyleModel.Events = { |
+StyleSheetAdded: "StyleSheetAdded", |
StyleSheetChanged: "StyleSheetChanged", |
+StyleSheetRemoved: "StyleSheetRemoved", |
MediaQueryResultChanged: "MediaQueryResultChanged", |
NamedFlowCreated: "NamedFlowCreated", |
NamedFlowRemoved: "NamedFlowRemoved", |
@@ -16192,6 +16140,12 @@ |
}, |
+styleSheetHeaders: function() |
+{ |
+return Object.values(this._resourceBinding._styleSheetIdToHeader); |
+}, |
+ |
+ |
_ownerDocumentId: function(nodeId) |
{ |
var node = WebInspector.domAgent.nodeForId(nodeId); |
@@ -16215,6 +16169,22 @@ |
}, |
+_styleSheetAdded: function(header) |
+{ |
+this._resourceBinding._setHeaderForStyleSheetId(header.styleSheetId, header); |
+this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.StyleSheetAdded, header); |
+}, |
+ |
+ |
+_styleSheetRemoved: function(id) |
+{ |
+var header = this._resourceBinding._styleSheetIdToHeader[id]; |
+console.assert(header); |
+this._resourceBinding._setHeaderForStyleSheetId(id, null); |
+this.dispatchEventToListeners(WebInspector.CSSStyleModel.Events.StyleSheetRemoved, header); |
+}, |
+ |
+ |
_namedFlowCreated: function(namedFlowPayload) |
{ |
var namedFlow = WebInspector.NamedFlow.parsePayload(namedFlowPayload); |
@@ -16279,13 +16249,11 @@ |
}, |
-getViaInspectorResourceForRule: function(rule, callback) |
+viaInspectorResourceForRule: function(rule) |
{ |
-if (!rule.id) { |
-callback(null); |
-return; |
-} |
-this._resourceBinding._requestViaInspectorResource(rule.id.styleSheetId, callback); |
+if (!rule.id) |
+return null; |
+return this._resourceBinding._inspectorResource(rule.id.styleSheetId); |
}, |
@@ -16847,6 +16815,42 @@ |
} |
+WebInspector.CSSStyleSheetHeader = function(payload) |
+{ |
+this.id = payload.styleSheetId; |
+this.frameId = payload.frameId; |
+this.sourceURL = payload.sourceURL; |
+this.origin = payload.origin; |
+this.title = payload.title; |
+this.disabled = payload.disabled; |
+} |
+ |
+WebInspector.CSSStyleSheetHeader.prototype = { |
+ |
+resourceURL: function() |
+{ |
+return this.origin === "inspector" ? this._viaInspectorResourceURL() : this.sourceURL; |
+}, |
+ |
+ |
+_key: function() |
+{ |
+return this.frameId + ":" + this.resourceURL(); |
+}, |
+ |
+ |
+_viaInspectorResourceURL: function() |
+{ |
+var parsedURL = new WebInspector.ParsedURL(this.sourceURL); |
+var fakeURL = "inspector://" + parsedURL.host + parsedURL.folderPathComponents; |
+if (!fakeURL.endsWith("/")) |
+fakeURL += "/"; |
+fakeURL += "inspector-stylesheet"; |
+return fakeURL; |
+} |
+} |
+ |
+ |
WebInspector.CSSStyleSheet = function(payload) |
{ |
this.id = payload.styleSheetId; |
@@ -16910,145 +16914,93 @@ |
WebInspector.CSSStyleModelResourceBinding.prototype = { |
-requestStyleSheetIdForResource: function(resource, callback) |
+_setHeaderForStyleSheetId: function(styleSheetId, header) |
{ |
-function innerCallback() |
-{ |
-callback(this._styleSheetIdForResource(resource)); |
+var oldHeader = this._styleSheetIdToHeader[styleSheetId]; |
+if (oldHeader) { |
+delete this._styleSheetIdToHeader[styleSheetId]; |
+delete this._frameAndURLToStyleSheetId[oldHeader._key()]; |
} |
- |
-if (this._styleSheetIdForResource(resource)) |
-innerCallback.call(this); |
+if (header) { |
+var styleSheetHeader = new WebInspector.CSSStyleSheetHeader(header); |
+this._styleSheetIdToHeader[styleSheetId] = styleSheetHeader; |
+if (styleSheetHeader.origin === "inspector") |
+this._createInspectorResource(styleSheetHeader); |
else |
-this._loadStyleSheetHeaders(innerCallback.bind(this)); |
+this._frameAndURLToStyleSheetId[styleSheetHeader._key()] = styleSheetHeader.id; |
+} |
}, |
-requestResourceURLForStyleSheetId: function(styleSheetId, callback) |
+resourceURLForStyleSheetId: function(styleSheetId) |
{ |
-function innerCallback() |
-{ |
var header = this._styleSheetIdToHeader[styleSheetId]; |
-if (!header) { |
-callback(null); |
-return; |
-} |
+if (!header) |
+return null; |
var frame = WebInspector.resourceTreeModel.frameForId(header.frameId); |
-if (!frame) { |
-callback(null); |
-return; |
-} |
+if (!frame) |
+return null; |
-var styleSheetURL = header.origin === "inspector" ? this._viaInspectorResourceURL(header.sourceURL) : header.sourceURL; |
-callback(styleSheetURL); |
-} |
- |
-if (this._styleSheetIdToHeader[styleSheetId]) |
-innerCallback.call(this); |
-else |
-this._loadStyleSheetHeaders(innerCallback.bind(this)); |
+return header.resourceURL(); |
}, |
-_styleSheetIdForResource: function(resource) |
+styleSheetIdForResource: function(resource) |
{ |
-return this._frameAndURLToStyleSheetId[resource.frameId + ":" + resource.url]; |
+return this._frameAndURLToStyleSheetId[resource.frameId + ":" + resource.url] || null; |
}, |
-_loadStyleSheetHeaders: function(callback) |
+_createInspectorResource: function(header) |
{ |
- |
-function didGetAllStyleSheets(error, infos) |
-{ |
-if (error) { |
-callback(error); |
-return; |
-} |
- |
-for (var i = 0; i < infos.length; ++i) { |
-var info = infos[i]; |
-if (info.origin === "inspector") { |
-this._getOrCreateInspectorResource(info); |
-continue; |
-} |
-this._frameAndURLToStyleSheetId[info.frameId + ":" + info.sourceURL] = info.styleSheetId; |
-this._styleSheetIdToHeader[info.styleSheetId] = info; |
-} |
-callback(null); |
-} |
-CSSAgent.getAllStyleSheets(didGetAllStyleSheets.bind(this)); |
-}, |
- |
- |
-_requestViaInspectorResource: function(styleSheetId, callback) |
-{ |
-var header = this._styleSheetIdToHeader[styleSheetId]; |
-if (header) { |
-callback(this._getOrCreateInspectorResource(header)); |
-return; |
-} |
- |
-function headersLoaded() |
-{ |
-var header = this._styleSheetIdToHeader[styleSheetId]; |
-if (header) |
-callback(this._getOrCreateInspectorResource(header)); |
-else |
-callback(null); |
-} |
-this._loadStyleSheetHeaders(headersLoaded.bind(this)); |
-}, |
- |
- |
-_getOrCreateInspectorResource: function(header) |
-{ |
var frame = WebInspector.resourceTreeModel.frameForId(header.frameId); |
if (!frame) |
-return null; |
+return; |
-var viaInspectorURL = this._viaInspectorResourceURL(header.sourceURL); |
-var inspectorResource = frame.resourceForURL(viaInspectorURL); |
-if (inspectorResource) |
-return inspectorResource; |
+var viaInspectorURL = header._viaInspectorResourceURL(); |
+console.assert(!frame.resourceForURL(viaInspectorURL)); |
var resource = frame.resourceForURL(header.sourceURL); |
if (!resource) |
-return null; |
+return; |
-this._frameAndURLToStyleSheetId[header.frameId + ":" + viaInspectorURL] = header.styleSheetId; |
-this._styleSheetIdToHeader[header.styleSheetId] = header; |
-inspectorResource = new WebInspector.Resource(null, viaInspectorURL, resource.documentURL, resource.frameId, resource.loaderId, WebInspector.resourceTypes.Stylesheet, "text/css", true); |
+this._frameAndURLToStyleSheetId[header._key()] = header.id; |
+var inspectorResource = new WebInspector.Resource(null, viaInspectorURL, resource.documentURL, resource.frameId, resource.loaderId, WebInspector.resourceTypes.Stylesheet, "text/css", true); |
+ |
function overrideRequestContent(callback) |
{ |
function callbackWrapper(error, content) |
{ |
callback(error ? "" : content, false, "text/css"); |
} |
-CSSAgent.getStyleSheetText(header.styleSheetId, callbackWrapper); |
+CSSAgent.getStyleSheetText(header.id, callbackWrapper); |
} |
inspectorResource.requestContent = overrideRequestContent; |
frame.addResource(inspectorResource); |
-return inspectorResource; |
}, |
-_viaInspectorResourceURL: function(documentURL) |
+_inspectorResource: function(styleSheetId) |
{ |
-var parsedURL = new WebInspector.ParsedURL(documentURL); |
-var fakeURL = "inspector://" + parsedURL.host + parsedURL.folderPathComponents; |
-if (!fakeURL.endsWith("/")) |
-fakeURL += "/"; |
-fakeURL += "inspector-stylesheet"; |
-return fakeURL; |
+var header = this._styleSheetIdToHeader[styleSheetId]; |
+if (!header) |
+return null; |
+var frame = WebInspector.resourceTreeModel.frameForId(header.frameId); |
+if (!frame) |
+return null; |
+ |
+var viaInspectorURL = header._viaInspectorResourceURL(); |
+return frame.resourceForURL(viaInspectorURL); |
}, |
_reset: function() |
{ |
+ |
this._frameAndURLToStyleSheetId = {}; |
+ |
this._styleSheetIdToHeader = {}; |
} |
} |
@@ -17072,6 +17024,18 @@ |
}, |
+styleSheetAdded: function(header) |
+{ |
+this._cssModel._styleSheetAdded(header); |
+}, |
+ |
+ |
+styleSheetRemoved: function(id) |
+{ |
+this._cssModel._styleSheetRemoved(id); |
+}, |
+ |
+ |
namedFlowCreated: function(namedFlowPayload) |
{ |
this._cssModel._namedFlowCreated(namedFlowPayload); |
@@ -22746,29 +22710,30 @@ |
color: function() |
{ |
-return WebInspector.Color.fromHSVA(this._hsv, this._outputColorFormat()); |
+return WebInspector.Color.fromHSVA(this._hsv); |
}, |
-_outputColorFormat: function() |
+_colorString: function() |
{ |
var cf = WebInspector.Color.Format; |
var format = this._originalFormat; |
+var color = this.color(); |
+var originalFormatString = color.toString(this._originalFormat); |
+if (originalFormatString) |
+return originalFormatString; |
-if (this._hsv[3] === 1) { |
+if (color.hasAlpha()) { |
-if (format === cf.RGBA) |
-format = cf.RGB; |
-else if (format === cf.HSLA) |
-format = cf.HSL; |
-} else { |
- |
-if (format === cf.HSL || format === cf.HSLA) |
-format = cf.HSLA; |
+if (format === cf.HSLA || format === cf.HSL) |
+return color.toString(cf.HSLA); |
else |
-format = cf.RGBA; |
+return color.toString(cf.RGBA); |
} |
-return format; |
+if (format === cf.ShortHEX) |
+return color.toString(cf.HEX); |
+console.assert(format === cf.Nickname); |
+return color.toString(cf.RGB); |
}, |
@@ -22780,7 +22745,7 @@ |
_onchange: function() |
{ |
this._updateUI(); |
-this.dispatchEventToListeners(WebInspector.Spectrum.Events.ColorChanged, this.color()); |
+this.dispatchEventToListeners(WebInspector.Spectrum.Events.ColorChanged, this._colorString()); |
}, |
_updateHelperLocations: function() |
@@ -23146,6 +23111,7 @@ |
"\u2002": "ensp", |
"\u2003": "emsp", |
"\u2009": "thinsp", |
+"\u200a": "#8202", |
"\u200b": "#8203", |
"\u200c": "zwnj", |
"\u200d": "zwj", |
@@ -27677,8 +27643,8 @@ |
WebInspector.Color = function(rgba, format, originalText) |
{ |
this._rgba = rgba; |
-this._originalText = originalText; |
-this._format = format; |
+this._originalText = originalText || null; |
+this._format = format || null; |
if (typeof this._rgba[3] === "undefined") |
this._rgba[3] = 1; |
for (var i = 0; i < 4; ++i) { |
@@ -27777,17 +27743,20 @@ |
} |
-WebInspector.Color.fromHSVA = function(hsva, format) |
+WebInspector.Color.fromHSVA = function(hsva) |
{ |
var h = hsva[0]; |
var s = hsva[1]; |
var v = hsva[2]; |
var t = (2 - s) * v; |
+if (v === 0 || s === 0) |
+s = 0; |
+else |
s *= v / (t < 1 ? t : 2 - t); |
var hsla = [h, s, t / 2, hsva[3]]; |
-return new WebInspector.Color(WebInspector.Color._hsl2rgb(hsla), format); |
+return new WebInspector.Color(WebInspector.Color._hsl2rgb(hsla), WebInspector.Color.Format.HSLA); |
} |
WebInspector.Color.prototype = { |
@@ -27843,24 +27812,23 @@ |
var l = hsla[2]; |
s *= l < 0.5 ? l : 1 - l; |
-return [h, s, (l + s), hsla[3]]; |
+return [h, s !== 0 ? 2 * s / (l + s) : 0, (l + s), hsla[3]]; |
}, |
hasAlpha: function() |
{ |
-if (this._rgba[3] !== 1) |
-return true; |
-return this._format === WebInspector.Color.Format.RGBA || |
-this._format === WebInspector.Color.Format.HSLA; |
+return this._rgba[3] !== 1; |
}, |
canBeShortHex: function() |
{ |
+if (this.hasAlpha()) |
+return false; |
for (var i = 0; i < 3; ++i) { |
var c = Math.round(this._rgba[i] * 255); |
-if ((c >> 4) !== (c & 0xF)) |
+if (c % 17) |
return false; |
} |
return true; |
@@ -27888,25 +27856,33 @@ |
function toShortHexValue(value) |
{ |
-return (Math.round(value * 255) >> 4).toString(16); |
+return (Math.round(value * 255) / 17).toString(16); |
} |
switch (format) { |
case WebInspector.Color.Format.Original: |
return this._originalText; |
case WebInspector.Color.Format.RGB: |
+if (this.hasAlpha()) |
+return null; |
return String.sprintf("rgb(%d, %d, %d)", toRgbValue(this._rgba[0]), toRgbValue(this._rgba[1]), toRgbValue(this._rgba[2])); |
case WebInspector.Color.Format.RGBA: |
return String.sprintf("rgba(%d, %d, %d, %f)", toRgbValue(this._rgba[0]), toRgbValue(this._rgba[1]), toRgbValue(this._rgba[2]), this._rgba[3]); |
case WebInspector.Color.Format.HSL: |
+if (this.hasAlpha()) |
+return null; |
var hsl = this.hsla(); |
return String.sprintf("hsl(%d, %d%, %d%)", Math.round(hsl[0] * 360), Math.round(hsl[1] * 100), Math.round(hsl[2] * 100)); |
case WebInspector.Color.Format.HSLA: |
var hsla = this.hsla(); |
return String.sprintf("hsla(%d, %d%, %d%, %f)", Math.round(hsla[0] * 360), Math.round(hsla[1] * 100), Math.round(hsla[2] * 100), hsla[3]); |
case WebInspector.Color.Format.HEX: |
+if (this.hasAlpha()) |
+return null; |
return String.sprintf("#%s%s%s", toHexValue(this._rgba[0]), toHexValue(this._rgba[1]), toHexValue(this._rgba[2])).toUpperCase(); |
case WebInspector.Color.Format.ShortHEX: |
+if (!this.canBeShortHex()) |
+return null; |
return String.sprintf("#%s%s%s", toShortHexValue(this._rgba[0]), toShortHexValue(this._rgba[1]), toShortHexValue(this._rgba[2])).toUpperCase(); |
case WebInspector.Color.Format.Nickname: |
return this.nickname(); |
@@ -27937,7 +27913,7 @@ |
} |
} |
-return WebInspector.Color._rgbaToNickname[this._canonicalRGBA()]; |
+return WebInspector.Color._rgbaToNickname[this._canonicalRGBA()] || null; |
}, |
@@ -28175,7 +28151,8 @@ |
Border: WebInspector.Color.fromRGBA([255, 229, 153, .66]), |
BorderLight: WebInspector.Color.fromRGBA([255, 229, 153, .5]), |
Margin: WebInspector.Color.fromRGBA([246, 178, 107, .66]), |
-MarginLight: WebInspector.Color.fromRGBA([246, 178, 107, .5]) |
+MarginLight: WebInspector.Color.fromRGBA([246, 178, 107, .5]), |
+EventTarget: WebInspector.Color.fromRGBA([255, 196, 196, .66]) |
} |
WebInspector.Color.Format = { |
@@ -29132,6 +29109,27 @@ |
} |
+WebInspector.StatusBarText = function(text, className) |
+{ |
+WebInspector.StatusBarItem.call(this, document.createElement("span")); |
+this.element.className = "status-bar-item status-bar-text"; |
+if (className) |
+this.element.addStyleClass(className); |
+this.element.textContent = text; |
+} |
+ |
+WebInspector.StatusBarText.prototype = { |
+ |
+setText: function(text) |
+{ |
+this.element.textContent = text; |
+}, |
+ |
+__proto__: WebInspector.StatusBarItem.prototype |
+} |
+ |
+ |
+ |
WebInspector.StatusBarButton = function(title, className, states) |
{ |
WebInspector.StatusBarItem.call(this, document.createElement("button")); |
@@ -29164,8 +29162,8 @@ |
_clicked: function() |
{ |
this.dispatchEventToListeners("click"); |
-if (this._showOptionsTimer) |
-clearTimeout(this._showOptionsTimer); |
+if (this._longClickInterval) |
+clearInterval(this._longClickInterval); |
}, |
@@ -29235,38 +29233,54 @@ |
this._visible = x; |
}, |
- |
-makeLongClickEnabled: function(buttonsProvider) |
+makeLongClickEnabled: function() |
{ |
-this.longClickGlyph = document.createElement("div"); |
-this.longClickGlyph.className = "fill long-click-glyph"; |
-this.element.appendChild(this.longClickGlyph); |
- |
-this.longClickGlyphShadow = document.createElement("div"); |
-this.longClickGlyphShadow.className = "fill long-click-glyph shadow"; |
-this.element.appendChild(this.longClickGlyphShadow); |
- |
this.element.addEventListener("mousedown", mouseDown.bind(this), false); |
this.element.addEventListener("mouseout", mouseUp.bind(this), false); |
this.element.addEventListener("mouseup", mouseUp.bind(this), false); |
+var longClicks = 0; |
+ |
function mouseDown(e) |
{ |
if (e.which !== 1) |
return; |
-this._showOptionsTimer = setTimeout(this._showOptions.bind(this, buttonsProvider), 200); |
+longClicks = 0; |
+this._longClickInterval = setInterval(longClicked.bind(this), 200); |
} |
function mouseUp(e) |
{ |
if (e.which !== 1) |
return; |
-if (this._showOptionsTimer) |
-clearTimeout(this._showOptionsTimer); |
+if (this._longClickInterval) |
+clearInterval(this._longClickInterval); |
} |
+ |
+function longClicked() |
+{ |
+++longClicks; |
+this.dispatchEventToListeners(longClicks === 1 ? "longClickDown" : "longClickPress"); |
+} |
}, |
+makeLongClickOptionsEnabled: function(buttonsProvider) |
+{ |
+this.makeLongClickEnabled(); |
+ |
+this.longClickGlyph = document.createElement("div"); |
+this.longClickGlyph.className = "fill long-click-glyph"; |
+this.element.appendChild(this.longClickGlyph); |
+ |
+this.longClickGlyphShadow = document.createElement("div"); |
+this.longClickGlyphShadow.className = "fill long-click-glyph shadow"; |
+this.element.appendChild(this.longClickGlyphShadow); |
+ |
+this.addEventListener("longClickDown", this._showOptions.bind(this, buttonsProvider), this); |
+}, |
+ |
+ |
_showOptions: function(buttonsProvider) |
{ |
var buttons = buttonsProvider(); |
@@ -29317,10 +29331,13 @@ |
document.documentElement.removeEventListener("mouseup", mouseUpListener, false); |
for (var i = 0; i < buttons.length; ++i) { |
-if (buttons[i].element.hasStyleClass("emulate-active")) |
+if (buttons[i].element.hasStyleClass("emulate-active")) { |
+buttons[i].element.removeStyleClass("emulate-active"); |
buttons[i]._clicked(); |
+break; |
} |
} |
+} |
}, |
__proto__: WebInspector.StatusBarItem.prototype |
@@ -29333,6 +29350,7 @@ |
this.element.className = "status-bar-select-container"; |
this._selectElement = this.element.createChild("select", "status-bar-item"); |
+this.element.createChild("div", "status-bar-select-arrow"); |
if (changeHandler) |
this._selectElement.addEventListener("change", changeHandler, false); |
if (className) |
@@ -29395,6 +29413,18 @@ |
this._selectElement.selectedIndex = Array.prototype.indexOf.call(this._selectElement, option); |
}, |
+ |
+setSelectedIndex: function(index) |
+{ |
+this._selectElement.selectedIndex = index; |
+}, |
+ |
+ |
+selectedIndex: function() |
+{ |
+return this._selectElement.selectedIndex; |
+}, |
+ |
__proto__: WebInspector.StatusBarItem.prototype |
} |
@@ -29414,6 +29444,11 @@ |
WebInspector.TextEditor.prototype = { |
+undo: function() { }, |
+ |
+redo: function() { }, |
+ |
+ |
isClean: function() { }, |
markClean: function() { }, |
@@ -29636,6 +29671,17 @@ |
WebInspector.DefaultTextEditor.prototype = { |
+undo: function() |
+{ |
+this._mainPanel.undo(); |
+}, |
+ |
+redo: function() |
+{ |
+this._mainPanel.redo(); |
+}, |
+ |
+ |
isClean: function() |
{ |
return this._textModel.isClean(); |
@@ -30877,6 +30923,9 @@ |
_handleKeyPress: function(event) |
{ |
+if (event.target.enclosingNodeOrSelfWithClass("webkit-line-decorations")) |
+return; |
+ |
var char = String.fromCharCode(event.which); |
var handler = this._charOverrides[char]; |
if (handler && handler()) { |
@@ -31160,7 +31209,17 @@ |
this._cachedRows = []; |
}, |
+undo: function() |
+{ |
+this._handleUndoRedo(false); |
+}, |
+redo: function() |
+{ |
+this._handleUndoRedo(true); |
+}, |
+ |
+ |
_handleUndoRedo: function(redo) |
{ |
if (this.readOnly()) |
@@ -32682,9 +32741,6 @@ |
registerShortcuts: function(shortcuts) |
{ |
-if (!WebInspector.experimentsSettings.textEditorSmartBraces.isEnabled()) |
-return; |
- |
var keys = WebInspector.KeyboardShortcut.Keys; |
var modifiers = WebInspector.KeyboardShortcut.Modifiers; |
@@ -32694,8 +32750,6 @@ |
registerCharOverrides: function(charOverrides) |
{ |
-if (!WebInspector.experimentsSettings.textEditorSmartBraces.isEnabled()) |
-return; |
charOverrides["("] = this._handleBracePairInsertion.bind(this, "()"); |
charOverrides[")"] = this._handleClosingBraceOverride.bind(this, ")"); |
charOverrides["{"] = this._handleBracePairInsertion.bind(this, "{}"); |
@@ -32785,11 +32839,8 @@ |
var textEditorDelegate = new WebInspector.TextEditorDelegateForSourceFrame(this); |
-if (WebInspector.experimentsSettings.codemirror.isEnabled()) { |
loadScript("CodeMirrorTextEditor.js"); |
this._textEditor = new WebInspector.CodeMirrorTextEditor(this._url, textEditorDelegate); |
-} else |
-this._textEditor = new WebInspector.DefaultTextEditor(this._url, textEditorDelegate); |
this._currentSearchResultIndex = -1; |
this._searchResults = []; |
@@ -32804,8 +32855,7 @@ |
this._shortcuts[WebInspector.KeyboardShortcut.makeKey("s", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta)] = this._commitEditing.bind(this); |
this.element.addEventListener("keydown", this._handleKeyDown.bind(this), false); |
-this._sourcePositionElement = document.createElement("div"); |
-this._sourcePositionElement.className = "source-frame-cursor-position"; |
+this._sourcePosition = new WebInspector.StatusBarText("", "source-frame-cursor-position"); |
} |
@@ -32860,7 +32910,7 @@ |
statusBarText: function() |
{ |
-return this._sourcePositionElement; |
+return this._sourcePosition.element; |
}, |
@@ -33027,14 +33077,26 @@ |
this.clearMessages(); |
}, |
+_simplifyMimeType: function(mimeType) |
+{ |
+if (!mimeType) |
+return ""; |
+if (mimeType.indexOf("javascript") >= 0 || |
+mimeType.indexOf("jscript") >= 0 || |
+mimeType.indexOf("ecmascript") >= 0) |
+return "text/javascript"; |
+return mimeType; |
+}, |
+ |
setContent: function(content, contentEncoded, mimeType) |
{ |
-this._textEditor.mimeType = mimeType; |
+this._textEditor.mimeType = this._simplifyMimeType(mimeType); |
if (!this._loaded) { |
this._loaded = true; |
this._textEditor.setText(content || ""); |
+this._textEditor.markClean(); |
} else |
this._textEditor.editRange(this._textEditor.range(), content || ""); |
@@ -33252,15 +33314,15 @@ |
this._textEditor.addDecoration(lineNumber, messageBubbleElement); |
} |
-var imageURL; |
+var imageElement = document.createElement("div"); |
switch (msg.level) { |
case WebInspector.ConsoleMessage.MessageLevel.Error: |
messageBubbleElement.addStyleClass("webkit-html-error-message"); |
-imageURL = "Images/errorIcon.png"; |
+imageElement.className = "error-icon-small"; |
break; |
case WebInspector.ConsoleMessage.MessageLevel.Warning: |
messageBubbleElement.addStyleClass("webkit-html-warning-message"); |
-imageURL = "Images/warningIcon.png"; |
+imageElement.className = "warning-icon-small"; |
break; |
} |
@@ -33269,10 +33331,7 @@ |
messageBubbleElement.appendChild(messageLineElement); |
-var image = document.createElement("img"); |
-image.src = imageURL; |
-image.className = "webkit-html-message-icon"; |
-messageLineElement.appendChild(image); |
+messageLineElement.appendChild(imageElement); |
messageLineElement.appendChild(document.createTextNode(msg.message)); |
rowMessage.element = messageLineElement; |
@@ -33361,16 +33420,16 @@ |
return; |
if (textRange.isEmpty()) { |
-this._sourcePositionElement.textContent = WebInspector.UIString("Line %d, Column %d", textRange.endLine + 1, textRange.endColumn + 1); |
+this._sourcePosition.setText(WebInspector.UIString("Line %d, Column %d", textRange.endLine + 1, textRange.endColumn + 1)); |
return; |
} |
textRange = textRange.normalize(); |
var selectedText = this._textEditor.copyRange(textRange); |
if (textRange.startLine === textRange.endLine) |
-this._sourcePositionElement.textContent = WebInspector.UIString("%d characters selected", selectedText.length); |
+this._sourcePosition.setText(WebInspector.UIString("%d characters selected", selectedText.length)); |
else |
-this._sourcePositionElement.textContent = WebInspector.UIString("%d lines, %d characters selected", textRange.endLine - textRange.startLine + 1, selectedText.length); |
+this._sourcePosition.setText(WebInspector.UIString("%d lines, %d characters selected", textRange.endLine - textRange.startLine + 1, selectedText.length)); |
}, |
@@ -33515,10 +33574,37 @@ |
} |
+WebInspector.ResourceSourceFrameFallback = function(resource) |
+{ |
+WebInspector.View.call(this); |
+this._resource = resource; |
+this.element.addStyleClass("fill"); |
+this.element.addStyleClass("script-view"); |
+this._content = this.element.createChild("div", "script-view-fallback monospace"); |
+} |
+WebInspector.ResourceSourceFrameFallback.prototype = { |
+wasShown: function() |
+{ |
+if (!this._contentRequested) { |
+this._contentRequested = true; |
+this._resource.requestContent(this._contentLoaded.bind(this)); |
+} |
+}, |
+_contentLoaded: function(content, contentEncoded, mimeType) |
+{ |
+this._content.textContent = content; |
+}, |
+__proto__: WebInspector.View.prototype |
+} |
+ |
+ |
+ |
+ |
+ |
WebInspector.FontView = function(resource) |
{ |
WebInspector.ResourceView.call(this, resource); |
@@ -36777,12 +36863,14 @@ |
WebInspector.TextEditorModel.prototype = { |
-isClean: function() { |
-return !this._undoStack.length; |
+isClean: function() |
+{ |
+return this._cleanState === this._undoStack.length; |
}, |
-markClean: function() { |
-this._resetUndoStack(); |
+markClean: function() |
+{ |
+this._cleanState = this._undoStack.length; |
}, |
@@ -37037,8 +37125,11 @@ |
if (this._inUndo) |
this._redoStack.push(command); |
else { |
-if (!this._inRedo) |
+if (!this._inRedo) { |
this._redoStack = []; |
+if (typeof this._cleanState === "number" && this._cleanState > this._undoStack.length) |
+delete this._cleanState; |
+} |
this._undoStack.push(command); |
} |
return command; |
@@ -37102,7 +37193,9 @@ |
_resetUndoStack: function() |
{ |
+delete this._cleanState; |
this._undoStack = []; |
+this._redoStack = []; |
}, |
@@ -43940,7 +44033,10 @@ |
var originalToCanonicalURLMap = {}; |
for (var i = 0; i < map.sources.length; ++i) { |
var originalSourceURL = map.sources[i]; |
-var href = (map.sourceRoot ? map.sourceRoot + "/" : "") + originalSourceURL; |
+var sourceRoot = map.sourceRoot || ""; |
+if (sourceRoot && !sourceRoot.endsWith("/")) |
+sourceRoot += "/"; |
+var href = sourceRoot + originalSourceURL; |
var url = WebInspector.ParsedURL.completeURL(this._sourceMappingURL, href) || href; |
originalToCanonicalURLMap[originalSourceURL] = url; |
sources.push(url); |
@@ -44426,7 +44522,7 @@ |
var script = (event.data); |
this._defaultMapping.addScript(script); |
-if (WebInspector.experimentsSettings.snippetsSupport.isEnabled() && script.isSnippet()) { |
+if (script.isSnippet()) { |
this._snippetMapping.addScript(script); |
return; |
} |
@@ -44573,6 +44669,7 @@ |
} |
WebInspector.FileSystemProjectDelegate._scriptExtensions = ["js", "java", "cc", "cpp", "h", "cs", "py", "php"].keySet(); |
+WebInspector.FileSystemProjectDelegate._styleSheetExtensions = ["css", "scss", "sass"].keySet(); |
WebInspector.FileSystemProjectDelegate.projectId = function(fileSystemPath) |
{ |
@@ -44660,13 +44757,13 @@ |
var extensionIndex = fileName.lastIndexOf("."); |
var extension = ""; |
if (extensionIndex !== -1) |
-extension = fileName.substring(extensionIndex + 1); |
+extension = fileName.substring(extensionIndex + 1).toLowerCase(); |
var contentType = WebInspector.resourceTypes.Other; |
if (WebInspector.FileSystemProjectDelegate._scriptExtensions[extension]) |
return WebInspector.resourceTypes.Script; |
-if (extension === "css") |
+if (WebInspector.FileSystemProjectDelegate._styleSheetExtensions[extension]) |
return WebInspector.resourceTypes.Stylesheet; |
-if (extension === "html") |
+if (extension === "html" || extension === "htm") |
return WebInspector.resourceTypes.Document; |
return WebInspector.resourceTypes.Other; |
}, |
@@ -46169,7 +46266,6 @@ |
for (var j = 0; j < breakpoints.length; ++j) { |
var breakpoint = breakpoints[j]; |
this._breakpoints.remove(breakpoint); |
-delete breakpoint._primaryUILocation; |
} |
var sourceFileId = WebInspector.BreakpointManager.sourceFileId(uiSourceCode); |
@@ -47435,14 +47531,10 @@ |
if (isAddingRevision) |
return; |
-this._cssModel.resourceBinding().requestResourceURLForStyleSheetId(event.data.styleSheetId, callback.bind(this)); |
- |
-function callback(url) |
-{ |
+var url = this._cssModel.resourceBinding().resourceURLForStyleSheetId(event.data.styleSheetId); |
if (!url) |
return; |
this._cssModel.setSourceMapping(url, null); |
-} |
}, |
@@ -48296,7 +48388,8 @@ |
ChildNodeCountUpdated: "ChildNodeCountUpdated", |
InspectElementRequested: "InspectElementRequested", |
UndoRedoRequested: "UndoRedoRequested", |
-UndoRedoCompleted: "UndoRedoCompleted" |
+UndoRedoCompleted: "UndoRedoCompleted", |
+InspectNodeRequested: "InspectNodeRequested" |
} |
WebInspector.DOMAgent.prototype = { |
@@ -48540,6 +48633,12 @@ |
}, |
+_inspectNodeRequested: function(nodeId) |
+{ |
+this.dispatchEventToListeners(WebInspector.DOMAgent.Events.InspectNodeRequested, nodeId); |
+}, |
+ |
+ |
performSearch: function(query, searchCallback) |
{ |
this.cancelSearch(); |
@@ -48626,7 +48725,8 @@ |
setInspectModeEnabled: function(enabled, callback) |
{ |
-DOMAgent.setInspectModeEnabled(enabled, this._buildHighlightConfig(), callback); |
+var callbackCast = (callback); |
+this._dispatchWhenDocumentAvailable(DOMAgent.setInspectModeEnabled.bind(DOMAgent, enabled, this._buildHighlightConfig()), callbackCast); |
}, |
@@ -48646,6 +48746,9 @@ |
if (mode === "all" || mode === "margin") |
highlightConfig.marginColor = WebInspector.Color.PageHighlight.Margin.toProtocolRGBA(); |
+if (mode === "all") |
+highlightConfig.eventTargetColor = WebInspector.Color.PageHighlight.EventTarget.toProtocolRGBA(); |
+ |
return highlightConfig; |
}, |
@@ -48745,6 +48848,12 @@ |
}, |
+inspectNodeRequested: function(nodeId) |
+{ |
+this._domAgent._inspectNodeRequested(nodeId); |
+}, |
+ |
+ |
attributeModified: function(nodeId, name, value) |
{ |
this._domAgent._attributeModified(nodeId, name, value); |
@@ -49207,6 +49316,8 @@ |
this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Overrides, WebInspector.UIString("Overrides"), new WebInspector.OverridesSettingsTab()); |
if (WebInspector.experimentsSettings.fileSystemProject.isEnabled()) |
this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Workspace, WebInspector.UIString("Workspace"), new WebInspector.WorkspaceSettingsTab()); |
+if (WebInspector.experimentsSettings.tethering.isEnabled()) |
+this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Tethering, WebInspector.UIString("Port forwarding"), new WebInspector.TetheringSettingsTab()); |
if (WebInspector.experimentsSettings.experimentsEnabled) |
this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Experiments, WebInspector.UIString("Experiments"), new WebInspector.ExperimentsSettingsTab()); |
this._tabbedPane.appendTab(WebInspector.SettingsScreen.Tabs.Shortcuts, WebInspector.UIString("Shortcuts"), WebInspector.shortcutsScreen.createShortcutsTabView()); |
@@ -49222,6 +49333,7 @@ |
General: "general", |
Overrides: "overrides", |
Workspace: "workspace", |
+Tethering: "tethering", |
Experiments: "experiments", |
Shortcuts: "shortcuts" |
} |
@@ -49422,7 +49534,7 @@ |
WebInspector.GenericSettingsTab = function() |
{ |
-WebInspector.SettingsTab.call(this, WebInspector.UIString("General")); |
+WebInspector.SettingsTab.call(this, WebInspector.UIString("General"), "general-tab-content"); |
var p = this._appendSection(); |
p.appendChild(this._createCheckboxSetting(WebInspector.UIString("Disable cache (while DevTools is open)"), WebInspector.settings.cacheDisabled)); |
@@ -49501,6 +49613,10 @@ |
p = this._appendSection(WebInspector.UIString("Extensions")); |
p.appendChild(this._createCustomSetting(WebInspector.UIString("Open links in"), handlerSelector.element)); |
} |
+ |
+p = this._appendSection(); |
+var panelShortcutTitle = WebInspector.UIString("Enable %s + 1-9 shortcut to switch panels", WebInspector.isMac() ? "Cmd" : "Ctrl"); |
+p.appendChild(this._createCheckboxSetting(panelShortcutTitle, WebInspector.settings.shortcutPanelSwitch)); |
} |
WebInspector.GenericSettingsTab.prototype = { |
@@ -49791,6 +49907,127 @@ |
} |
+WebInspector.TetheringSettingsTab = function() |
+{ |
+WebInspector.SettingsTab.call(this, WebInspector.UIString("Port Forwarding"), "workspace-tab-content"); |
+} |
+ |
+WebInspector.TetheringSettingsTab.prototype = { |
+wasShown: function() |
+{ |
+if (this._paragraphElement) |
+return; |
+ |
+this._paragraphElement = this._appendSection(WebInspector.UIString("Mappings")); |
+WebInspector.SettingsTab.prototype.wasShown.call(this); |
+var mappingEntries = WebInspector.settings.portForwardings.get(); |
+for (var i = 0; i < mappingEntries.length; ++i) |
+this._addMappingRow(mappingEntries[i].port, mappingEntries[i].location, false); |
+if (!mappingEntries.length) |
+this._addMappingRow("", "", true); |
+this._save(); |
+}, |
+ |
+ |
+_addMappingRow: function(port, location, focus) |
+{ |
+var mappingRow = this._paragraphElement.createChild("div", "workspace-settings-row"); |
+var portElement = mappingRow.createChild("input"); |
+portElement.type = "text"; |
+portElement.value = port || ""; |
+if (!port) |
+portElement.placeholder = "8080"; |
+portElement.addEventListener("keydown", this._editTextInputKey.bind(this, true), true); |
+portElement.addEventListener("blur", this._save.bind(this), true); |
+portElement.addEventListener("input", this._validatePort.bind(this, portElement), true); |
+ |
+var locationElement = mappingRow.createChild("input"); |
+locationElement.type = "text"; |
+locationElement.value = location || "127.0.0.1:"; |
+locationElement.addEventListener("keydown", this._editTextInputKey.bind(this, false), true); |
+locationElement.addEventListener("blur", this._save.bind(this), true); |
+locationElement.addEventListener("input", this._validateLocation.bind(this, locationElement), true); |
+ |
+var removeButton = mappingRow.createChild("button", "button remove-button"); |
+removeButton.value = WebInspector.UIString("Remove"); |
+removeButton.tabIndex = -1; |
+removeButton.addEventListener("click", removeMappingClicked.bind(this), false); |
+ |
+function removeMappingClicked() |
+{ |
+mappingRow.removeSelf(); |
+if (!this._paragraphElement.querySelector(".workspace-settings-row")) |
+this._addMappingRow(); |
+this._save(); |
+} |
+if (focus) |
+setTimeout(function() { portElement.focus(); }, 0); |
+return mappingRow; |
+}, |
+ |
+_save: function() |
+{ |
+var portForwardings = []; |
+for (var rowElement = this._paragraphElement.firstChild.nextSibling; rowElement; rowElement = rowElement.nextSibling) { |
+var portElement = rowElement.firstChild; |
+var locationElement = portElement.nextSibling; |
+var port = this._validatePort(portElement); |
+var location = this._validateLocation(locationElement); |
+if (!port || !location) |
+continue; |
+portForwardings.push({ port : parseInt(port, 10), location : location }); |
+} |
+WebInspector.settings.portForwardings.set(portForwardings); |
+}, |
+ |
+ |
+_editTextInputKey: function(isPort, event) |
+{ |
+if (!WebInspector.KeyboardShortcut.hasNoModifiers( (event))) |
+return; |
+ |
+if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Enter.code || |
+event.keyCode === WebInspector.KeyboardShortcut.Keys.Tab.code) { |
+if (isPort) |
+event.target.nextElementSibling.focus(); |
+else { |
+if (event.target.parentElement.nextSibling) |
+event.target.parentElement.nextSibling.firstChild.focus(); |
+else |
+this._addMappingRow("", "", true); |
+} |
+event.consume(true); |
+} |
+}, |
+ |
+ |
+_validatePort: function(element, event) |
+{ |
+var port = element.value; |
+if (isNaN(port) || port < 5000 || port > 10000) { |
+element.addStyleClass("workspace-settings-error"); |
+return 0; |
+} |
+element.removeStyleClass("workspace-settings-error"); |
+return parseInt(port, 10); |
+}, |
+ |
+ |
+_validateLocation: function(element, event) |
+{ |
+var location = element.value; |
+if (!/.*:\d+/.test(location)) { |
+element.addStyleClass("workspace-settings-error"); |
+return ""; |
+} |
+element.removeStyleClass("workspace-settings-error"); |
+return location; |
+}, |
+ |
+__proto__: WebInspector.SettingsTab.prototype |
+} |
+ |
+ |
WebInspector.ExperimentsSettingsTab = function() |
{ |
WebInspector.SettingsTab.call(this, WebInspector.UIString("Experiments"), "experiments-tab-content"); |
@@ -51346,23 +51583,22 @@ |
panelDescriptor._toolbarElement = this._createPanelToolbarItem(panelDescriptor); |
if (!this._isToolbarCustomizable() || this._isPanelVisible(panelDescriptor.name())) |
this.element.insertBefore(panelDescriptor._toolbarElement, this._panelInsertLocation(panelDescriptor)); |
-this._updateAddPanelState(); |
+this._updatePanelsMenuState(); |
this.resize(); |
}, |
_panelInsertLocation: function(panelDescriptor) |
{ |
-var newPanelElement = document.getElementById("toolbar-panels-menu").parentElement; |
if (!this._isToolbarCustomizable()) |
-return newPanelElement; |
+return null; |
if (this._isDefaultPanel(panelDescriptor.name())) |
-return this._firstNonDefaultPanel || newPanelElement; |
+return this._firstNonDefaultPanel || null; |
if (!this._firstNonDefaultPanel) |
this._firstNonDefaultPanel = panelDescriptor._toolbarElement; |
-return newPanelElement; |
+return null; |
}, |
@@ -51441,27 +51677,34 @@ |
} |
} |
} |
-document.getElementById("toolbar-panels-menu").removeStyleClass("disabled"); |
+this._updatePanelsMenuState(); |
this.resize(); |
}, |
-_updateAddPanelState: function() |
+_updatePanelsMenuState: function() |
{ |
-if (this._panelDescriptors.every(function (descr) { return this._isPanelVisible(descr.name()); }, this)) |
+if (this._panelDescriptors.every(function (descr) { return this._isPanelVisible(descr.name()); }, this) && this._allItemsFitOntoToolbar()) |
document.getElementById("toolbar-panels-menu").addStyleClass("disabled"); |
else |
document.getElementById("toolbar-panels-menu").removeStyleClass("disabled"); |
}, |
+_allItemsFitOntoToolbar: function() |
+{ |
+var toolbarItems = this.element.querySelectorAll(".toolbar-item.toggleable"); |
+return toolbarItems.length === 0 || this.element.scrollHeight < toolbarItems[0].offsetHeight * 2; |
+}, |
+ |
+ |
_showPanel: function(panelDescriptor) |
{ |
if (this._isPanelVisible(panelDescriptor.name())) |
return; |
-this.element.insertBefore(panelDescriptor._toolbarElement, document.getElementById("toolbar-panels-menu").parentElement); |
+this.element.appendChild(panelDescriptor._toolbarElement); |
panelDescriptor._toolbarElement.removeStyleClass("hidden"); |
this._setPanelVisible(panelDescriptor.name(), true); |
-this._updateAddPanelState(); |
+this._updatePanelsMenuState(); |
this.resize(); |
}, |
@@ -51509,8 +51752,7 @@ |
var iconElement = toolbarItem.createChild("div", "toolbar-icon"); |
toolbarItem.createChild("div", "toolbar-label").textContent = panelDescriptor.title(); |
if (this._isToolbarCustomizable() && !this._isDefaultPanel(panelDescriptor.name()) && !noCloseButton) { |
-var closeButton = toolbarItem.createChild("div", "toolbar-item-close-button"); |
-closeButton.textContent = "\u00d7"; |
+var closeButton = toolbarItem.createChild("div", "close-button"); |
closeButton.addEventListener("click", onToolbarItemCloseButtonClicked.bind(this), false); |
} |
if (panelDescriptor.iconURL()) { |
@@ -51634,6 +51876,18 @@ |
} |
var contextMenu = new WebInspector.ContextMenu(event); |
+var currentPanelName = WebInspector.inspectorView.currentPanel().name; |
+var toolbarItems = this.element.querySelectorAll(".toolbar-item.toggleable"); |
+for (var i = 0; i < toolbarItems.length; ++i) { |
+if (toolbarItems[i].offsetTop >= toolbarItems[0].offsetHeight) { |
+var descr = toolbarItems[i].panelDescriptor; |
+if (descr.name() === currentPanelName) |
+contextMenu.appendCheckboxItem(descr.title(), activatePanel.bind(this, descr), true); |
+else |
+contextMenu.appendItem(descr.title(), activatePanel.bind(this, descr)); |
+} |
+} |
+contextMenu.appendSeparator(); |
for (var i = 0; i < this._panelDescriptors.length; ++i) { |
var descr = this._panelDescriptors[i]; |
if (this._isPanelVisible(descr.name())) |
@@ -51651,6 +51905,10 @@ |
_innerUpdateDropdownButtonAndHideDropdown: function() |
{ |
+if (this._isToolbarCustomizable()) { |
+this._updatePanelsMenuState(); |
+return; |
+} |
this._setDropdownVisible(false); |
if (this.element.scrollHeight > this.element.offsetHeight) |
@@ -54083,23 +54341,12 @@ |
return; |
} |
-this._cssModel.resourceBinding().requestStyleSheetIdForResource(resource, callback.bind(this)); |
- |
- |
-function callback(styleSheetId) |
-{ |
+var styleSheetId = this._cssModel.resourceBinding().styleSheetIdForResource(resource); |
if (!styleSheetId) { |
userCallback("No stylesheet found: " + resource.frameId + ":" + resource.url); |
return; |
} |
-this._innerSetContent(styleSheetId, content, majorChange, userCallback, null); |
-} |
-}, |
- |
- |
-_innerSetContent: function(styleSheetId, content, majorChange, userCallback) |
-{ |
this._isSettingContent = true; |
function callback(error) |
{ |
@@ -54130,22 +54377,17 @@ |
_innerStyleSheetChanged: function(styleSheetId, content) |
{ |
- |
-function callback(styleSheetURL) |
-{ |
+var styleSheetURL = this._cssModel.resourceBinding().resourceURLForStyleSheetId(styleSheetId); |
if (typeof styleSheetURL !== "string") |
return; |
-var uiSourceCode = this._workspace.uiSourceCodeForURL(styleSheetURL); |
+var uiSourceCode = this._workspace.uiSourceCodeForURL(styleSheetURL) |
if (!uiSourceCode) |
return; |
if (uiSourceCode.styleFile()) |
uiSourceCode.styleFile().addRevision(content); |
} |
- |
-this._cssModel.resourceBinding().requestResourceURLForStyleSheetId(styleSheetId, callback.bind(this)); |
-}, |
} |
@@ -54188,10 +54430,8 @@ |
_parsedScriptSource: function(event) |
{ |
var script = (event.data); |
-if (!script.sourceURL || script.isInlineScript()) |
+if (!script.sourceURL || script.isInlineScript() || script.isSnippet()) |
return; |
-if (WebInspector.experimentsSettings.snippetsSupport.isEnabled() && script.isSnippet()) |
-return; |
var isDynamicAnonymousScript; |
@@ -54417,9 +54657,21 @@ |
} |
WebInspector.ProfilesPanelDescriptor.prototype = { |
+registerShortcuts: function() |
+{ |
+var section = WebInspector.shortcutsScreen.section(WebInspector.UIString("Profiles Panel")); |
+section.addAlternateKeys(WebInspector.ProfilesPanelDescriptor.ShortcutKeys.StartStopRecording, WebInspector.UIString("Start/stop recording")); |
+}, |
+ |
__proto__: WebInspector.PanelDescriptor.prototype |
} |
+WebInspector.ProfilesPanelDescriptor.ShortcutKeys = { |
+StartStopRecording: [ |
+WebInspector.KeyboardShortcut.makeDescriptor("e", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) |
+] |
+} |
+ |
WebInspector.ProfilesPanelDescriptor.ProfileURLRegExp = /webkit-profile:\/\/(.+)\/(.+)/; |
WebInspector.ProfilesPanelDescriptor.UserInitiatedProfileName = "org.webkit.profiles.user-initiated"; |
@@ -54523,6 +54775,10 @@ |
} |
WebInspector.ScriptsPanelDescriptor.ShortcutKeys = { |
+RunSnippet: [ |
+WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Enter, WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) |
+], |
+ |
PauseContinue: [ |
WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F8), |
WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Slash, WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta) |
@@ -54611,7 +54867,7 @@ |
this._dockToggleButtonOption = new WebInspector.StatusBarButton("", "dock-status-bar-item", 3); |
this._dockToggleButton.addEventListener("click", this._toggleDockState, this); |
this._dockToggleButtonOption.addEventListener("click", this._toggleDockState, this); |
-this._dockToggleButton.makeLongClickEnabled(this._createDockOptions.bind(this)); |
+this._dockToggleButton.makeLongClickOptionsEnabled(this._createDockOptions.bind(this)); |
this.setDockSide(WebInspector.queryParamsObject["dockSide"] || "bottom"); |
WebInspector.settings.showToolbarIcons.addChangeListener(this._updateUI.bind(this)); |