diff options
Diffstat (limited to 'WebCore/page/inspector')
146 files changed, 0 insertions, 10574 deletions
diff --git a/WebCore/page/inspector/ConsolePanel.js b/WebCore/page/inspector/ConsolePanel.js deleted file mode 100644 index 57bf331..0000000 --- a/WebCore/page/inspector/ConsolePanel.js +++ /dev/null @@ -1,459 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.ConsolePanel = function() -{ - WebInspector.Panel.call(this); - - this.messages = []; - - this.commandHistory = []; - this.commandOffset = 0; - - this.messageList = document.createElement("ol"); - this.messageList.className = "console-message-list"; - this.element.appendChild(this.messageList); - - this.messageList.addEventListener("click", this.messageListClicked.bind(this), true); - - this.consolePrompt = document.createElement("textarea"); - this.consolePrompt.className = "console-prompt"; - this.element.appendChild(this.consolePrompt); - - this.consolePrompt.addEventListener("keydown", this.promptKeyDown.bind(this), false); - - var clearButtonText = WebInspector.UIString("Clear"); - this.clearMessagesElement = document.createElement("button"); - this.clearMessagesElement.appendChild(document.createTextNode(clearButtonText)); - this.clearMessagesElement.title = clearButtonText; - this.clearMessagesElement.addEventListener("click", this.clearButtonClicked.bind(this), false); -} - -WebInspector.ConsolePanel.prototype = { - show: function() - { - WebInspector.Panel.prototype.show.call(this); - WebInspector.consoleListItem.select(); - - this.clearMessagesElement.removeStyleClass("hidden"); - if (!this.clearMessagesElement.parentNode) - document.getElementById("toolbarButtons").appendChild(this.clearMessagesElement); - }, - - hide: function() - { - WebInspector.Panel.prototype.hide.call(this); - WebInspector.consoleListItem.deselect(); - this.clearMessagesElement.addStyleClass("hidden"); - }, - - addMessage: function(msg) - { - if (msg.url in WebInspector.resourceURLMap) { - msg.resource = WebInspector.resourceURLMap[msg.url]; - switch (msg.level) { - case WebInspector.ConsoleMessage.MessageLevel.Warning: - ++msg.resource.warnings; - msg.resource.panel.addMessageToSource(msg); - break; - case WebInspector.ConsoleMessage.MessageLevel.Error: - ++msg.resource.errors; - msg.resource.panel.addMessageToSource(msg); - break; - } - } - this.messages.push(msg); - - var item = msg.toListItem(); - item.message = msg; - this.messageList.appendChild(item); - item.scrollIntoView(false); - }, - - clearMessages: function() - { - for (var i = 0; i < this.messages.length; ++i) { - var resource = this.messages[i].resource; - if (!resource) - continue; - - resource.errors = 0; - resource.warnings = 0; - } - - this.messages = []; - this.messageList.removeChildren(); - }, - - clearButtonClicked: function() - { - this.clearMessages(); - }, - - messageListClicked: function(event) - { - var link = event.target.firstParentOrSelfWithNodeName("a"); - if (link && link.representedNode) { - WebInspector.updateFocusedNode(link.representedNode); - return; - } - - var item = event.target.firstParentOrSelfWithNodeName("li"); - if (!item) - return; - - var resource = item.message.resource; - if (!resource) - return; - - if (link && link.hasStyleClass("console-message-url")) { - WebInspector.navigateToResource(resource); - resource.panel.showSourceLine(item.message.line); - } - - event.stopPropagation(); - event.preventDefault(); - }, - - promptKeyDown: function(event) - { - switch (event.keyIdentifier) { - case "Enter": - this._onEnterPressed(event); - break; - case "Up": - this._onUpPressed(event); - break; - case "Down": - this._onDownPressed(event); - break; - } - }, - - _onEnterPressed: function(event) - { - event.preventDefault(); - event.stopPropagation(); - - var str = this.consolePrompt.value; - if (!str.length) - return; - - this.commandHistory.push(str); - this.commandOffset = 0; - - this.consolePrompt.value = ""; - - var result; - var exception = false; - try { - // This with block is needed to work around http://bugs.webkit.org/show_bug.cgi?id=11399 - with (InspectorController.inspectedWindow()) { - result = eval(str); - } - } catch(e) { - result = e; - exception = true; - } - - var level = exception ? WebInspector.ConsoleMessage.MessageLevel.Error : WebInspector.ConsoleMessage.MessageLevel.Log; - - this.addMessage(new WebInspector.ConsoleCommand(str, this._format(result))); - }, - - _onUpPressed: function(event) - { - event.preventDefault(); - event.stopPropagation(); - - if (this.commandOffset == this.commandHistory.length) - return; - - if (this.commandOffset == 0) - this.tempSavedCommand = this.consolePrompt.value; - - ++this.commandOffset; - this.consolePrompt.value = this.commandHistory[this.commandHistory.length - this.commandOffset]; - this.consolePrompt.moveCursorToEnd(); - }, - - _onDownPressed: function(event) - { - event.preventDefault(); - event.stopPropagation(); - - if (this.commandOffset == 0) - return; - - --this.commandOffset; - - if (this.commandOffset == 0) { - this.consolePrompt.value = this.tempSavedCommand; - this.consolePrompt.moveCursorToEnd(); - delete this.tempSavedCommand; - return; - } - - this.consolePrompt.value = this.commandHistory[this.commandHistory.length - this.commandOffset]; - this.consolePrompt.moveCursorToEnd(); - }, - - _format: function(output) - { - var type = Object.type(output); - if (type === "object") { - if (output instanceof Node) - type = "node"; - } - - // We don't perform any special formatting on these types, so we just - // pass them through the simple _formatvalue function. - var undecoratedTypes = { - "undefined": 1, - "null": 1, - "boolean": 1, - "number": 1, - "date": 1, - "function": 1, - }; - - var formatter; - if (type in undecoratedTypes) - formatter = "_formatvalue"; - else { - formatter = "_format" + type; - if (!(formatter in this)) { - formatter = "_formatobject"; - type = "object"; - } - } - - var span = document.createElement("span"); - span.addStyleClass("console-formatted-" + type); - this[formatter](output, span); - return span; - }, - - _formatvalue: function(val, elem) - { - elem.appendChild(document.createTextNode(val)); - }, - - _formatstring: function(str, elem) - { - elem.appendChild(document.createTextNode("\"" + str + "\"")); - }, - - _formatregexp: function(re, elem) - { - var formatted = String(re).replace(/([\\\/])/g, "\\$1").replace(/\\(\/[gim]*)$/, "$1").substring(1); - elem.appendChild(document.createTextNode(formatted)); - }, - - _formatarray: function(arr, elem) - { - elem.appendChild(document.createTextNode("[")); - for (var i = 0; i < arr.length; ++i) { - elem.appendChild(this._format(arr[i])); - if (i < arr.length - 1) - elem.appendChild(document.createTextNode(", ")); - } - elem.appendChild(document.createTextNode("]")); - }, - - _formatnode: function(node, elem) - { - var anchor = document.createElement("a"); - anchor.innerHTML = node.titleInfo().title; - anchor.representedNode = node; - elem.appendChild(anchor); - }, - - _formatobject: function(obj, elem) - { - elem.appendChild(document.createTextNode(Object.describe(obj))); - }, -} - -WebInspector.ConsolePanel.prototype.__proto__ = WebInspector.Panel.prototype; - -WebInspector.ConsoleMessage = function(source, level, message, line, url) -{ - this.source = source; - this.level = level; - this.message = message; - this.line = line; - this.url = url; -} - -WebInspector.ConsoleMessage.prototype = { - get shortURL() - { - if (this.resource) - return this.resource.displayName; - return this.url; - }, - - toListItem: function() - { - var item = document.createElement("li"); - item.className = "console-message"; - switch (this.source) { - case WebInspector.ConsoleMessage.MessageSource.HTML: - item.className += " console-html-source"; - break; - case WebInspector.ConsoleMessage.MessageSource.XML: - item.className += " console-xml-source"; - break; - case WebInspector.ConsoleMessage.MessageSource.JS: - item.className += " console-js-source"; - break; - case WebInspector.ConsoleMessage.MessageSource.CSS: - item.className += " console-css-source"; - break; - case WebInspector.ConsoleMessage.MessageSource.Other: - item.className += " console-other-source"; - break; - } - - switch (this.level) { - case WebInspector.ConsoleMessage.MessageLevel.Tip: - item.className += " console-tip-level"; - break; - case WebInspector.ConsoleMessage.MessageLevel.Log: - item.className += " console-log-level"; - break; - case WebInspector.ConsoleMessage.MessageLevel.Warning: - item.className += " console-warning-level"; - break; - case WebInspector.ConsoleMessage.MessageLevel.Error: - item.className += " console-error-level"; - } - - var messageDiv = document.createElement("div"); - messageDiv.className = "console-message-message"; - messageDiv.textContent = this.message; - item.appendChild(messageDiv); - - if (this.url && this.url !== "undefined") { - var urlElement = document.createElement("a"); - urlElement.className = "console-message-url"; - - if (this.line > 0) - urlElement.textContent = WebInspector.UIString("%s (line %d)", this.url, this.line); - else - urlElement.textContent = this.url; - - item.appendChild(urlElement); - } - - return item; - }, - - toString: function() - { - var sourceString; - switch (this.source) { - case WebInspector.ConsoleMessage.MessageSource.HTML: - sourceString = "HTML"; - break; - case WebInspector.ConsoleMessage.MessageSource.XML: - sourceString = "XML"; - break; - case WebInspector.ConsoleMessage.MessageSource.JS: - sourceString = "JS"; - break; - case WebInspector.ConsoleMessage.MessageSource.CSS: - sourceString = "CSS"; - break; - case WebInspector.ConsoleMessage.MessageSource.Other: - sourceString = "Other"; - break; - } - - var levelString; - switch (this.level) { - case WebInspector.ConsoleMessage.MessageLevel.Tip: - levelString = "Tip"; - break; - case WebInspector.ConsoleMessage.MessageLevel.Log: - levelString = "Log"; - break; - case WebInspector.ConsoleMessage.MessageLevel.Warning: - levelString = "Warning"; - break; - case WebInspector.ConsoleMessage.MessageLevel.Error: - levelString = "Error"; - break; - } - - return sourceString + " " + levelString + ": " + this.message + "\n" + this.url + " line " + this.line; - } -} - -// Note: Keep these constants in sync with the ones in Chrome.h -WebInspector.ConsoleMessage.MessageSource = { - HTML: 0, - XML: 1, - JS: 2, - CSS: 3, - Other: 4, -}; - -WebInspector.ConsoleMessage.MessageLevel = { - Tip: 0, - Log: 1, - Warning: 2, - Error: 3, -}; - -WebInspector.ConsoleCommand = function(input, output) -{ - this.input = input; - this.output = output; -} - -WebInspector.ConsoleCommand.prototype = { - toListItem: function() - { - var item = document.createElement("li"); - item.className = "console-command"; - - var inputDiv = document.createElement("div"); - inputDiv.className = "console-command-input"; - inputDiv.textContent = this.input; - item.appendChild(inputDiv); - - var outputDiv = document.createElement("div"); - outputDiv.className = "console-command-output"; - outputDiv.appendChild(this.output); - item.appendChild(outputDiv); - - return item; - } -} diff --git a/WebCore/page/inspector/Database.js b/WebCore/page/inspector/Database.js deleted file mode 100644 index 36e89da..0000000 --- a/WebCore/page/inspector/Database.js +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.Database = function(database, domain, name, version) -{ - this.database = database; - this.domain = domain; - this.name = name; - this.version = version; - - this.listItem = new WebInspector.ResourceTreeElement(this); - this.updateTitle(); - - this.category.addResource(this); -} - -WebInspector.Database.prototype = { - get database() - { - return this._database; - }, - - set database(x) - { - if (this._database === x) - return; - this._database = x; - }, - - get name() - { - return this._name; - }, - - set name(x) - { - if (this._name === x) - return; - this._name = x; - this.updateTitleSoon(); - }, - - get version() - { - return this._version; - }, - - set version(x) - { - if (this._version === x) - return; - this._version = x; - }, - - get domain() - { - return this._domain; - }, - - set domain(x) - { - if (this._domain === x) - return; - this._domain = x; - this.updateTitleSoon(); - }, - - get category() - { - return WebInspector.resourceCategories.databases; - }, - - updateTitle: function() - { - delete this.updateTitleTimeout; - - var title = this.name; - - var info = ""; - if (this.domain && (!WebInspector.mainResource || (WebInspector.mainResource && this.domain !== WebInspector.mainResource.domain))) - info = this.domain; - - var fullTitle = "<span class=\"title" + (info && info.length ? "" : " only") + "\">" + title.escapeHTML() + "</span>"; - if (info && info.length) - fullTitle += "<span class=\"info\">" + info.escapeHTML() + "</span>"; - fullTitle += "<div class=\"icon database\"></div>"; - - this.listItem.title = fullTitle; - }, - - get panel() - { - if (!this._panel) - this._panel = new WebInspector.DatabasePanel(this); - return this._panel; - }, - - // Inherit the other functions from the Resource prototype. - updateTitleSoon: WebInspector.Resource.prototype.updateTitleSoon, - select: WebInspector.Resource.prototype.select, - deselect: WebInspector.Resource.prototype.deselect, - attach: WebInspector.Resource.prototype.attach, - detach: WebInspector.Resource.prototype.detach -} diff --git a/WebCore/page/inspector/DatabasePanel.js b/WebCore/page/inspector/DatabasePanel.js deleted file mode 100644 index 9101b9c..0000000 --- a/WebCore/page/inspector/DatabasePanel.js +++ /dev/null @@ -1,462 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.DatabasePanel = function(database, views) -{ - var allViews = [{ title: WebInspector.UIString("Query"), name: "query" }, { title: WebInspector.UIString("Browse"), name: "browse" }]; - if (views) - allViews = allViews.concat(views); - - WebInspector.ResourcePanel.call(this, database, allViews); - - this.currentView = this.views.browse; - - this.queryPromptElement = document.createElement("textarea"); - this.queryPromptElement.className = "database-prompt"; - this.element.appendChild(this.queryPromptElement); - - this.queryPromptElement.addEventListener("keydown", this.queryInputKeyDown.bind(this), false); - - this.queryPromptHistory = []; - this.queryPromptHistoryOffset = 0; - - var queryView = this.views.query; - - queryView.commandListElement = document.createElement("ol"); - queryView.commandListElement.className = "database-command-list"; - queryView.contentElement.appendChild(queryView.commandListElement); - - var panel = this; - queryView.show = function() - { - panel.queryPromptElement.focus(); - this.commandListElement.scrollTop = this.previousScrollTop; - }; - - queryView.hide = function() - { - this.previousScrollTop = this.commandListElement.scrollTop; - }; - - var browseView = this.views.browse; - - browseView.reloadTableElement = document.createElement("button"); - browseView.reloadTableElement.appendChild(document.createElement("img")); - browseView.reloadTableElement.className = "database-table-reload"; - browseView.reloadTableElement.title = WebInspector.UIString("Reload"); - browseView.reloadTableElement.addEventListener("click", this.reloadClicked.bind(this), false); - - browseView.show = function() - { - panel.updateTableList(); - panel.queryPromptElement.focus(); - - this.tableSelectElement.removeStyleClass("hidden"); - if (!this.tableSelectElement.parentNode) - document.getElementById("toolbarButtons").appendChild(this.tableSelectElement); - - this.reloadTableElement.removeStyleClass("hidden"); - if (!this.reloadTableElement.parentNode) - document.getElementById("toolbarButtons").appendChild(this.reloadTableElement); - - this.contentElement.scrollTop = this.previousScrollTop; - }; - - browseView.hide = function() - { - this.tableSelectElement.addStyleClass("hidden"); - this.reloadTableElement.addStyleClass("hidden"); - this.previousScrollTop = this.contentElement.scrollTop; - }; -} - -// FIXME: The function and local variables are a workaround for http://bugs.webkit.org/show_bug.cgi?id=15574. -WebInspector.DatabasePanel.prototype = (function() { -var document = window.document; -var Math = window.Math; -return { - show: function() - { - WebInspector.ResourcePanel.prototype.show.call(this); - this.queryPromptElement.focus(); - }, - - get currentTable() - { - return this._currentTable; - }, - - set currentTable(x) - { - if (this._currentTable === x) - return; - - this._currentTable = x; - - if (x) { - var browseView = this.views.browse; - if (browseView.tableSelectElement) { - var length = browseView.tableSelectElement.options.length; - for (var i = 0; i < length; ++i) { - var option = browseView.tableSelectElement.options[i]; - if (option.value === x) { - browseView.tableSelectElement.selectedIndex = i; - break; - } - } - } - - this.updateTableBrowser(); - } - }, - - reloadClicked: function() - { - this.updateTableList(); - this.updateTableBrowser(); - }, - - updateTableList: function() - { - var browseView = this.views.browse; - if (!browseView.tableSelectElement) { - browseView.tableSelectElement = document.createElement("select"); - browseView.tableSelectElement.className = "database-table-select hidden"; - - var panel = this; - var changeTableFunction = function() - { - var index = browseView.tableSelectElement.selectedIndex; - if (index != -1) - panel.currentTable = browseView.tableSelectElement.options[index].value; - else - panel.currentTable = null; - }; - - browseView.tableSelectElement.addEventListener("change", changeTableFunction, false); - } - - browseView.tableSelectElement.removeChildren(); - - var selectedTableName = this.currentTable; - var tableNames = InspectorController.databaseTableNames(this.resource.database).sort(); - - var length = tableNames.length; - for (var i = 0; i < length; ++i) { - var option = document.createElement("option"); - option.value = tableNames[i]; - option.text = tableNames[i]; - browseView.tableSelectElement.appendChild(option); - - if (tableNames[i] === selectedTableName) - browseView.tableSelectElement.selectedIndex = i; - } - - if (!selectedTableName && length) - this.currentTable = tableNames[0]; - }, - - updateTableBrowser: function() - { - if (!this.currentTable) { - this.views.browse.contentElement.removeChildren(); - return; - } - - var panel = this; - var query = "SELECT * FROM " + this.currentTable; - this.resource.database.transaction(function(tx) - { - tx.executeSql(query, [], function(tx, result) { panel.browseQueryFinished(result) }, function(tx, error) { panel.browseQueryError(error) }); - }, function(tx, error) { panel.browseQueryError(error) }); - }, - - browseQueryFinished: function(result) - { - this.views.browse.contentElement.removeChildren(); - - var table = this._tableForResult(result); - if (!table) { - var emptyMsgElement = document.createElement("div"); - emptyMsgElement.className = "database-table-empty"; - emptyMsgElement.textContent = WebInspector.UIString("The “%s”\ntable is empty.", this.currentTable); - this.views.browse.contentElement.appendChild(emptyMsgElement); - return; - } - - var rowCount = table.getElementsByTagName("tr").length; - var columnCount = table.getElementsByTagName("tr").item(0).getElementsByTagName("th").length; - - var tr = document.createElement("tr"); - tr.className = "database-result-filler-row"; - table.appendChild(tr); - - if (!(rowCount % 2)) - tr.addStyleClass("alternate"); - - for (var i = 0; i < columnCount; ++i) { - var td = document.createElement("td"); - tr.appendChild(td); - } - - table.addStyleClass("database-browse-table"); - this.views.browse.contentElement.appendChild(table); - }, - - browseQueryError: function(error) - { - this.views.browse.contentElement.removeChildren(); - - var errorMsgElement = document.createElement("div"); - errorMsgElement.className = "database-table-error"; - errorMsgElement.textContent = WebInspector.UIString("An error occurred trying to\nread the “%s” table.", this.currentTable); - this.views.browse.contentElement.appendChild(errorMsgElement); - }, - - queryInputKeyDown: function(event) - { - switch (event.keyIdentifier) { - case "Enter": - this._onQueryInputEnterPressed(event); - break; - case "Up": - this._onQueryInputUpPressed(event); - break; - case "Down": - this._onQueryInputDownPressed(event); - break; - } - }, - - appendQueryResult: function(query, result, resultClassName) - { - var commandItem = document.createElement("li"); - commandItem.className = "database-command"; - - var queryDiv = document.createElement("div"); - queryDiv.className = "database-command-query"; - queryDiv.textContent = query; - commandItem.appendChild(queryDiv); - - var resultDiv = document.createElement("div"); - resultDiv.className = "database-command-result"; - commandItem.appendChild(resultDiv); - - if (resultClassName) - resultDiv.addStyleClass(resultClassName); - - if (typeof result === "string" || result instanceof String) - resultDiv.textContent = result; - else if (result && result.nodeName) - resultDiv.appendChild(result); - - this.views.query.commandListElement.appendChild(commandItem); - commandItem.scrollIntoView(false); - }, - - queryFinished: function(query, result) - { - this.appendQueryResult(query, this._tableForResult(result)); - }, - - queryError: function(query, error) - { - if (this.currentView !== this.views.query) - this.currentView = this.views.query; - - if (error.code == 1) - var message = error.message; - else if (error.code == 2) - var message = WebInspector.UIString("Database no longer has expected version."); - else - var message = WebInspector.UIString("An unexpected error %s occured.", error.code); - - this.appendQueryResult(query, message, "error"); - }, - - _onQueryInputEnterPressed: function(event) - { - event.preventDefault(); - event.stopPropagation(); - - var query = this.queryPromptElement.value; - if (!query.length) - return; - - var panel = this; - this.resource.database.transaction(function(tx) - { - tx.executeSql(query, [], function(tx, result) { panel.queryFinished(query, result) }, function(tx, error) { panel.queryError(query, error) }); - }, function(tx, error) { panel.queryError(query, error) }); - - this.queryPromptHistory.push(query); - this.queryPromptHistoryOffset = 0; - - this.queryPromptElement.value = ""; - - if (query.match(/^select /i)) { - if (this.currentView !== this.views.query) - this.currentView = this.views.query; - } else { - if (query.match(/^create /i) || query.match(/^drop table /i)) - this.updateTableList(); - - // FIXME: we should only call updateTableBrowser() is we know the current table was modified - this.updateTableBrowser(); - } - }, - - _onQueryInputUpPressed: function(event) - { - event.preventDefault(); - event.stopPropagation(); - - if (this.queryPromptHistoryOffset == this.queryPromptHistory.length) - return; - - if (this.queryPromptHistoryOffset == 0) - this.tempSavedQuery = this.queryPromptElement.value; - - ++this.queryPromptHistoryOffset; - this.queryPromptElement.value = this.queryPromptHistory[this.queryPromptHistory.length - this.queryPromptHistoryOffset]; - this.queryPromptElement.moveCursorToEnd(); - }, - - _onQueryInputDownPressed: function(event) - { - event.preventDefault(); - event.stopPropagation(); - - if (this.queryPromptHistoryOffset == 0) - return; - - --this.queryPromptHistoryOffset; - - if (this.queryPromptHistoryOffset == 0) { - this.queryPromptElement.value = this.tempSavedQuery; - this.queryPromptElement.moveCursorToEnd(); - delete this.tempSavedQuery; - return; - } - - this.queryPromptElement.value = this.queryPromptHistory[this.queryPromptHistory.length - this.queryPromptHistoryOffset]; - this.queryPromptElement.moveCursorToEnd(); - }, - - _tableForResult: function(result) - { - if (!result.rows.length) - return null; - - var rows = result.rows; - var length = rows.length; - var columnWidths = []; - - var table = document.createElement("table"); - table.className = "database-result-table"; - - var headerRow = document.createElement("tr"); - table.appendChild(headerRow); - - var j = 0; - for (var column in rows.item(0)) { - var th = document.createElement("th"); - headerRow.appendChild(th); - - var div = document.createElement("div"); - div.textContent = column; - div.title = column; - th.appendChild(div); - - columnWidths[j++] = column.length; - } - - for (var i = 0; i < length; ++i) { - var row = rows.item(i); - var tr = document.createElement("tr"); - if (i % 2) - tr.className = "alternate"; - table.appendChild(tr); - - var j = 0; - for (var column in row) { - var td = document.createElement("td"); - tr.appendChild(td); - - var text = row[column]; - var div = document.createElement("div"); - div.textContent = text; - div.title = text; - td.appendChild(div); - - if (text.length > columnWidths[j]) - columnWidths[j] = text.length; - ++j; - } - } - - var totalColumnWidths = 0; - length = columnWidths.length; - for (var i = 0; i < length; ++i) - totalColumnWidths += columnWidths[i]; - - // Calculate the percentage width for the columns. - var minimumPrecent = 5; - var recoupPercent = 0; - for (var i = 0; i < length; ++i) { - columnWidths[i] = Math.round((columnWidths[i] / totalColumnWidths) * 100); - if (columnWidths[i] < minimumPrecent) { - recoupPercent += (minimumPrecent - columnWidths[i]); - columnWidths[i] = minimumPrecent; - } - } - - // Enforce the minimum percentage width. - while (recoupPercent > 0) { - for (var i = 0; i < length; ++i) { - if (columnWidths[i] > minimumPrecent) { - --columnWidths[i]; - --recoupPercent; - if (!recoupPercent) - break; - } - } - } - - length = headerRow.childNodes.length; - for (var i = 0; i < length; ++i) { - var th = headerRow.childNodes[i]; - th.style.width = columnWidths[i] + "%"; - } - - return table; - } -} -})(); - -WebInspector.DatabasePanel.prototype.__proto__ = WebInspector.ResourcePanel.prototype; diff --git a/WebCore/page/inspector/DocumentPanel.js b/WebCore/page/inspector/DocumentPanel.js deleted file mode 100644 index 770f9ba..0000000 --- a/WebCore/page/inspector/DocumentPanel.js +++ /dev/null @@ -1,837 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.DocumentPanel = function(resource, views) -{ - var allViews = [{ title: WebInspector.UIString("DOM"), name: "dom" }]; - if (views) - allViews = allViews.concat(views); - - WebInspector.SourcePanel.call(this, resource, allViews); - - var panel = this; - var domView = this.views.dom; - domView.hide = function() { InspectorController.hideDOMNodeHighlight() }; - domView.show = function() { - InspectorController.highlightDOMNode(panel.focusedDOMNode); - panel.updateBreadcrumb(); - panel.updateTreeSelection(); - }; - - domView.sideContentElement = document.createElement("div"); - domView.sideContentElement.className = "content side"; - - domView.treeContentElement = document.createElement("div"); - domView.treeContentElement.className = "content tree outline-disclosure"; - - domView.treeListElement = document.createElement("ol"); - domView.treeOutline = new TreeOutline(domView.treeListElement); - domView.treeOutline.panel = this; - - domView.crumbsElement = document.createElement("div"); - domView.crumbsElement.className = "crumbs"; - - domView.innerCrumbsElement = document.createElement("div"); - domView.crumbsElement.appendChild(domView.innerCrumbsElement); - - domView.sidebarPanes = {}; - domView.sidebarPanes.styles = new WebInspector.StylesSidebarPane(); - domView.sidebarPanes.metrics = new WebInspector.MetricsSidebarPane(); - domView.sidebarPanes.properties = new WebInspector.PropertiesSidebarPane(); - - domView.sidebarPanes.styles.onexpand = function() { panel.updateStyles() }; - domView.sidebarPanes.metrics.onexpand = function() { panel.updateMetrics() }; - domView.sidebarPanes.properties.onexpand = function() { panel.updateProperties() }; - - domView.sidebarPanes.styles.expanded = true; - - domView.sidebarElement = document.createElement("div"); - domView.sidebarElement.className = "sidebar"; - - domView.sidebarElement.appendChild(domView.sidebarPanes.styles.element); - domView.sidebarElement.appendChild(domView.sidebarPanes.metrics.element); - domView.sidebarElement.appendChild(domView.sidebarPanes.properties.element); - - domView.sideContentElement.appendChild(domView.treeContentElement); - domView.sideContentElement.appendChild(domView.crumbsElement); - domView.treeContentElement.appendChild(domView.treeListElement); - - domView.sidebarResizeElement = document.createElement("div"); - domView.sidebarResizeElement.className = "sidebar-resizer-vertical sidebar-resizer-vertical-right"; - domView.sidebarResizeElement.addEventListener("mousedown", this.rightSidebarResizerDragStart.bind(this), false); - - domView.contentElement.appendChild(domView.sideContentElement); - domView.contentElement.appendChild(domView.sidebarElement); - domView.contentElement.appendChild(domView.sidebarResizeElement); - - this.rootDOMNode = this.resource.documentNode; -} - -WebInspector.DocumentPanel.prototype = { - resize: function() - { - this.updateTreeSelection(); - this.updateBreadcrumbSizes(); - }, - - updateTreeSelection: function() - { - if (!this.views.dom.treeOutline || !this.views.dom.treeOutline.selectedTreeElement) - return; - var element = this.views.dom.treeOutline.selectedTreeElement; - element.updateSelection(); - }, - - get rootDOMNode() - { - return this._rootDOMNode; - }, - - set rootDOMNode(x) - { - if (this._rootDOMNode === x) - return; - - this._rootDOMNode = x; - - this.updateBreadcrumb(); - this.updateTreeOutline(); - }, - - get focusedDOMNode() - { - return this._focusedDOMNode; - }, - - set focusedDOMNode(x) - { - if (this._focusedDOMNode === x) { - var nodeItem = this.revealNode(x); - if (nodeItem) - nodeItem.select(); - return; - } - - this._focusedDOMNode = x; - - this.updateBreadcrumb(); - - for (var pane in this.views.dom.sidebarPanes) - this.views.dom.sidebarPanes[pane].needsUpdate = true; - - this.updateStyles(); - this.updateMetrics(); - this.updateProperties(); - - InspectorController.highlightDOMNode(x); - - var nodeItem = this.revealNode(x); - if (nodeItem) - nodeItem.select(); - }, - - revealNode: function(node) - { - var nodeItem = this.views.dom.treeOutline.findTreeElement(node, function(a, b) { return isAncestorNode.call(a, b); }, function(a) { return a.parentNode; }); - if (!nodeItem) - return; - - nodeItem.reveal(); - return nodeItem; - }, - - updateTreeOutline: function() - { - this.views.dom.treeOutline.removeChildrenRecursive(); - - if (!this.rootDOMNode) - return; - - // FIXME: this could use findTreeElement to reuse a tree element if it already exists - var node = (Preferences.ignoreWhitespace ? firstChildSkippingWhitespace.call(this.rootDOMNode) : this.rootDOMNode.firstChild); - while (node) { - this.views.dom.treeOutline.appendChild(new WebInspector.DOMNodeTreeElement(node)); - node = Preferences.ignoreWhitespace ? nextSiblingSkippingWhitespace.call(node) : node.nextSibling; - } - - this.updateTreeSelection(); - }, - - updateBreadcrumb: function() - { - if (!this.visible) - return; - - var crumbs = this.views.dom.innerCrumbsElement; - - var handled = false; - var foundRoot = false; - var crumb = crumbs.firstChild; - while (crumb) { - if (crumb.representedObject === this.rootDOMNode) - foundRoot = true; - - if (foundRoot) - crumb.addStyleClass("dimmed"); - else - crumb.removeStyleClass("dimmed"); - - if (crumb.representedObject === this.focusedDOMNode) { - crumb.addStyleClass("selected"); - handled = true; - } else { - crumb.removeStyleClass("selected"); - } - - crumb = crumb.nextSibling; - } - - if (handled) { - // We don't need to rebuild the crumbs, but we need to adjust sizes - // to reflect the new focused or root node. - this.updateBreadcrumbSizes(); - return; - } - - crumbs.removeChildren(); - - var panel = this; - var selectCrumbFunction = function(event) { - var crumb = event.currentTarget; - if (crumb.hasStyleClass("collapsed")) { - // Clicking a collapsed crumb will expose the hidden crumbs. - if (crumb === panel.views.dom.innerCrumbsElement.firstChild) { - // If the focused crumb is the first child, pick the farthest crumb - // that is still hidden. This allows the user to expose every crumb. - var currentCrumb = crumb; - while (currentCrumb) { - var hidden = currentCrumb.hasStyleClass("hidden"); - var collapsed = currentCrumb.hasStyleClass("collapsed"); - if (!hidden && !collapsed) - break; - crumb = currentCrumb; - currentCrumb = currentCrumb.nextSibling; - } - } - - panel.updateBreadcrumbSizes(crumb); - } else { - // Clicking a dimmed crumb or double clicking (event.detail >= 2) - // will change the root node in addition to the focused node. - if (event.detail >= 2 || crumb.hasStyleClass("dimmed")) - panel.rootDOMNode = crumb.representedObject.parentNode; - panel.focusedDOMNode = crumb.representedObject; - } - - event.preventDefault(); - }; - - var mouseOverCrumbFunction = function(event) { - panel.mouseOverCrumb = true; - - if ("mouseOutTimeout" in panel) { - clearTimeout(panel.mouseOutTimeout); - delete panel.mouseOutTimeout; - } - }; - - var mouseOutCrumbFunction = function(event) { - delete panel.mouseOverCrumb; - - if ("mouseOutTimeout" in panel) { - clearTimeout(panel.mouseOutTimeout); - delete panel.mouseOutTimeout; - } - - var timeoutFunction = function() { - if (!panel.mouseOverCrumb) - panel.updateBreadcrumbSizes(); - }; - - panel.mouseOutTimeout = setTimeout(timeoutFunction, 500); - }; - - foundRoot = false; - var current = this.focusedDOMNode; - while (current) { - if (current.nodeType === Node.DOCUMENT_NODE) - break; - - if (current === this.rootDOMNode) - foundRoot = true; - - var crumb = document.createElement("span"); - crumb.className = "crumb"; - crumb.representedObject = current; - crumb.addEventListener("mousedown", selectCrumbFunction, false); - crumb.addEventListener("mouseover", mouseOverCrumbFunction, false); - crumb.addEventListener("mouseout", mouseOutCrumbFunction, false); - - var crumbTitle; - switch (current.nodeType) { - case Node.ELEMENT_NODE: - crumbTitle = current.nodeName.toLowerCase(); - - var nameElement = document.createElement("span"); - nameElement.textContent = crumbTitle; - crumb.appendChild(nameElement); - - var idAttribute = current.getAttribute("id"); - if (idAttribute) { - var idElement = document.createElement("span"); - crumb.appendChild(idElement); - - var part = "#" + idAttribute; - crumbTitle += part; - idElement.appendChild(document.createTextNode(part)); - - // Mark the name as extra, since the ID is more important. - nameElement.className = "extra"; - } - - var classAttribute = current.getAttribute("class"); - if (classAttribute) { - var classes = classAttribute.split(/\s+/); - var foundClasses = {}; - - if (classes.length) { - var classesElement = document.createElement("span"); - classesElement.className = "extra"; - crumb.appendChild(classesElement); - - for (var i = 0; i < classes.length; ++i) { - var className = classes[i]; - if (className && !(className in foundClasses)) { - var part = "." + className; - crumbTitle += part; - classesElement.appendChild(document.createTextNode(part)); - foundClasses[className] = true; - } - } - } - } - - break; - - case Node.TEXT_NODE: - if (isNodeWhitespace.call(current)) - crumbTitle = WebInspector.UIString("(whitespace)"); - else - crumbTitle = WebInspector.UIString("(text)"); - break - - case Node.COMMENT_NODE: - crumbTitle = "<!-->"; - break; - - default: - crumbTitle = current.nodeName.toLowerCase(); - } - - if (!crumb.childNodes.length) { - var nameElement = document.createElement("span"); - nameElement.textContent = crumbTitle; - crumb.appendChild(nameElement); - } - - crumb.title = crumbTitle; - - if (foundRoot) - crumb.addStyleClass("dimmed"); - if (current === this.focusedDOMNode) - crumb.addStyleClass("selected"); - if (!crumbs.childNodes.length) - crumb.addStyleClass("end"); - if (current.parentNode.nodeType === Node.DOCUMENT_NODE) - crumb.addStyleClass("start"); - - crumbs.appendChild(crumb); - current = current.parentNode; - } - - this.updateBreadcrumbSizes(); - }, - - updateBreadcrumbSizes: function(focusedCrumb) - { - if (!this.visible) - return; - - if (document.body.offsetWidth <= 0) { - // The stylesheet hasn't loaded yet, so we need to update later. - setTimeout(this.updateBreadcrumbSizes.bind(this), 0); - return; - } - - var crumbs = this.views.dom.innerCrumbsElement; - if (!crumbs.childNodes.length) - return; // No crumbs, do nothing. - - var crumbsContainer = this.views.dom.crumbsElement; - if (crumbsContainer.offsetWidth <= 0 || crumbs.offsetWidth <= 0) - return; - - // A Zero index is the right most child crumb in the breadcrumb. - var selectedIndex = 0; - var focusedIndex = 0; - var selectedCrumb; - - var i = 0; - var crumb = crumbs.firstChild; - while (crumb) { - // Find the selected crumb and index. - if (!selectedCrumb && crumb.hasStyleClass("selected")) { - selectedCrumb = crumb; - selectedIndex = i; - } - - // Find the focused crumb index. - if (crumb === focusedCrumb) - focusedIndex = i; - - // Remove any styles that affect size before - // deciding to shorten any crumbs. - if (crumb !== crumbs.lastChild) - crumb.removeStyleClass("start"); - if (crumb !== crumbs.firstChild) - crumb.removeStyleClass("end"); - - crumb.removeStyleClass("compact"); - crumb.removeStyleClass("collapsed"); - crumb.removeStyleClass("hidden"); - - crumb = crumb.nextSibling; - ++i; - } - - // Restore the start and end crumb classes in case they got removed in coalesceCollapsedCrumbs(). - // The order of the crumbs in the document is opposite of the visual order. - crumbs.firstChild.addStyleClass("end"); - crumbs.lastChild.addStyleClass("start"); - - function crumbsAreSmallerThanContainer() - { - // There is some fixed extra space that is not returned in the crumbs' offsetWidth. - // This padding is added to the crumbs' offsetWidth when comparing to the crumbsContainer. - var rightPadding = 9; - return ((crumbs.offsetWidth + rightPadding) < crumbsContainer.offsetWidth); - } - - if (crumbsAreSmallerThanContainer()) - return; // No need to compact the crumbs, they all fit at full size. - - var BothSides = 0; - var AncestorSide = -1; - var ChildSide = 1; - - function makeCrumbsSmaller(shrinkingFunction, direction, significantCrumb) - { - if (!significantCrumb) - significantCrumb = (focusedCrumb || selectedCrumb); - - if (significantCrumb === selectedCrumb) - var significantIndex = selectedIndex; - else if (significantCrumb === focusedCrumb) - var significantIndex = focusedIndex; - else { - var significantIndex = 0; - for (var i = 0; i < crumbs.childNodes.length; ++i) { - if (crumbs.childNodes[i] === significantCrumb) { - significantIndex = i; - break; - } - } - } - - function shrinkCrumbAtIndex(index) - { - var shrinkCrumb = crumbs.childNodes[index]; - if (shrinkCrumb && shrinkCrumb !== significantCrumb) - shrinkingFunction(shrinkCrumb); - if (crumbsAreSmallerThanContainer()) - return true; // No need to compact the crumbs more. - return false; - } - - // Shrink crumbs one at a time by applying the shrinkingFunction until the crumbs - // fit in the crumbsContainer or we run out of crumbs to shrink. - if (direction) { - // Crumbs are shrunk on only one side (based on direction) of the signifcant crumb. - var index = (direction > 0 ? 0 : crumbs.childNodes.length - 1); - while (index !== significantIndex) { - if (shrinkCrumbAtIndex(index)) - return true; - index += (direction > 0 ? 1 : -1); - } - } else { - // Crumbs are shrunk in order of descending distance from the signifcant crumb, - // with a tie going to child crumbs. - var startIndex = 0; - var endIndex = crumbs.childNodes.length - 1; - while (startIndex != significantIndex || endIndex != significantIndex) { - var startDistance = significantIndex - startIndex; - var endDistance = endIndex - significantIndex; - if (startDistance >= endDistance) - var index = startIndex++; - else - var index = endIndex--; - if (shrinkCrumbAtIndex(index)) - return true; - } - } - - // We are not small enough yet, return false so the caller knows. - return false; - } - - function coalesceCollapsedCrumbs() - { - var crumb = crumbs.firstChild; - var collapsedRun = false; - var newStartNeeded = false; - var newEndNeeded = false; - while (crumb) { - var hidden = crumb.hasStyleClass("hidden"); - if (!hidden) { - var collapsed = crumb.hasStyleClass("collapsed"); - if (collapsedRun && collapsed) { - crumb.addStyleClass("hidden"); - crumb.removeStyleClass("compact"); - crumb.removeStyleClass("collapsed"); - - if (crumb.hasStyleClass("start")) { - crumb.removeStyleClass("start"); - newStartNeeded = true; - } - - if (crumb.hasStyleClass("end")) { - crumb.removeStyleClass("end"); - newEndNeeded = true; - } - - continue; - } - - collapsedRun = collapsed; - - if (newEndNeeded) { - newEndNeeded = false; - crumb.addStyleClass("end"); - } - } else - collapsedRun = true; - crumb = crumb.nextSibling; - } - - if (newStartNeeded) { - crumb = crumbs.lastChild; - while (crumb) { - if (!crumb.hasStyleClass("hidden")) { - crumb.addStyleClass("start"); - break; - } - crumb = crumb.previousSibling; - } - } - } - - function compact(crumb) - { - if (crumb.hasStyleClass("hidden")) - return; - crumb.addStyleClass("compact"); - } - - function collapse(crumb, dontCoalesce) - { - if (crumb.hasStyleClass("hidden")) - return; - crumb.addStyleClass("collapsed"); - crumb.removeStyleClass("compact"); - if (!dontCoalesce) - coalesceCollapsedCrumbs(); - } - - function compactDimmed(crumb) - { - if (crumb.hasStyleClass("dimmed")) - compact(crumb); - } - - function collapseDimmed(crumb) - { - if (crumb.hasStyleClass("dimmed")) - collapse(crumb); - } - - if (!focusedCrumb) { - // When not focused on a crumb we can be biased and collapse less important - // crumbs that the user might not care much about. - - // Compact child crumbs. - if (makeCrumbsSmaller(compact, ChildSide)) - return; - - // Collapse child crumbs. - if (makeCrumbsSmaller(collapse, ChildSide)) - return; - - // Compact dimmed ancestor crumbs. - if (makeCrumbsSmaller(compactDimmed, AncestorSide)) - return; - - // Collapse dimmed ancestor crumbs. - if (makeCrumbsSmaller(collapseDimmed, AncestorSide)) - return; - } - - // Compact ancestor crumbs, or from both sides if focused. - if (makeCrumbsSmaller(compact, (focusedCrumb ? BothSides : AncestorSide))) - return; - - // Collapse ancestor crumbs, or from both sides if focused. - if (makeCrumbsSmaller(collapse, (focusedCrumb ? BothSides : AncestorSide))) - return; - - if (!selectedCrumb) - return; - - // Compact the selected crumb. - compact(selectedCrumb); - if (crumbsAreSmallerThanContainer()) - return; - - // Collapse the selected crumb as a last resort. Pass true to prevent coalescing. - collapse(selectedCrumb, true); - }, - - updateStyles: function() - { - var stylesSidebarPane = this.views.dom.sidebarPanes.styles; - if (!stylesSidebarPane.expanded || !stylesSidebarPane.needsUpdate) - return; - - stylesSidebarPane.update(this.focusedDOMNode); - stylesSidebarPane.needsUpdate = false; - }, - - updateMetrics: function() - { - var metricsSidebarPane = this.views.dom.sidebarPanes.metrics; - if (!metricsSidebarPane.expanded || !metricsSidebarPane.needsUpdate) - return; - - metricsSidebarPane.update(this.focusedDOMNode); - metricsSidebarPane.needsUpdate = false; - }, - - updateProperties: function() - { - var propertiesSidebarPane = this.views.dom.sidebarPanes.properties; - if (!propertiesSidebarPane.expanded || !propertiesSidebarPane.needsUpdate) - return; - - propertiesSidebarPane.update(this.focusedDOMNode); - propertiesSidebarPane.needsUpdate = false; - }, - - handleKeyEvent: function(event) - { - if (this.views.dom.treeOutline && this.currentView && this.currentView === this.views.dom) - this.views.dom.treeOutline.handleKeyEvent(event); - }, - - handleCopyEvent: function(event) - { - if (this.currentView !== this.views.dom) - return; - - // Don't prevent the normal copy if the user has a selection. - if (!window.getSelection().isCollapsed) - return; - - switch (this.focusedDOMNode.nodeType) { - case Node.ELEMENT_NODE: - var data = this.focusedDOMNode.outerHTML; - break; - - case Node.COMMENT_NODE: - var data = "<!--" + this.focusedDOMNode.nodeValue + "-->"; - break; - - default: - case Node.TEXT_NODE: - var data = this.focusedDOMNode.nodeValue; - } - - event.clipboardData.clearData(); - event.preventDefault(); - - if (data) - event.clipboardData.setData("text/plain", data); - }, - - rightSidebarResizerDragStart: function(event) - { - if (this.sidebarDragEventListener || this.sidebarDragEndEventListener) - return this.rightSidebarResizerDragEnd(event); - - this.sidebarDragEventListener = this.rightSidebarResizerDrag.bind(this); - this.sidebarDragEndEventListener = this.rightSidebarResizerDragEnd.bind(this); - WebInspector.elementDragStart(this.views.dom.sidebarElement, this.sidebarDragEventListener, this.sidebarDragEndEventListener, event, "col-resize"); - }, - - rightSidebarResizerDragEnd: function(event) - { - WebInspector.elementDragEnd(this.views.dom.sidebarElement, this.sidebarDragEventListener, this.sidebarDragEndEventListener, event); - delete this.sidebarDragEventListener; - delete this.sidebarDragEndEventListener; - }, - - rightSidebarResizerDrag: function(event) - { - var x = event.pageX; - - var leftSidebarWidth = document.getElementById("sidebar").offsetWidth; - var newWidth = Number.constrain(window.innerWidth - x, 100, window.innerWidth - leftSidebarWidth - 100); - - this.views.dom.sidebarElement.style.width = newWidth + "px"; - this.views.dom.sideContentElement.style.right = newWidth + "px"; - this.views.dom.sidebarResizeElement.style.right = (newWidth - 3) + "px"; - - this.updateTreeSelection(); - this.updateBreadcrumbSizes(); - - event.preventDefault(); - } -} - -WebInspector.DocumentPanel.prototype.__proto__ = WebInspector.SourcePanel.prototype; - -WebInspector.DOMNodeTreeElement = function(node) -{ - var hasChildren = (Preferences.ignoreWhitespace ? (firstChildSkippingWhitespace.call(node) ? true : false) : node.hasChildNodes()); - var titleInfo = nodeTitleInfo.call(node, hasChildren, WebInspector.linkifyURL); - - if (titleInfo.hasChildren) - this.whitespaceIgnored = Preferences.ignoreWhitespace; - - TreeElement.call(this, titleInfo.title, node, titleInfo.hasChildren); -} - -WebInspector.DOMNodeTreeElement.prototype = { - updateSelection: function() - { - var listItemElement = this.listItemElement; - if (!listItemElement) - return; - - if (document.body.offsetWidth <= 0) { - // The stylesheet hasn't loaded yet, so we need to update later. - setTimeout(this.updateSelection.bind(this), 0); - return; - } - - if (!this.selectionElement) { - this.selectionElement = document.createElement("div"); - this.selectionElement.className = "selection selected"; - listItemElement.insertBefore(this.selectionElement, listItemElement.firstChild); - } - - this.selectionElement.style.height = listItemElement.offsetHeight + "px"; - }, - - onattach: function() - { - this.listItemElement.addEventListener("mousedown", this.onmousedown.bind(this), false); - }, - - onpopulate: function() - { - if (this.children.length || this.whitespaceIgnored !== Preferences.ignoreWhitespace) - return; - - this.removeChildren(); - this.whitespaceIgnored = Preferences.ignoreWhitespace; - - var node = (Preferences.ignoreWhitespace ? firstChildSkippingWhitespace.call(this.representedObject) : this.representedObject.firstChild); - while (node) { - this.appendChild(new WebInspector.DOMNodeTreeElement(node)); - node = Preferences.ignoreWhitespace ? nextSiblingSkippingWhitespace.call(node) : node.nextSibling; - } - - if (this.representedObject.nodeType == Node.ELEMENT_NODE) { - var title = "<span class=\"webkit-html-tag close\"></" + this.representedObject.nodeName.toLowerCase().escapeHTML() + "></span>"; - var item = new TreeElement(title, this.representedObject, false); - item.selectable = false; - this.appendChild(item); - } - }, - - onexpand: function() - { - this.treeOutline.panel.updateTreeSelection(); - }, - - oncollapse: function() - { - this.treeOutline.panel.updateTreeSelection(); - }, - - onreveal: function() - { - if (!this.listItemElement || !this.treeOutline) - return; - this.treeOutline.panel.views.dom.treeContentElement.scrollToElement(this.listItemElement); - }, - - onselect: function() - { - this.treeOutline.panel.focusedDOMNode = this.representedObject; - this.updateSelection(); - }, - - onmousedown: function(event) - { - // Prevent selecting the nearest word on double click. - if (event.detail >= 2) - event.preventDefault(); - }, - - ondblclick: function() - { - var panel = this.treeOutline.panel; - panel.rootDOMNode = this.representedObject.parentNode; - panel.focusedDOMNode = this.representedObject; - - if (this.hasChildren && !this.expanded) - this.expand(); - } -} - -WebInspector.DOMNodeTreeElement.prototype.__proto__ = TreeElement.prototype; diff --git a/WebCore/page/inspector/FontPanel.js b/WebCore/page/inspector/FontPanel.js deleted file mode 100644 index c1ffd2f..0000000 --- a/WebCore/page/inspector/FontPanel.js +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.FontPanel = function(resource) -{ - WebInspector.ResourcePanel.call(this, resource); - - this.element.addStyleClass("font"); - - var uniqueFontName = "WebInspectorFontPreview" + this.resource.identifier; - - this.fontPreviewElement = document.createElement("div"); - this.fontPreviewElement.className = "preview"; - this.element.appendChild(this.fontPreviewElement); - - this.fontPreviewElement.style.setProperty("font-family", uniqueFontName, null); - this.fontPreviewElement.innerHTML = "ABCDEFGHIJKLM<br>NOPQRSTUVWXYZ<br>abcdefghijklm<br>nopqrstuvwxyz<br>1234567890"; - - this.updateFontPreviewSize(); -} - -WebInspector.FontPanel.prototype = { - show: function() - { - WebInspector.ResourcePanel.prototype.show.call(this); - this.updateFontPreviewSize(); - }, - - resize: function() - { - this.updateFontPreviewSize(); - }, - - updateFontPreviewSize: function () - { - if (!this.fontPreviewElement || !this.visible) - return; - - this.fontPreviewElement.removeStyleClass("preview"); - - var measureFontSize = 50; - this.fontPreviewElement.style.setProperty("position", "absolute", null); - this.fontPreviewElement.style.setProperty("font-size", measureFontSize + "px", null); - this.fontPreviewElement.style.removeProperty("height"); - - var height = this.fontPreviewElement.offsetHeight; - var width = this.fontPreviewElement.offsetWidth; - - var containerHeight = this.element.offsetHeight; - var containerWidth = this.element.offsetWidth; - - if (!height || !width || !containerHeight || !containerWidth) { - this.fontPreviewElement.style.removeProperty("font-size"); - this.fontPreviewElement.style.removeProperty("position"); - this.fontPreviewElement.addStyleClass("preview"); - return; - } - - var lineCount = this.fontPreviewElement.getElementsByTagName("br").length + 1; - var realLineHeight = Math.floor(height / lineCount); - var fontSizeLineRatio = measureFontSize / realLineHeight; - var widthRatio = containerWidth / width; - var heightRatio = containerHeight / height; - - if (heightRatio < widthRatio) - var finalFontSize = Math.floor(realLineHeight * heightRatio * fontSizeLineRatio) - 1; - else - var finalFontSize = Math.floor(realLineHeight * widthRatio * fontSizeLineRatio) - 1; - - this.fontPreviewElement.style.setProperty("font-size", finalFontSize + "px", null); - this.fontPreviewElement.style.setProperty("height", this.fontPreviewElement.offsetHeight + "px", null); - this.fontPreviewElement.style.removeProperty("position"); - - this.fontPreviewElement.addStyleClass("preview"); - } -} - -WebInspector.FontPanel.prototype.__proto__ = WebInspector.ResourcePanel.prototype; diff --git a/WebCore/page/inspector/ImagePanel.js b/WebCore/page/inspector/ImagePanel.js deleted file mode 100644 index 402b754..0000000 --- a/WebCore/page/inspector/ImagePanel.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.ImagePanel = function(resource) -{ - WebInspector.ResourcePanel.call(this, resource); - - this.element.addStyleClass("image"); - - var container = document.createElement("div"); - container.className = "image"; - this.element.appendChild(container); - - this.imagePreviewElement = document.createElement("img"); - this.imagePreviewElement.setAttribute("src", this.resource.url); - - container.appendChild(this.imagePreviewElement); - - container = document.createElement("div"); - container.className = "info"; - this.element.appendChild(container); - - var imageNameElement = document.createElement("h1"); - imageNameElement.className = "title"; - imageNameElement.textContent = this.resource.displayName; - container.appendChild(imageNameElement); - - var infoListElement = document.createElement("dl"); - infoListElement.className = "infoList"; - - var imageProperties = [ - { name: WebInspector.UIString("Dimensions"), value: WebInspector.UIString("%d × %d", this.imagePreviewElement.naturalWidth, this.imagePreviewElement.height) }, - { name: WebInspector.UIString("File size"), value: WebInspector.UIString("%.2fKB", (this.resource.contentLength / 1024)) }, - { name: WebInspector.UIString("MIME type"), value: this.resource.mimeType } - ]; - - var listHTML = ''; - for (var i = 0; i < imageProperties.length; ++i) - listHTML += "<dt>" + imageProperties[i].name + "</dt><dd>" + imageProperties[i].value + "</dd>"; - - infoListElement.innerHTML = listHTML; - container.appendChild(infoListElement); -} - -WebInspector.ImagePanel.prototype = { - -} - -WebInspector.ImagePanel.prototype.__proto__ = WebInspector.ResourcePanel.prototype; diff --git a/WebCore/page/inspector/Images/alternateTableRows.png b/WebCore/page/inspector/Images/alternateTableRows.png Binary files differdeleted file mode 100644 index 7706f50..0000000 --- a/WebCore/page/inspector/Images/alternateTableRows.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/attachedShadow.png b/WebCore/page/inspector/Images/attachedShadow.png Binary files differdeleted file mode 100644 index b0b687c..0000000 --- a/WebCore/page/inspector/Images/attachedShadow.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/backNormal.png b/WebCore/page/inspector/Images/backNormal.png Binary files differdeleted file mode 100644 index cff21a5..0000000 --- a/WebCore/page/inspector/Images/backNormal.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/bottomShadow.png b/WebCore/page/inspector/Images/bottomShadow.png Binary files differdeleted file mode 100644 index 61699c4..0000000 --- a/WebCore/page/inspector/Images/bottomShadow.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/breadcrumbBackground.png b/WebCore/page/inspector/Images/breadcrumbBackground.png Binary files differdeleted file mode 100644 index 516452b..0000000 --- a/WebCore/page/inspector/Images/breadcrumbBackground.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/checker.png b/WebCore/page/inspector/Images/checker.png Binary files differdeleted file mode 100644 index 8349908..0000000 --- a/WebCore/page/inspector/Images/checker.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/console.png b/WebCore/page/inspector/Images/console.png Binary files differdeleted file mode 100644 index c85fed0..0000000 --- a/WebCore/page/inspector/Images/console.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/darkShadow.png b/WebCore/page/inspector/Images/darkShadow.png Binary files differdeleted file mode 100644 index 2761b7d..0000000 --- a/WebCore/page/inspector/Images/darkShadow.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/database.png b/WebCore/page/inspector/Images/database.png Binary files differdeleted file mode 100644 index 2c13789..0000000 --- a/WebCore/page/inspector/Images/database.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/databaseBrowserViewNormal.png b/WebCore/page/inspector/Images/databaseBrowserViewNormal.png Binary files differdeleted file mode 100644 index 0d55522..0000000 --- a/WebCore/page/inspector/Images/databaseBrowserViewNormal.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/databaseBrowserViewNormalSelected.png b/WebCore/page/inspector/Images/databaseBrowserViewNormalSelected.png Binary files differdeleted file mode 100644 index af32982..0000000 --- a/WebCore/page/inspector/Images/databaseBrowserViewNormalSelected.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/databaseBrowserViewSmall.png b/WebCore/page/inspector/Images/databaseBrowserViewSmall.png Binary files differdeleted file mode 100644 index fa33eec..0000000 --- a/WebCore/page/inspector/Images/databaseBrowserViewSmall.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/databaseBrowserViewSmallSelected.png b/WebCore/page/inspector/Images/databaseBrowserViewSmallSelected.png Binary files differdeleted file mode 100644 index 6880954..0000000 --- a/WebCore/page/inspector/Images/databaseBrowserViewSmallSelected.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/databaseQueryViewNormal.png b/WebCore/page/inspector/Images/databaseQueryViewNormal.png Binary files differdeleted file mode 100644 index 326e8c3..0000000 --- a/WebCore/page/inspector/Images/databaseQueryViewNormal.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/databaseQueryViewNormalSelected.png b/WebCore/page/inspector/Images/databaseQueryViewNormalSelected.png Binary files differdeleted file mode 100644 index 8ffda5c..0000000 --- a/WebCore/page/inspector/Images/databaseQueryViewNormalSelected.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/databaseQueryViewSmall.png b/WebCore/page/inspector/Images/databaseQueryViewSmall.png Binary files differdeleted file mode 100644 index d11a127..0000000 --- a/WebCore/page/inspector/Images/databaseQueryViewSmall.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/databaseQueryViewSmallSelected.png b/WebCore/page/inspector/Images/databaseQueryViewSmallSelected.png Binary files differdeleted file mode 100644 index 35be952..0000000 --- a/WebCore/page/inspector/Images/databaseQueryViewSmallSelected.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/disclosureDownPressed.png b/WebCore/page/inspector/Images/disclosureDownPressed.png Binary files differdeleted file mode 100644 index 32ac517..0000000 --- a/WebCore/page/inspector/Images/disclosureDownPressed.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/disclosureRightDown.png b/WebCore/page/inspector/Images/disclosureRightDown.png Binary files differdeleted file mode 100644 index 104ea86..0000000 --- a/WebCore/page/inspector/Images/disclosureRightDown.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/disclosureRightPressed.png b/WebCore/page/inspector/Images/disclosureRightPressed.png Binary files differdeleted file mode 100644 index 41c9b20..0000000 --- a/WebCore/page/inspector/Images/disclosureRightPressed.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/document.png b/WebCore/page/inspector/Images/document.png Binary files differdeleted file mode 100644 index fa9c3f5..0000000 --- a/WebCore/page/inspector/Images/document.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/domViewNormal.png b/WebCore/page/inspector/Images/domViewNormal.png Binary files differdeleted file mode 100644 index 6cd4ac4..0000000 --- a/WebCore/page/inspector/Images/domViewNormal.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/domViewNormalSelected.png b/WebCore/page/inspector/Images/domViewNormalSelected.png Binary files differdeleted file mode 100644 index 5831819..0000000 --- a/WebCore/page/inspector/Images/domViewNormalSelected.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/domViewSmall.png b/WebCore/page/inspector/Images/domViewSmall.png Binary files differdeleted file mode 100644 index e9fb0da..0000000 --- a/WebCore/page/inspector/Images/domViewSmall.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/domViewSmallSelected.png b/WebCore/page/inspector/Images/domViewSmallSelected.png Binary files differdeleted file mode 100644 index 517479d..0000000 --- a/WebCore/page/inspector/Images/domViewSmallSelected.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/downTriangle.png b/WebCore/page/inspector/Images/downTriangle.png Binary files differdeleted file mode 100644 index 18a2a89..0000000 --- a/WebCore/page/inspector/Images/downTriangle.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/errorIcon.png b/WebCore/page/inspector/Images/errorIcon.png Binary files differdeleted file mode 100644 index d6ec461..0000000 --- a/WebCore/page/inspector/Images/errorIcon.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/errorMediumIcon.png b/WebCore/page/inspector/Images/errorMediumIcon.png Binary files differdeleted file mode 100644 index 6ca32bb..0000000 --- a/WebCore/page/inspector/Images/errorMediumIcon.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/folder.png b/WebCore/page/inspector/Images/folder.png Binary files differdeleted file mode 100644 index 9bd7d9e..0000000 --- a/WebCore/page/inspector/Images/folder.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/forwardNormal.png b/WebCore/page/inspector/Images/forwardNormal.png Binary files differdeleted file mode 100644 index 5cb2c1b..0000000 --- a/WebCore/page/inspector/Images/forwardNormal.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/glossyHeader.png b/WebCore/page/inspector/Images/glossyHeader.png Binary files differdeleted file mode 100644 index 8c80b6b..0000000 --- a/WebCore/page/inspector/Images/glossyHeader.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/glossyHeaderPressed.png b/WebCore/page/inspector/Images/glossyHeaderPressed.png Binary files differdeleted file mode 100644 index 6b0dd60..0000000 --- a/WebCore/page/inspector/Images/glossyHeaderPressed.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/goArrow.png b/WebCore/page/inspector/Images/goArrow.png Binary files differdeleted file mode 100644 index f318a56..0000000 --- a/WebCore/page/inspector/Images/goArrow.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/gradient.png b/WebCore/page/inspector/Images/gradient.png Binary files differdeleted file mode 100644 index aa8568b..0000000 --- a/WebCore/page/inspector/Images/gradient.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/gradientHighlight.png b/WebCore/page/inspector/Images/gradientHighlight.png Binary files differdeleted file mode 100644 index 93bc9c1..0000000 --- a/WebCore/page/inspector/Images/gradientHighlight.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/gradientHighlightBottom.png b/WebCore/page/inspector/Images/gradientHighlightBottom.png Binary files differdeleted file mode 100644 index 89b0b67..0000000 --- a/WebCore/page/inspector/Images/gradientHighlightBottom.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/hideStatusWidget.png b/WebCore/page/inspector/Images/hideStatusWidget.png Binary files differdeleted file mode 100644 index 52ecece..0000000 --- a/WebCore/page/inspector/Images/hideStatusWidget.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/hideStatusWidgetPressed.png b/WebCore/page/inspector/Images/hideStatusWidgetPressed.png Binary files differdeleted file mode 100644 index f041662..0000000 --- a/WebCore/page/inspector/Images/hideStatusWidgetPressed.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/network.png b/WebCore/page/inspector/Images/network.png Binary files differdeleted file mode 100644 index bc215bc..0000000 --- a/WebCore/page/inspector/Images/network.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/paneBottomGrow.png b/WebCore/page/inspector/Images/paneBottomGrow.png Binary files differdeleted file mode 100644 index d55b865..0000000 --- a/WebCore/page/inspector/Images/paneBottomGrow.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/paneBottomGrowActive.png b/WebCore/page/inspector/Images/paneBottomGrowActive.png Binary files differdeleted file mode 100644 index ef3f259..0000000 --- a/WebCore/page/inspector/Images/paneBottomGrowActive.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/paneGrowHandleLine.png b/WebCore/page/inspector/Images/paneGrowHandleLine.png Binary files differdeleted file mode 100644 index 4eaf61b..0000000 --- a/WebCore/page/inspector/Images/paneGrowHandleLine.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/paneHeader.png b/WebCore/page/inspector/Images/paneHeader.png Binary files differdeleted file mode 100644 index cc66afa..0000000 --- a/WebCore/page/inspector/Images/paneHeader.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/paneHeaderActive.png b/WebCore/page/inspector/Images/paneHeaderActive.png Binary files differdeleted file mode 100644 index 08205fb..0000000 --- a/WebCore/page/inspector/Images/paneHeaderActive.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/plainDocument.png b/WebCore/page/inspector/Images/plainDocument.png Binary files differdeleted file mode 100644 index 2e92b71..0000000 --- a/WebCore/page/inspector/Images/plainDocument.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/popupArrows.png b/WebCore/page/inspector/Images/popupArrows.png Binary files differdeleted file mode 100644 index b980e46..0000000 --- a/WebCore/page/inspector/Images/popupArrows.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/popupArrowsBlack.png b/WebCore/page/inspector/Images/popupArrowsBlack.png Binary files differdeleted file mode 100644 index 9c9b061..0000000 --- a/WebCore/page/inspector/Images/popupArrowsBlack.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/reload.png b/WebCore/page/inspector/Images/reload.png Binary files differdeleted file mode 100644 index 9797d26..0000000 --- a/WebCore/page/inspector/Images/reload.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/rightTriangle.png b/WebCore/page/inspector/Images/rightTriangle.png Binary files differdeleted file mode 100644 index 9f519f2..0000000 --- a/WebCore/page/inspector/Images/rightTriangle.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/segment.png b/WebCore/page/inspector/Images/segment.png Binary files differdeleted file mode 100644 index bcef26a..0000000 --- a/WebCore/page/inspector/Images/segment.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/segmentEnd.png b/WebCore/page/inspector/Images/segmentEnd.png Binary files differdeleted file mode 100644 index 374a53d..0000000 --- a/WebCore/page/inspector/Images/segmentEnd.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/segmentHover.png b/WebCore/page/inspector/Images/segmentHover.png Binary files differdeleted file mode 100644 index f54c029..0000000 --- a/WebCore/page/inspector/Images/segmentHover.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/segmentHoverEnd.png b/WebCore/page/inspector/Images/segmentHoverEnd.png Binary files differdeleted file mode 100644 index e377c2d..0000000 --- a/WebCore/page/inspector/Images/segmentHoverEnd.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/segmentSelected.png b/WebCore/page/inspector/Images/segmentSelected.png Binary files differdeleted file mode 100644 index a7f3a8f..0000000 --- a/WebCore/page/inspector/Images/segmentSelected.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/segmentSelectedEnd.png b/WebCore/page/inspector/Images/segmentSelectedEnd.png Binary files differdeleted file mode 100644 index be2c61b..0000000 --- a/WebCore/page/inspector/Images/segmentSelectedEnd.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/showStatusWidget.png b/WebCore/page/inspector/Images/showStatusWidget.png Binary files differdeleted file mode 100644 index 051d883..0000000 --- a/WebCore/page/inspector/Images/showStatusWidget.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/showStatusWidgetPressed.png b/WebCore/page/inspector/Images/showStatusWidgetPressed.png Binary files differdeleted file mode 100644 index 5622c9c..0000000 --- a/WebCore/page/inspector/Images/showStatusWidgetPressed.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sidbarItemBackground.png b/WebCore/page/inspector/Images/sidbarItemBackground.png Binary files differdeleted file mode 100644 index 5b94167..0000000 --- a/WebCore/page/inspector/Images/sidbarItemBackground.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sidebarActionWidget.png b/WebCore/page/inspector/Images/sidebarActionWidget.png Binary files differdeleted file mode 100644 index daa1aff..0000000 --- a/WebCore/page/inspector/Images/sidebarActionWidget.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sidebarActionWidgetPressed.png b/WebCore/page/inspector/Images/sidebarActionWidgetPressed.png Binary files differdeleted file mode 100644 index 794b187..0000000 --- a/WebCore/page/inspector/Images/sidebarActionWidgetPressed.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sidebarAttachWidget.png b/WebCore/page/inspector/Images/sidebarAttachWidget.png Binary files differdeleted file mode 100644 index 5f13f36..0000000 --- a/WebCore/page/inspector/Images/sidebarAttachWidget.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sidebarAttachWidgetPressed.png b/WebCore/page/inspector/Images/sidebarAttachWidgetPressed.png Binary files differdeleted file mode 100644 index f70dd32..0000000 --- a/WebCore/page/inspector/Images/sidebarAttachWidgetPressed.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sidebarDetachWidget.png b/WebCore/page/inspector/Images/sidebarDetachWidget.png Binary files differdeleted file mode 100644 index 2443c21..0000000 --- a/WebCore/page/inspector/Images/sidebarDetachWidget.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sidebarDetachWidgetPressed.png b/WebCore/page/inspector/Images/sidebarDetachWidgetPressed.png Binary files differdeleted file mode 100644 index e13f4c1..0000000 --- a/WebCore/page/inspector/Images/sidebarDetachWidgetPressed.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sidebarResizeWidget.png b/WebCore/page/inspector/Images/sidebarResizeWidget.png Binary files differdeleted file mode 100644 index 7c1ff70..0000000 --- a/WebCore/page/inspector/Images/sidebarResizeWidget.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sidebarSelection.png b/WebCore/page/inspector/Images/sidebarSelection.png Binary files differdeleted file mode 100644 index fccfa0f..0000000 --- a/WebCore/page/inspector/Images/sidebarSelection.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sidebarSelectionBlurred.png b/WebCore/page/inspector/Images/sidebarSelectionBlurred.png Binary files differdeleted file mode 100644 index 1e49cdf..0000000 --- a/WebCore/page/inspector/Images/sidebarSelectionBlurred.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sidebarSelectionBlurredTall.png b/WebCore/page/inspector/Images/sidebarSelectionBlurredTall.png Binary files differdeleted file mode 100644 index 33a7cfc..0000000 --- a/WebCore/page/inspector/Images/sidebarSelectionBlurredTall.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sidebarSelectionGray.png b/WebCore/page/inspector/Images/sidebarSelectionGray.png Binary files differdeleted file mode 100644 index f4faf2c..0000000 --- a/WebCore/page/inspector/Images/sidebarSelectionGray.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sidebarSelectionGrayTall.png b/WebCore/page/inspector/Images/sidebarSelectionGrayTall.png Binary files differdeleted file mode 100644 index 01379d2..0000000 --- a/WebCore/page/inspector/Images/sidebarSelectionGrayTall.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sidebarSelectionTall.png b/WebCore/page/inspector/Images/sidebarSelectionTall.png Binary files differdeleted file mode 100644 index 0bb56da..0000000 --- a/WebCore/page/inspector/Images/sidebarSelectionTall.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sidebarStatusAreaBackground.png b/WebCore/page/inspector/Images/sidebarStatusAreaBackground.png Binary files differdeleted file mode 100644 index 0127d9d..0000000 --- a/WebCore/page/inspector/Images/sidebarStatusAreaBackground.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sourceViewNormal.png b/WebCore/page/inspector/Images/sourceViewNormal.png Binary files differdeleted file mode 100644 index 2b23460..0000000 --- a/WebCore/page/inspector/Images/sourceViewNormal.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sourceViewNormalSelected.png b/WebCore/page/inspector/Images/sourceViewNormalSelected.png Binary files differdeleted file mode 100644 index 0c24b1c..0000000 --- a/WebCore/page/inspector/Images/sourceViewNormalSelected.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sourceViewSmall.png b/WebCore/page/inspector/Images/sourceViewSmall.png Binary files differdeleted file mode 100644 index 82d06ef..0000000 --- a/WebCore/page/inspector/Images/sourceViewSmall.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/sourceViewSmallSelected.png b/WebCore/page/inspector/Images/sourceViewSmallSelected.png Binary files differdeleted file mode 100644 index fe0351e..0000000 --- a/WebCore/page/inspector/Images/sourceViewSmallSelected.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/splitviewDimple.png b/WebCore/page/inspector/Images/splitviewDimple.png Binary files differdeleted file mode 100644 index 584ffd4..0000000 --- a/WebCore/page/inspector/Images/splitviewDimple.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/splitviewDividerBackground.png b/WebCore/page/inspector/Images/splitviewDividerBackground.png Binary files differdeleted file mode 100644 index 1120a7f..0000000 --- a/WebCore/page/inspector/Images/splitviewDividerBackground.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/tab.png b/WebCore/page/inspector/Images/tab.png Binary files differdeleted file mode 100644 index 2f5000a..0000000 --- a/WebCore/page/inspector/Images/tab.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/tabSelected.png b/WebCore/page/inspector/Images/tabSelected.png Binary files differdeleted file mode 100644 index 76c2f66..0000000 --- a/WebCore/page/inspector/Images/tabSelected.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/timelinePillBlue.png b/WebCore/page/inspector/Images/timelinePillBlue.png Binary files differdeleted file mode 100644 index c897faa..0000000 --- a/WebCore/page/inspector/Images/timelinePillBlue.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/timelinePillGray.png b/WebCore/page/inspector/Images/timelinePillGray.png Binary files differdeleted file mode 100644 index 2128896..0000000 --- a/WebCore/page/inspector/Images/timelinePillGray.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/timelinePillGreen.png b/WebCore/page/inspector/Images/timelinePillGreen.png Binary files differdeleted file mode 100644 index 9b66125..0000000 --- a/WebCore/page/inspector/Images/timelinePillGreen.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/timelinePillOrange.png b/WebCore/page/inspector/Images/timelinePillOrange.png Binary files differdeleted file mode 100644 index dd944fb..0000000 --- a/WebCore/page/inspector/Images/timelinePillOrange.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/timelinePillPurple.png b/WebCore/page/inspector/Images/timelinePillPurple.png Binary files differdeleted file mode 100644 index 21b96f7..0000000 --- a/WebCore/page/inspector/Images/timelinePillPurple.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/timelinePillRed.png b/WebCore/page/inspector/Images/timelinePillRed.png Binary files differdeleted file mode 100644 index f5e213b..0000000 --- a/WebCore/page/inspector/Images/timelinePillRed.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/timelinePillYellow.png b/WebCore/page/inspector/Images/timelinePillYellow.png Binary files differdeleted file mode 100644 index ae2a5a2..0000000 --- a/WebCore/page/inspector/Images/timelinePillYellow.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/tipBalloon.png b/WebCore/page/inspector/Images/tipBalloon.png Binary files differdeleted file mode 100644 index 4cdf738..0000000 --- a/WebCore/page/inspector/Images/tipBalloon.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/tipBalloonBottom.png b/WebCore/page/inspector/Images/tipBalloonBottom.png Binary files differdeleted file mode 100644 index 3317a5a..0000000 --- a/WebCore/page/inspector/Images/tipBalloonBottom.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/tipIcon.png b/WebCore/page/inspector/Images/tipIcon.png Binary files differdeleted file mode 100644 index 8ca6124..0000000 --- a/WebCore/page/inspector/Images/tipIcon.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/tipIconPressed.png b/WebCore/page/inspector/Images/tipIconPressed.png Binary files differdeleted file mode 100644 index 443e410..0000000 --- a/WebCore/page/inspector/Images/tipIconPressed.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toggleDown.png b/WebCore/page/inspector/Images/toggleDown.png Binary files differdeleted file mode 100644 index 9e73bfb..0000000 --- a/WebCore/page/inspector/Images/toggleDown.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toggleUp.png b/WebCore/page/inspector/Images/toggleUp.png Binary files differdeleted file mode 100644 index 6b62aee..0000000 --- a/WebCore/page/inspector/Images/toggleUp.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarBackground.png b/WebCore/page/inspector/Images/toolbarBackground.png Binary files differdeleted file mode 100644 index 257d63d..0000000 --- a/WebCore/page/inspector/Images/toolbarBackground.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarBackgroundInactive.png b/WebCore/page/inspector/Images/toolbarBackgroundInactive.png Binary files differdeleted file mode 100644 index a62b8df..0000000 --- a/WebCore/page/inspector/Images/toolbarBackgroundInactive.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarButtonNormal.png b/WebCore/page/inspector/Images/toolbarButtonNormal.png Binary files differdeleted file mode 100644 index bd16c12..0000000 --- a/WebCore/page/inspector/Images/toolbarButtonNormal.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarButtonNormalInactive.png b/WebCore/page/inspector/Images/toolbarButtonNormalInactive.png Binary files differdeleted file mode 100644 index 3c9d5bc..0000000 --- a/WebCore/page/inspector/Images/toolbarButtonNormalInactive.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarButtonNormalPressed.png b/WebCore/page/inspector/Images/toolbarButtonNormalPressed.png Binary files differdeleted file mode 100644 index aca9b02..0000000 --- a/WebCore/page/inspector/Images/toolbarButtonNormalPressed.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarButtonNormalSelected.png b/WebCore/page/inspector/Images/toolbarButtonNormalSelected.png Binary files differdeleted file mode 100644 index 41013b3..0000000 --- a/WebCore/page/inspector/Images/toolbarButtonNormalSelected.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarButtonNormalSelectedInactive.png b/WebCore/page/inspector/Images/toolbarButtonNormalSelectedInactive.png Binary files differdeleted file mode 100644 index f6fdb08..0000000 --- a/WebCore/page/inspector/Images/toolbarButtonNormalSelectedInactive.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarButtonSmall.png b/WebCore/page/inspector/Images/toolbarButtonSmall.png Binary files differdeleted file mode 100644 index 04398fd..0000000 --- a/WebCore/page/inspector/Images/toolbarButtonSmall.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarButtonSmallInactive.png b/WebCore/page/inspector/Images/toolbarButtonSmallInactive.png Binary files differdeleted file mode 100644 index a6928be..0000000 --- a/WebCore/page/inspector/Images/toolbarButtonSmallInactive.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarButtonSmallPressed.png b/WebCore/page/inspector/Images/toolbarButtonSmallPressed.png Binary files differdeleted file mode 100644 index 0d83a38..0000000 --- a/WebCore/page/inspector/Images/toolbarButtonSmallPressed.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarButtonSmallSelected.png b/WebCore/page/inspector/Images/toolbarButtonSmallSelected.png Binary files differdeleted file mode 100644 index d5433cb..0000000 --- a/WebCore/page/inspector/Images/toolbarButtonSmallSelected.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarButtonSmallSelectedInactive.png b/WebCore/page/inspector/Images/toolbarButtonSmallSelectedInactive.png Binary files differdeleted file mode 100644 index 41a3249..0000000 --- a/WebCore/page/inspector/Images/toolbarButtonSmallSelectedInactive.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarPopupButtonNormal.png b/WebCore/page/inspector/Images/toolbarPopupButtonNormal.png Binary files differdeleted file mode 100644 index 438b5ea..0000000 --- a/WebCore/page/inspector/Images/toolbarPopupButtonNormal.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarPopupButtonNormalInactive.png b/WebCore/page/inspector/Images/toolbarPopupButtonNormalInactive.png Binary files differdeleted file mode 100644 index 0e8f6a2..0000000 --- a/WebCore/page/inspector/Images/toolbarPopupButtonNormalInactive.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarPopupButtonNormalPressed.png b/WebCore/page/inspector/Images/toolbarPopupButtonNormalPressed.png Binary files differdeleted file mode 100644 index 23bcafd..0000000 --- a/WebCore/page/inspector/Images/toolbarPopupButtonNormalPressed.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarPopupButtonSmall.png b/WebCore/page/inspector/Images/toolbarPopupButtonSmall.png Binary files differdeleted file mode 100644 index efa68a3..0000000 --- a/WebCore/page/inspector/Images/toolbarPopupButtonSmall.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarPopupButtonSmallInactive.png b/WebCore/page/inspector/Images/toolbarPopupButtonSmallInactive.png Binary files differdeleted file mode 100644 index 55e3c0c..0000000 --- a/WebCore/page/inspector/Images/toolbarPopupButtonSmallInactive.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarPopupButtonSmallPressed.png b/WebCore/page/inspector/Images/toolbarPopupButtonSmallPressed.png Binary files differdeleted file mode 100644 index 56e574c..0000000 --- a/WebCore/page/inspector/Images/toolbarPopupButtonSmallPressed.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarSplitButtonDividerNormal.png b/WebCore/page/inspector/Images/toolbarSplitButtonDividerNormal.png Binary files differdeleted file mode 100644 index bf6de38..0000000 --- a/WebCore/page/inspector/Images/toolbarSplitButtonDividerNormal.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarSplitButtonDividerNormalInactive.png b/WebCore/page/inspector/Images/toolbarSplitButtonDividerNormalInactive.png Binary files differdeleted file mode 100644 index c61541c..0000000 --- a/WebCore/page/inspector/Images/toolbarSplitButtonDividerNormalInactive.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarSplitButtonDividerSmall.png b/WebCore/page/inspector/Images/toolbarSplitButtonDividerSmall.png Binary files differdeleted file mode 100644 index 9f248f6..0000000 --- a/WebCore/page/inspector/Images/toolbarSplitButtonDividerSmall.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/toolbarSplitButtonDividerSmallInactive.png b/WebCore/page/inspector/Images/toolbarSplitButtonDividerSmallInactive.png Binary files differdeleted file mode 100644 index 7365c34..0000000 --- a/WebCore/page/inspector/Images/toolbarSplitButtonDividerSmallInactive.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/treeDownTriangleBlack.png b/WebCore/page/inspector/Images/treeDownTriangleBlack.png Binary files differdeleted file mode 100644 index 0821112..0000000 --- a/WebCore/page/inspector/Images/treeDownTriangleBlack.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/treeDownTriangleWhite.png b/WebCore/page/inspector/Images/treeDownTriangleWhite.png Binary files differdeleted file mode 100644 index 1667b51..0000000 --- a/WebCore/page/inspector/Images/treeDownTriangleWhite.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/treeLeftTriangleBlack.png b/WebCore/page/inspector/Images/treeLeftTriangleBlack.png Binary files differdeleted file mode 100644 index 81bc7e0..0000000 --- a/WebCore/page/inspector/Images/treeLeftTriangleBlack.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/treeRightTriangleBlack.png b/WebCore/page/inspector/Images/treeRightTriangleBlack.png Binary files differdeleted file mode 100644 index 90de820..0000000 --- a/WebCore/page/inspector/Images/treeRightTriangleBlack.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/treeRightTriangleWhite.png b/WebCore/page/inspector/Images/treeRightTriangleWhite.png Binary files differdeleted file mode 100644 index 2b6a82f..0000000 --- a/WebCore/page/inspector/Images/treeRightTriangleWhite.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/warningIcon.png b/WebCore/page/inspector/Images/warningIcon.png Binary files differdeleted file mode 100644 index f37727e..0000000 --- a/WebCore/page/inspector/Images/warningIcon.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/warningMediumIcon.png b/WebCore/page/inspector/Images/warningMediumIcon.png Binary files differdeleted file mode 100644 index 291e111..0000000 --- a/WebCore/page/inspector/Images/warningMediumIcon.png +++ /dev/null diff --git a/WebCore/page/inspector/Images/warningsErrors.png b/WebCore/page/inspector/Images/warningsErrors.png Binary files differdeleted file mode 100644 index 878b593..0000000 --- a/WebCore/page/inspector/Images/warningsErrors.png +++ /dev/null diff --git a/WebCore/page/inspector/MetricsSidebarPane.js b/WebCore/page/inspector/MetricsSidebarPane.js deleted file mode 100644 index e805560..0000000 --- a/WebCore/page/inspector/MetricsSidebarPane.js +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.MetricsSidebarPane = function() -{ - WebInspector.SidebarPane.call(this, WebInspector.UIString("Metrics")); -} - -WebInspector.MetricsSidebarPane.prototype = { - update: function(node) - { - var body = this.bodyElement; - - body.removeChildren(); - - if (!node) - return; - - var style; - if (node.nodeType === Node.ELEMENT_NODE) - style = node.ownerDocument.defaultView.getComputedStyle(node); - if (!style) - return; - - var metricsElement = document.createElement("div"); - metricsElement.className = "metrics"; - - function boxPartValue(style, name, suffix) - { - var value = style.getPropertyValue(name + suffix); - if (value === "" || value === "0px") - value = "\u2012"; - return value.replace(/px$/, ""); - } - - // Display types for which margin is ignored. - var noMarginDisplayType = { - "table-cell": true, - "table-column": true, - "table-column-group": true, - "table-footer-group": true, - "table-header-group": true, - "table-row": true, - "table-row-group": true - }; - - // Display types for which padding is ignored. - var noPaddingDisplayType = { - "table-column": true, - "table-column-group": true, - "table-footer-group": true, - "table-header-group": true, - "table-row": true, - "table-row-group": true - }; - - var boxes = ["content", "padding", "border", "margin"]; - var boxLabels = [WebInspector.UIString("content"), WebInspector.UIString("padding"), WebInspector.UIString("border"), WebInspector.UIString("margin")]; - var previousBox; - for (var i = 0; i < boxes.length; ++i) { - var name = boxes[i]; - - if (name === "margin" && noMarginDisplayType[style.display]) - continue; - if (name === "padding" && noPaddingDisplayType[style.display]) - continue; - - var boxElement = document.createElement("div"); - boxElement.className = name; - - if (name === "content") { - var width = style.width.replace(/px$/, ""); - var height = style.height.replace(/px$/, ""); - boxElement.textContent = width + " \u00D7 " + height; - } else { - var suffix = (name === "border" ? "-width" : ""); - - var labelElement = document.createElement("div"); - labelElement.className = "label"; - labelElement.textContent = boxLabels[i]; - boxElement.appendChild(labelElement); - - var topElement = document.createElement("div"); - topElement.className = "top"; - topElement.textContent = boxPartValue(style, name + "-top", suffix); - boxElement.appendChild(topElement); - - var leftElement = document.createElement("div"); - leftElement.className = "left"; - leftElement.textContent = boxPartValue(style, name + "-left", suffix); - boxElement.appendChild(leftElement); - - if (previousBox) - boxElement.appendChild(previousBox); - - var rightElement = document.createElement("div"); - rightElement.className = "right"; - rightElement.textContent = boxPartValue(style, name + "-right", suffix); - boxElement.appendChild(rightElement); - - var bottomElement = document.createElement("div"); - bottomElement.className = "bottom"; - bottomElement.textContent = boxPartValue(style, name + "-bottom", suffix); - boxElement.appendChild(bottomElement); - } - - previousBox = boxElement; - } - - metricsElement.appendChild(previousBox); - body.appendChild(metricsElement); - } -} - -WebInspector.MetricsSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; diff --git a/WebCore/page/inspector/NetworkPanel.js b/WebCore/page/inspector/NetworkPanel.js deleted file mode 100644 index 2f000ee..0000000 --- a/WebCore/page/inspector/NetworkPanel.js +++ /dev/null @@ -1,1036 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.NetworkPanel = function() -{ - WebInspector.Panel.call(this); - - this.timelineEntries = []; - - this.timelineElement = document.createElement("div"); - this.timelineElement.className = "network-timeline"; - this.element.appendChild(this.timelineElement); - - this.summaryElement = document.createElement("div"); - this.summaryElement.className = "network-summary"; - this.element.appendChild(this.summaryElement); - - this.dividersElement = document.createElement("div"); - this.dividersElement.className = "network-dividers"; - this.timelineElement.appendChild(this.dividersElement); - - this.resourcesElement = document.createElement("div"); - this.resourcesElement.className = "network-resources"; - this.resourcesElement.addEventListener("click", this.resourcesClicked.bind(this), false); - this.timelineElement.appendChild(this.resourcesElement); - - var graphArea = document.createElement("div"); - graphArea.className = "network-graph-area"; - this.summaryElement.appendChild(graphArea); - - this.graphLabelElement = document.createElement("div"); - this.graphLabelElement.className = "network-graph-label"; - graphArea.appendChild(this.graphLabelElement); - - this.graphModeSelectElement = document.createElement("select"); - this.graphModeSelectElement.className = "network-graph-mode"; - this.graphModeSelectElement.addEventListener("change", this.changeGraphMode.bind(this), false); - this.graphLabelElement.appendChild(this.graphModeSelectElement); - this.graphLabelElement.appendChild(document.createElement("br")); - - var sizeOptionElement = document.createElement("option"); - sizeOptionElement.calculator = new WebInspector.TransferSizeCalculator(); - sizeOptionElement.textContent = sizeOptionElement.calculator.title; - this.graphModeSelectElement.appendChild(sizeOptionElement); - - var timeOptionElement = document.createElement("option"); - timeOptionElement.calculator = new WebInspector.TransferTimeCalculator(); - timeOptionElement.textContent = timeOptionElement.calculator.title; - this.graphModeSelectElement.appendChild(timeOptionElement); - - var graphSideElement = document.createElement("div"); - graphSideElement.className = "network-graph-side"; - graphArea.appendChild(graphSideElement); - - this.summaryGraphElement = document.createElement("canvas"); - this.summaryGraphElement.setAttribute("width", "450"); - this.summaryGraphElement.setAttribute("height", "38"); - this.summaryGraphElement.className = "network-summary-graph"; - graphSideElement.appendChild(this.summaryGraphElement); - - this.legendElement = document.createElement("div"); - this.legendElement.className = "network-graph-legend"; - graphSideElement.appendChild(this.legendElement); - - this.drawSummaryGraph(); // draws an empty graph - - this.needsRefresh = true; -} - -WebInspector.NetworkPanel.prototype = { - show: function() - { - WebInspector.Panel.prototype.show.call(this); - WebInspector.networkListItem.select(); - this.refreshIfNeeded(); - }, - - hide: function() - { - WebInspector.Panel.prototype.hide.call(this); - WebInspector.networkListItem.deselect(); - }, - - resize: function() - { - this.updateTimelineDividersIfNeeded(); - }, - - resourcesClicked: function(event) - { - // If the click wasn't inside a network resource row, ignore it. - var resourceElement = event.target.firstParentOrSelfWithClass("network-resource"); - if (!resourceElement) - return; - - // If the click was within the network info element, ignore it. - var networkInfo = event.target.firstParentOrSelfWithClass("network-info"); - if (networkInfo) - return; - - // If the click was within the tip balloon element, hide it. - var balloon = event.target.firstParentOrSelfWithClass("tip-balloon"); - if (balloon) { - resourceElement.timelineEntry.showingTipBalloon = false; - return; - } - - resourceElement.timelineEntry.toggleShowingInfo(); - }, - - changeGraphMode: function(event) - { - this.updateSummaryGraph(); - }, - - get calculator() - { - return this.graphModeSelectElement.options[this.graphModeSelectElement.selectedIndex].calculator; - }, - - get totalDuration() - { - return this.latestEndTime - this.earliestStartTime; - }, - - get needsRefresh() - { - return this._needsRefresh; - }, - - set needsRefresh(x) - { - if (this._needsRefresh === x) - return; - this._needsRefresh = x; - if (x && this.visible) - this.refresh(); - }, - - refreshIfNeeded: function() - { - if (this.needsRefresh) - this.refresh(); - }, - - refresh: function() - { - this.needsRefresh = false; - - // calling refresh will call updateTimelineBoundriesIfNeeded, which can clear needsRefresh for future entries, - // so find all the entries that needs refresh first, then loop back trough them to call refresh - var entriesNeedingRefresh = []; - var entriesLength = this.timelineEntries.length; - for (var i = 0; i < entriesLength; ++i) { - var entry = this.timelineEntries[i]; - if (entry.needsRefresh || entry.infoNeedsRefresh) - entriesNeedingRefresh.push(entry); - } - - entriesLength = entriesNeedingRefresh.length; - for (var i = 0; i < entriesLength; ++i) - entriesNeedingRefresh[i].refresh(false, true, true); - - this.updateTimelineDividersIfNeeded(); - this.sortTimelineEntriesIfNeeded(); - this.updateSummaryGraph(); - }, - - makeLegendElement: function(label, value, color) - { - var legendElement = document.createElement("label"); - legendElement.className = "network-graph-legend-item"; - - if (color) { - var swatch = document.createElement("canvas"); - swatch.className = "network-graph-legend-swatch"; - swatch.setAttribute("width", "13"); - swatch.setAttribute("height", "24"); - - legendElement.appendChild(swatch); - - this.drawSwatch(swatch, color); - } - - var labelElement = document.createElement("div"); - labelElement.className = "network-graph-legend-label"; - legendElement.appendChild(labelElement); - - var headerElement = document.createElement("div"); - var headerElement = document.createElement("div"); - headerElement.className = "network-graph-legend-header"; - headerElement.textContent = label; - labelElement.appendChild(headerElement); - - var valueElement = document.createElement("div"); - valueElement.className = "network-graph-legend-value"; - valueElement.textContent = value; - labelElement.appendChild(valueElement); - - return legendElement; - }, - - sortTimelineEntriesSoonIfNeeded: function() - { - if ("sortTimelineEntriesTimeout" in this) - return; - this.sortTimelineEntriesTimeout = setTimeout(this.sortTimelineEntriesIfNeeded.bind(this), 500); - }, - - sortTimelineEntriesIfNeeded: function() - { - if ("sortTimelineEntriesTimeout" in this) { - clearTimeout(this.sortTimelineEntriesTimeout); - delete this.sortTimelineEntriesTimeout; - } - - this.timelineEntries.sort(WebInspector.NetworkPanel.timelineEntryCompare); - - var nextSibling = null; - for (var i = (this.timelineEntries.length - 1); i >= 0; --i) { - var entry = this.timelineEntries[i]; - if (entry.resourceElement.nextSibling !== nextSibling) - this.resourcesElement.insertBefore(entry.resourceElement, nextSibling); - nextSibling = entry.resourceElement; - } - }, - - updateTimelineBoundriesIfNeeded: function(resource, immediate) - { - var didUpdate = false; - if (resource.startTime !== -1 && (this.earliestStartTime === undefined || resource.startTime < this.earliestStartTime)) { - this.earliestStartTime = resource.startTime; - didUpdate = true; - } - - if (resource.endTime !== -1 && (this.latestEndTime === undefined || resource.endTime > this.latestEndTime)) { - this.latestEndTime = resource.endTime; - didUpdate = true; - } - - if (didUpdate) { - if (immediate) { - this.refreshAllTimelineEntries(true, true, immediate); - this.updateTimelineDividersIfNeeded(); - } else { - this.refreshAllTimelineEntriesSoon(true, true, immediate); - this.updateTimelineDividersSoonIfNeeded(); - } - } - - return didUpdate; - }, - - updateTimelineDividersSoonIfNeeded: function() - { - if ("updateTimelineDividersTimeout" in this) - return; - this.updateTimelineDividersTimeout = setTimeout(this.updateTimelineDividersIfNeeded.bind(this), 500); - }, - - updateTimelineDividersIfNeeded: function() - { - if ("updateTimelineDividersTimeout" in this) { - clearTimeout(this.updateTimelineDividersTimeout); - delete this.updateTimelineDividersTimeout; - } - - if (!this.visible) { - this.needsRefresh = true; - return; - } - - if (document.body.offsetWidth <= 0) { - // The stylesheet hasn't loaded yet, so we need to update later. - setTimeout(this.updateTimelineDividersIfNeeded.bind(this), 0); - return; - } - - var dividerCount = Math.round(this.dividersElement.offsetWidth / 64); - var timeSlice = this.totalDuration / dividerCount; - - if (this.lastDividerTimeSlice === timeSlice) - return; - - this.lastDividerTimeSlice = timeSlice; - - this.dividersElement.removeChildren(); - - for (var i = 1; i <= dividerCount; ++i) { - var divider = document.createElement("div"); - divider.className = "network-divider"; - if (i === dividerCount) - divider.addStyleClass("last"); - divider.style.left = ((i / dividerCount) * 100) + "%"; - - var label = document.createElement("div"); - label.className = "network-divider-label"; - label.textContent = Number.secondsToString(timeSlice * i); - divider.appendChild(label); - - this.dividersElement.appendChild(divider); - } - }, - - refreshAllTimelineEntriesSoon: function(skipBoundryUpdate, skipTimelineSort, immediate) - { - if ("refreshAllTimelineEntriesTimeout" in this) - return; - this.refreshAllTimelineEntriesTimeout = setTimeout(this.refreshAllTimelineEntries.bind(this), 500, skipBoundryUpdate, skipTimelineSort, immediate); - }, - - refreshAllTimelineEntries: function(skipBoundryUpdate, skipTimelineSort, immediate) - { - if ("refreshAllTimelineEntriesTimeout" in this) { - clearTimeout(this.refreshAllTimelineEntriesTimeout); - delete this.refreshAllTimelineEntriesTimeout; - } - - var entriesLength = this.timelineEntries.length; - for (var i = 0; i < entriesLength; ++i) - this.timelineEntries[i].refresh(skipBoundryUpdate, skipTimelineSort, immediate); - }, - - fadeOutRect: function(ctx, x, y, w, h, a1, a2) - { - ctx.save(); - - var gradient = ctx.createLinearGradient(x, y, x, y + h); - gradient.addColorStop(0.0, "rgba(0, 0, 0, " + (1.0 - a1) + ")"); - gradient.addColorStop(0.8, "rgba(0, 0, 0, " + (1.0 - a2) + ")"); - gradient.addColorStop(1.0, "rgba(0, 0, 0, 1.0)"); - - ctx.globalCompositeOperation = "destination-out"; - - ctx.fillStyle = gradient; - ctx.fillRect(x, y, w, h); - - ctx.restore(); - }, - - drawSwatch: function(canvas, color) - { - var ctx = canvas.getContext("2d"); - - function drawSwatchSquare() { - ctx.fillStyle = color; - ctx.fillRect(0, 0, 13, 13); - - var gradient = ctx.createLinearGradient(0, 0, 13, 13); - gradient.addColorStop(0.0, "rgba(255, 255, 255, 0.2)"); - gradient.addColorStop(1.0, "rgba(255, 255, 255, 0.0)"); - - ctx.fillStyle = gradient; - ctx.fillRect(0, 0, 13, 13); - - gradient = ctx.createLinearGradient(13, 13, 0, 0); - gradient.addColorStop(0.0, "rgba(0, 0, 0, 0.2)"); - gradient.addColorStop(1.0, "rgba(0, 0, 0, 0.0)"); - - ctx.fillStyle = gradient; - ctx.fillRect(0, 0, 13, 13); - - ctx.strokeStyle = "rgba(0, 0, 0, 0.6)"; - ctx.strokeRect(0.5, 0.5, 12, 12); - } - - ctx.clearRect(0, 0, 13, 24); - - drawSwatchSquare(); - - ctx.save(); - - ctx.translate(0, 25); - ctx.scale(1, -1); - - drawSwatchSquare(); - - ctx.restore(); - - this.fadeOutRect(ctx, 0, 13, 13, 13, 0.5, 0.0); - }, - - drawSummaryGraph: function(segments) - { - if (!this.summaryGraphElement) - return; - - if (!segments || !segments.length) - segments = [{color: "white", value: 1}]; - - // Calculate the total of all segments. - var total = 0; - for (var i = 0; i < segments.length; ++i) - total += segments[i].value; - - // Calculate the percentage of each segment, rounded to the nearest percent. - var percents = segments.map(function(s) { return Math.max(Math.round(100 * s.value / total), 1) }); - - // Calculate the total percentage. - var percentTotal = 0; - for (var i = 0; i < percents.length; ++i) - percentTotal += percents[i]; - - // Make sure our percentage total is not greater-than 100, it can be greater - // if we rounded up for a few segments. - while (percentTotal > 100) { - for (var i = 0; i < percents.length && percentTotal > 100; ++i) { - if (percents[i] > 1) { - --percents[i]; - --percentTotal; - } - } - } - - // Make sure our percentage total is not less-than 100, it can be less - // if we rounded down for a few segments. - while (percentTotal < 100) { - for (var i = 0; i < percents.length && percentTotal < 100; ++i) { - ++percents[i]; - ++percentTotal; - } - } - - var ctx = this.summaryGraphElement.getContext("2d"); - - var x = 0; - var y = 0; - var w = 450; - var h = 19; - var r = (h / 2); - - function drawPillShadow() - { - // This draws a line with a shadow that is offset away from the line. The line is stroked - // twice with different X shadow offsets to give more feathered edges. Later we erase the - // line with destination-out 100% transparent black, leaving only the shadow. This only - // works if nothing has been drawn into the canvas yet. - - ctx.beginPath(); - ctx.moveTo(x + 4, y + h - 3 - 0.5); - ctx.lineTo(x + w - 4, y + h - 3 - 0.5); - ctx.closePath(); - - ctx.save(); - - ctx.shadowBlur = 2; - ctx.shadowColor = "rgba(0, 0, 0, 0.5)"; - ctx.shadowOffsetX = 3; - ctx.shadowOffsetY = 5; - - ctx.strokeStyle = "white"; - ctx.lineWidth = 1; - - ctx.stroke(); - - ctx.shadowOffsetX = -3; - - ctx.stroke(); - - ctx.restore(); - - ctx.save(); - - ctx.globalCompositeOperation = "destination-out"; - ctx.strokeStyle = "rgba(0, 0, 0, 1)"; - ctx.lineWidth = 1; - - ctx.stroke(); - - ctx.restore(); - } - - function drawPill() - { - // Make a rounded rect path. - ctx.beginPath(); - ctx.moveTo(x, y + r); - ctx.lineTo(x, y + h - r); - ctx.quadraticCurveTo(x, y + h, x + r, y + h); - ctx.lineTo(x + w - r, y + h); - ctx.quadraticCurveTo(x + w, y + h, x + w, y + h - r); - ctx.lineTo(x + w, y + r); - ctx.quadraticCurveTo(x + w, y, x + w - r, y); - ctx.lineTo(x + r, y); - ctx.quadraticCurveTo(x, y, x, y + r); - ctx.closePath(); - - // Clip to the rounded rect path. - ctx.save(); - ctx.clip(); - - // Fill the segments with the associated color. - var previousSegmentsWidth = 0; - for (var i = 0; i < segments.length; ++i) { - var segmentWidth = Math.round(w * percents[i] / 100); - ctx.fillStyle = segments[i].color; - ctx.fillRect(x + previousSegmentsWidth, y, segmentWidth, h); - previousSegmentsWidth += segmentWidth; - } - - // Draw the segment divider lines. - ctx.lineWidth = 1; - for (var i = 1; i < 20; ++i) { - ctx.beginPath(); - ctx.moveTo(x + (i * Math.round(w / 20)) + 0.5, y); - ctx.lineTo(x + (i * Math.round(w / 20)) + 0.5, y + h); - ctx.closePath(); - - ctx.strokeStyle = "rgba(0, 0, 0, 0.2)"; - ctx.stroke(); - - ctx.beginPath(); - ctx.moveTo(x + (i * Math.round(w / 20)) + 1.5, y); - ctx.lineTo(x + (i * Math.round(w / 20)) + 1.5, y + h); - ctx.closePath(); - - ctx.strokeStyle = "rgba(255, 255, 255, 0.2)"; - ctx.stroke(); - } - - // Draw the pill shading. - var lightGradient = ctx.createLinearGradient(x, y, x, y + (h / 1.5)); - lightGradient.addColorStop(0.0, "rgba(220, 220, 220, 0.6)"); - lightGradient.addColorStop(0.4, "rgba(220, 220, 220, 0.2)"); - lightGradient.addColorStop(1.0, "rgba(255, 255, 255, 0.0)"); - - var darkGradient = ctx.createLinearGradient(x, y + (h / 3), x, y + h); - darkGradient.addColorStop(0.0, "rgba(0, 0, 0, 0.0)"); - darkGradient.addColorStop(0.8, "rgba(0, 0, 0, 0.2)"); - darkGradient.addColorStop(1.0, "rgba(0, 0, 0, 0.5)"); - - ctx.fillStyle = darkGradient; - ctx.fillRect(x, y, w, h); - - ctx.fillStyle = lightGradient; - ctx.fillRect(x, y, w, h); - - ctx.restore(); - } - - ctx.clearRect(x, y, w, (h * 2)); - - drawPillShadow(); - drawPill(); - - ctx.save(); - - ctx.translate(0, (h * 2) + 1); - ctx.scale(1, -1); - - drawPill(); - - ctx.restore(); - - this.fadeOutRect(ctx, x, y + h + 1, w, h, 0.5, 0.0); - }, - - updateSummaryGraphSoon: function() - { - if ("updateSummaryGraphTimeout" in this) - return; - this.updateSummaryGraphTimeout = setTimeout(this.updateSummaryGraph.bind(this), 500); - }, - - updateSummaryGraph: function() - { - if ("updateSummaryGraphTimeout" in this) { - clearTimeout(this.updateSummaryGraphTimeout); - delete this.updateSummaryGraphTimeout; - } - - var graphInfo = this.calculator.computeValues(this.timelineEntries); - - var categoryOrder = ["documents", "stylesheets", "images", "scripts", "fonts", "other"]; - var categoryColors = {documents: {r: 47, g: 102, b: 236}, stylesheets: {r: 157, g: 231, b: 119}, images: {r: 164, g: 60, b: 255}, scripts: {r: 255, g: 121, b: 0}, fonts: {r: 231, g: 231, b: 10}, other: {r: 186, g: 186, b: 186}}; - var fillSegments = []; - - this.legendElement.removeChildren(); - - if (this.totalLegendLabel) - this.totalLegendLabel.parentNode.removeChild(this.totalLegendLabel); - - this.totalLegendLabel = this.makeLegendElement(this.calculator.totalTitle, this.calculator.formatValue(graphInfo.total)); - this.totalLegendLabel.addStyleClass("network-graph-legend-total"); - this.graphLabelElement.appendChild(this.totalLegendLabel); - - for (var i = 0; i < categoryOrder.length; ++i) { - var category = categoryOrder[i]; - var size = graphInfo.categoryValues[category]; - if (!size) - continue; - - var color = categoryColors[category]; - var colorString = "rgb(" + color.r + ", " + color.g + ", " + color.b + ")"; - - var fillSegment = {color: colorString, value: size}; - fillSegments.push(fillSegment); - - var legendLabel = this.makeLegendElement(WebInspector.resourceCategories[category].title, this.calculator.formatValue(size), colorString); - this.legendElement.appendChild(legendLabel); - } - - this.drawSummaryGraph(fillSegments); - }, - - clearTimeline: function() - { - delete this.earliestStartTime; - delete this.latestEndTime; - - var entriesLength = this.timelineEntries.length; - for (var i = 0; i < entriesLength; ++i) - delete this.timelineEntries[i].resource.networkTimelineEntry; - - this.timelineEntries = []; - this.resourcesElement.removeChildren(); - - this.drawSummaryGraph(); // draws an empty graph - }, - - addResourceToTimeline: function(resource) - { - var timelineEntry = new WebInspector.NetworkTimelineEntry(this, resource); - this.timelineEntries.push(timelineEntry); - this.resourcesElement.appendChild(timelineEntry.resourceElement); - - timelineEntry.refresh(); - this.updateSummaryGraphSoon(); - } -} - -WebInspector.NetworkPanel.prototype.__proto__ = WebInspector.Panel.prototype; - -WebInspector.NetworkPanel.timelineEntryCompare = function(a, b) -{ - if (a.resource.startTime < b.resource.startTime) - return -1; - if (a.resource.startTime > b.resource.startTime) - return 1; - if (a.resource.endTime < b.resource.endTime) - return -1; - if (a.resource.endTime > b.resource.endTime) - return 1; - return 0; -} - -WebInspector.NetworkTimelineEntry = function(panel, resource) -{ - this.panel = panel; - this.resource = resource; - resource.networkTimelineEntry = this; - - this.resourceElement = document.createElement("div"); - this.resourceElement.className = "network-resource"; - this.resourceElement.timelineEntry = this; - - this.titleElement = document.createElement("div"); - this.titleElement.className = "network-title"; - this.resourceElement.appendChild(this.titleElement); - - this.fileElement = document.createElement("div"); - this.fileElement.className = "network-file"; - this.fileElement.innerHTML = WebInspector.linkifyURL(resource.url, resource.displayName); - this.titleElement.appendChild(this.fileElement); - - this.tipButtonElement = document.createElement("button"); - this.tipButtonElement.className = "tip-button"; - this.showingTipButton = this.resource.tips.length; - this.fileElement.insertBefore(this.tipButtonElement, this.fileElement.firstChild); - - this.tipButtonElement.addEventListener("click", this.toggleTipBalloon.bind(this), false ); - - this.areaElement = document.createElement("div"); - this.areaElement.className = "network-area"; - this.titleElement.appendChild(this.areaElement); - - this.barElement = document.createElement("div"); - this.areaElement.appendChild(this.barElement); - - this.infoElement = document.createElement("div"); - this.infoElement.className = "network-info hidden"; - this.resourceElement.appendChild(this.infoElement); -} - -WebInspector.NetworkTimelineEntry.prototype = { - refresh: function(skipBoundryUpdate, skipTimelineSort, immediate) - { - if (!this.panel.visible) { - this.needsRefresh = true; - this.panel.needsRefresh = true; - return; - } - - delete this.needsRefresh; - - if (!skipBoundryUpdate) { - if (this.panel.updateTimelineBoundriesIfNeeded(this.resource, immediate)) - return; // updateTimelineBoundriesIfNeeded calls refresh() on all entries, so we can just return - } - - if (!skipTimelineSort) { - if (immediate) - this.panel.sortTimelineEntriesIfNeeded(); - else - this.panel.sortTimelineEntriesSoonIfNeeded(); - } - - if (this.resource.startTime !== -1) { - var percentStart = ((this.resource.startTime - this.panel.earliestStartTime) / this.panel.totalDuration) * 100; - this.barElement.style.left = percentStart + "%"; - } else { - this.barElement.style.left = null; - } - - if (this.resource.endTime !== -1) { - var percentEnd = ((this.panel.latestEndTime - this.resource.endTime) / this.panel.totalDuration) * 100; - this.barElement.style.right = percentEnd + "%"; - } else { - this.barElement.style.right = "0px"; - } - - this.barElement.className = "network-bar network-category-" + this.resource.category.name; - - if (this.infoNeedsRefresh) - this.refreshInfo(); - }, - - refreshInfo: function() - { - if (!this.showingInfo) { - this.infoNeedsRefresh = true; - return; - } - - if (!this.panel.visible) { - this.panel.needsRefresh = true; - this.infoNeedsRefresh = true; - return; - } - - this.infoNeedsRefresh = false; - - this.infoElement.removeChildren(); - - var sections = [ - {title: WebInspector.UIString("Request"), info: this.resource.sortedRequestHeaders}, - {title: WebInspector.UIString("Response"), info: this.resource.sortedResponseHeaders} - ]; - - function createSectionTable(section) - { - if (!section.info.length) - return; - - var table = document.createElement("table"); - this.infoElement.appendChild(table); - - var heading = document.createElement("th"); - heading.textContent = section.title; - - var row = table.createTHead().insertRow(-1).appendChild(heading); - var body = document.createElement("tbody"); - table.appendChild(body); - - section.info.forEach(function(header) { - var row = body.insertRow(-1); - var th = document.createElement("th"); - th.textContent = header.header; - row.appendChild(th); - row.insertCell(-1).textContent = header.value; - }); - } - - sections.forEach(createSectionTable, this); - }, - - refreshInfoIfNeeded: function() - { - if (this.infoNeedsRefresh === false) - return; - - this.refreshInfo(); - }, - - toggleShowingInfo: function() - { - this.showingInfo = !this.showingInfo; - }, - - get showingInfo() - { - return this._showingInfo; - }, - - set showingInfo(x) - { - if (this._showingInfo === x) - return; - - this._showingInfo = x; - - var element = this.infoElement; - if (x) { - element.removeStyleClass("hidden"); - element.style.setProperty("overflow", "hidden"); - this.refreshInfoIfNeeded(); - WebInspector.animateStyle([{element: element, start: {height: 0}, end: {height: element.offsetHeight}}], 250, function() { element.style.removeProperty("height"); element.style.removeProperty("overflow") }); - } else { - element.style.setProperty("overflow", "hidden"); - WebInspector.animateStyle([{element: element, end: {height: 0}}], 250, function() { element.addStyleClass("hidden"); element.style.removeProperty("height") }); - } - }, - - get showingTipButton() - { - return !this.tipButtonElement.hasStyleClass("hidden"); - }, - - set showingTipButton(x) - { - if (x) - this.tipButtonElement.removeStyleClass("hidden"); - else - this.tipButtonElement.addStyleClass("hidden"); - }, - - toggleTipBalloon: function(event) - { - this.showingTipBalloon = !this.showingTipBalloon; - event.stopPropagation(); - }, - - get showingTipBalloon() - { - return this._showingTipBalloon; - }, - - set showingTipBalloon(x) - { - if (this._showingTipBalloon === x) - return; - - this._showingTipBalloon = x; - - if (x) { - if (!this.tipBalloonElement) { - this.tipBalloonElement = document.createElement("div"); - this.tipBalloonElement.className = "tip-balloon"; - this.titleElement.appendChild(this.tipBalloonElement); - - this.tipBalloonContentElement = document.createElement("div"); - this.tipBalloonContentElement.className = "tip-balloon-content"; - this.tipBalloonElement.appendChild(this.tipBalloonContentElement); - var tipText = ""; - for (var id in this.resource.tips) - tipText += this.resource.tips[id].message + "\n"; - this.tipBalloonContentElement.textContent = tipText; - } - - this.tipBalloonElement.removeStyleClass("hidden"); - WebInspector.animateStyle([{element: this.tipBalloonElement, start: {left: 160, opacity: 0}, end: {left: 145, opacity: 1}}], 250); - } else { - var element = this.tipBalloonElement; - WebInspector.animateStyle([{element: this.tipBalloonElement, start: {left: 145, opacity: 1}, end: {left: 160, opacity: 0}}], 250, function() { element.addStyleClass("hidden") }); - } - } -} - -WebInspector.TimelineValueCalculator = function() -{ -} - -WebInspector.TimelineValueCalculator.prototype = { - computeValues: function(entries) - { - var total = 0; - var categoryValues = {}; - - function compute(entry) - { - var value = this._value(entry); - if (value === undefined) - return; - - if (!(entry.resource.category.name in categoryValues)) - categoryValues[entry.resource.category.name] = 0; - categoryValues[entry.resource.category.name] += value; - total += value; - } - entries.forEach(compute, this); - - return {categoryValues: categoryValues, total: total}; - }, - - _value: function(entry) - { - return 0; - }, - - get title() - { - return ""; - }, - - formatValue: function(value) - { - return value.toString(); - } -} - -WebInspector.TransferTimeCalculator = function() -{ - WebInspector.TimelineValueCalculator.call(this); -} - -WebInspector.TransferTimeCalculator.prototype = { - computeValues: function(entries) - { - var entriesByCategory = {}; - entries.forEach(function(entry) { - if (!(entry.resource.category.name in entriesByCategory)) - entriesByCategory[entry.resource.category.name] = []; - entriesByCategory[entry.resource.category.name].push(entry); - }); - - var earliestStart; - var latestEnd; - var categoryValues = {}; - for (var category in entriesByCategory) { - entriesByCategory[category].sort(WebInspector.NetworkPanel.timelineEntryCompare); - categoryValues[category] = 0; - - var segment = {start: -1, end: -1}; - entriesByCategory[category].forEach(function(entry) { - if (entry.resource.startTime == -1 || entry.resource.endTime == -1) - return; - - if (earliestStart === undefined) - earliestStart = entry.resource.startTime; - else - earliestStart = Math.min(earliestStart, entry.resource.startTime); - - if (latestEnd === undefined) - latestEnd = entry.resource.endTime; - else - latestEnd = Math.max(latestEnd, entry.resource.endTime); - - if (entry.resource.startTime <= segment.end) { - segment.end = Math.max(segment.end, entry.resource.endTime); - return; - } - - categoryValues[category] += segment.end - segment.start; - - segment.start = entry.resource.startTime; - segment.end = entry.resource.endTime; - }); - - // Add the last segment - categoryValues[category] += segment.end - segment.start; - } - - return {categoryValues: categoryValues, total: latestEnd - earliestStart}; - }, - - get title() - { - return WebInspector.UIString("Transfer Time"); - }, - - get totalTitle() - { - return WebInspector.UIString("Total Time"); - }, - - formatValue: function(value) - { - return Number.secondsToString(value); - } -} - -WebInspector.TransferTimeCalculator.prototype.__proto__ = WebInspector.TimelineValueCalculator.prototype; - -WebInspector.TransferSizeCalculator = function() -{ - WebInspector.TimelineValueCalculator.call(this); -} - -WebInspector.TransferSizeCalculator.prototype = { - _value: function(entry) - { - return entry.resource.contentLength; - }, - - get title() - { - return WebInspector.UIString("Transfer Size"); - }, - - get totalTitle() - { - return WebInspector.UIString("Total Size"); - }, - - formatValue: function(value) - { - return Number.bytesToString(value); - } -} - -WebInspector.TransferSizeCalculator.prototype.__proto__ = WebInspector.TimelineValueCalculator.prototype; diff --git a/WebCore/page/inspector/Panel.js b/WebCore/page/inspector/Panel.js deleted file mode 100644 index 7631fa3..0000000 --- a/WebCore/page/inspector/Panel.js +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.Panel = function(views) -{ - this._visible = false; - - this.element = document.createElement("div"); - this.element.className = "panel"; - - this.views = {}; - this.viewButtons = []; - - if (views) { - var selectViewFunction = function(event) - { - var clickedView = event.currentTarget.view; - clickedView.panel.currentView = clickedView; - }; - - for (var i = 0; i < views.length; ++i) { - var view = views[i]; - view.panel = this; - - view.buttonElement = document.createElement("button"); - view.buttonElement.title = view.title; - view.buttonElement.addEventListener("click", selectViewFunction, false); - view.buttonElement.appendChild(document.createElement("img")); - view.buttonElement.view = view; - - view.contentElement = document.createElement("div"); - view.contentElement.className = "content " + view.name; - - this.views[view.name] = view; - this.viewButtons.push(view.buttonElement); - this.element.appendChild(view.contentElement); - } - } -} - -WebInspector.Panel.prototype = { - show: function() - { - this._visible = true; - if (!this.element.parentNode) - this.attach(); - this.element.addStyleClass("selected"); - this.updateToolbar(); - if (this.currentView && this.currentView.show) - this.currentView.show(); - }, - - hide: function() - { - if (this.currentView && this.currentView.hide) - this.currentView.hide(); - document.getElementById("toolbarButtons").removeChildren(); - this.element.removeStyleClass("selected"); - this._visible = false; - }, - - updateToolbar: function() - { - var buttonContainer = document.getElementById("toolbarButtons"); - buttonContainer.removeChildren(); - - var buttons = this.viewButtons; - if (buttons.length < 2) - return; - - for (var i = 0; i < buttons.length; ++i) { - var button = buttons[i]; - - if (i === 0) - button.addStyleClass("first"); - else if (i === (buttons.length - 1)) - button.addStyleClass("last"); - - if (i) { - var divider = document.createElement("img"); - divider.className = "split-button-divider"; - buttonContainer.appendChild(divider); - } - - button.addStyleClass("split-button"); - button.addStyleClass("view-button-" + button.title.toLowerCase()); - - buttonContainer.appendChild(button); - } - }, - - attach: function() - { - document.getElementById("panels").appendChild(this.element); - }, - - detach: function() - { - if (WebInspector.currentPanel === this) - WebInspector.currentPanel = null; - if (this.element && this.element.parentNode) - this.element.parentNode.removeChild(this.element); - }, - - get currentView() - { - return this._currentView; - }, - - set currentView(x) - { - if (typeof x === "string" || x instanceof String) - x = this.views[x]; - - if (this._currentView === x) - return; - - if (this !== x.panel) { - console.error("Set currentView to a view " + x.title + " whose panel is not this panel"); - return; - } - - if (this._currentView) { - this._currentView.buttonElement.removeStyleClass("selected"); - this._currentView.contentElement.removeStyleClass("selected"); - if (this._currentView.hide) - this._currentView.hide(); - } - - this._currentView = x; - - if (x) { - x.buttonElement.addStyleClass("selected"); - x.contentElement.addStyleClass("selected"); - if (x.show) - x.show(); - } - }, - - get visible() - { - return this._visible; - }, - - set visible(x) - { - if (this._visible === x) - return; - - if (x) - this.show(); - else - this.hide(); - } -} diff --git a/WebCore/page/inspector/PropertiesSection.js b/WebCore/page/inspector/PropertiesSection.js deleted file mode 100644 index b2a3473..0000000 --- a/WebCore/page/inspector/PropertiesSection.js +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.PropertiesSection = function(title, subtitle) -{ - this.element = document.createElement("div"); - this.element.className = "section"; - - this.headerElement = document.createElement("div"); - this.headerElement.className = "header"; - - this.titleElement = document.createElement("div"); - this.titleElement.className = "title"; - - this.subtitleElement = document.createElement("div"); - this.subtitleElement.className = "subtitle"; - - this.headerElement.appendChild(this.titleElement); - this.headerElement.appendChild(this.subtitleElement); - this.headerElement.addEventListener("click", this.toggleExpanded.bind(this), false); - - this.propertiesElement = document.createElement("ol"); - this.propertiesElement.className = "properties"; - this.propertiesTreeOutline = new TreeOutline(this.propertiesElement); - this.propertiesTreeOutline.section = this; - - this.element.appendChild(this.headerElement); - this.element.appendChild(this.propertiesElement); - - this.title = title; - this.subtitle = subtitle; - this.expanded = false; -} - -WebInspector.PropertiesSection.prototype = { - get title() - { - return this._title; - }, - - set title(x) - { - if (this._title === x) - return; - this._title = x; - this.titleElement.textContent = x; - }, - - get subtitle() - { - return this._subtitle; - }, - - set subtitle(x) - { - if (this._subtitle === x) - return; - this._subtitle = x; - this.subtitleElement.innerHTML = x; - }, - - get expanded() - { - return this._expanded; - }, - - set expanded(x) - { - if (x) - this.expand(); - else - this.collapse(); - }, - - get populated() - { - return this._populated; - }, - - set populated(x) - { - this._populated = x; - if (!x && this.onpopulate && this._expanded) { - this.onpopulate(this); - this._populated = true; - } - }, - - expand: function() - { - if (this._expanded) - return; - this._expanded = true; - this.element.addStyleClass("expanded"); - - if (!this._populated && this.onpopulate) { - this.onpopulate(this); - this._populated = true; - } - }, - - collapse: function() - { - if (!this._expanded) - return; - this._expanded = false; - this.element.removeStyleClass("expanded"); - }, - - toggleExpanded: function() - { - this.expanded = !this.expanded; - } -} diff --git a/WebCore/page/inspector/PropertiesSidebarPane.js b/WebCore/page/inspector/PropertiesSidebarPane.js deleted file mode 100644 index 0266d53..0000000 --- a/WebCore/page/inspector/PropertiesSidebarPane.js +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.PropertiesSidebarPane = function() -{ - WebInspector.SidebarPane.call(this, WebInspector.UIString("Properties")); -} - -WebInspector.PropertiesSidebarPane.prototype = { - update: function(object) - { - var body = this.bodyElement; - - body.removeChildren(); - - this.sections = []; - - if (!object) - return; - - for (var prototype = object; prototype; prototype = prototype.__proto__) { - var section = new WebInspector.ObjectPropertiesSection(prototype); - this.sections.push(section); - body.appendChild(section.element); - } - } -} - -WebInspector.PropertiesSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; - -WebInspector.ObjectPropertiesSection = function(object) -{ - var title = Object.describe(object); - var subtitle; - if (title.match(/Prototype$/)) { - title = title.replace(/Prototype$/, ""); - subtitle = WebInspector.UIString("Prototype"); - } - - this.object = object; - - WebInspector.PropertiesSection.call(this, title, subtitle); -} - -WebInspector.ObjectPropertiesSection.prototype = { - onpopulate: function() - { - var properties = Object.sortedProperties(this.object); - for (var i = 0; i < properties.length; ++i) { - var propertyName = properties[i]; - if (!this.object.hasOwnProperty(propertyName) || propertyName === "__treeElementIdentifier") - continue; - this.propertiesTreeOutline.appendChild(new WebInspector.ObjectPropertyTreeElement(this.object, propertyName)); - } - } -} - -WebInspector.ObjectPropertiesSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype; - -WebInspector.ObjectPropertyTreeElement = function(parentObject, propertyName) -{ - this.parentObject = parentObject; - this.propertyName = propertyName; - - var childObject = this.safePropertyValue(parentObject, propertyName); - var isGetter = parentObject.__lookupGetter__(propertyName); - - var title = "<span class=\"name\">" + propertyName.escapeHTML() + "</span>: "; - if (!isGetter) - title += "<span class=\"value\">" + Object.describe(childObject, true).escapeHTML() + "</span>"; - else - // FIXME: this should show something like "getter" once we can change localization (bug 16734). - title += "<span class=\"value dimmed\">—</span>"; - - var hasSubProperties = false; - var type = typeof childObject; - if (childObject && (type === "object" || type === "function")) { - for (subPropertyName in childObject) { - if (subPropertyName === "__treeElementIdentifier") - continue; - hasSubProperties = true; - break; - } - } - - TreeElement.call(this, title, null, hasSubProperties); -} - -WebInspector.ObjectPropertyTreeElement.prototype = { - safePropertyValue: function(object, propertyName) - { - var getter = object.__lookupGetter__(propertyName); - if (getter) - return; - return object[propertyName]; - }, - - onpopulate: function() - { - if (this.children.length) - return; - - var childObject = this.safePropertyValue(this.parentObject, this.propertyName); - var properties = Object.sortedProperties(childObject); - for (var i = 0; i < properties.length; ++i) { - var propertyName = properties[i]; - if (propertyName === "__treeElementIdentifier") - continue; - this.appendChild(new WebInspector.ObjectPropertyTreeElement(childObject, propertyName)); - } - } -} - -WebInspector.ObjectPropertyTreeElement.prototype.__proto__ = TreeElement.prototype; diff --git a/WebCore/page/inspector/Resource.js b/WebCore/page/inspector/Resource.js deleted file mode 100644 index 2f87b13..0000000 --- a/WebCore/page/inspector/Resource.js +++ /dev/null @@ -1,690 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.Resource = function(requestHeaders, url, domain, path, lastPathComponent, identifier, mainResource, cached) -{ - this.identifier = identifier; - - this.startTime = -1; - this.endTime = -1; - this.mainResource = mainResource; - this.requestHeaders = requestHeaders; - this.url = url; - this.domain = domain; - this.path = path; - this.lastPathComponent = lastPathComponent; - this.cached = cached; - - this.listItem = new WebInspector.ResourceTreeElement(this); - this.updateTitle(); - - this.category = WebInspector.resourceCategories.other; -} - -// Keep these in sync with WebCore::InspectorResource::Type -WebInspector.Resource.Type = { - Document: 0, - Stylesheet: 1, - Image: 2, - Font: 3, - Script: 4, - Other: 5, - - isTextType: function(type) - { - return (type == this.Document) || (type == this.Stylesheet) || (type == this.Script); - }, - - toString: function(type) - { - switch (type) { - case this.Document: - return WebInspector.UIString("document"); - case this.Stylesheet: - return WebInspector.UIString("stylesheet"); - case this.Image: - return WebInspector.UIString("image"); - case this.Font: - return WebInspector.UIString("font"); - case this.Script: - return WebInspector.UIString("script"); - case this.Other: - default: - return WebInspector.UIString("other"); - } - } -} - -WebInspector.Resource.prototype = { - get url() - { - return this._url; - }, - - set url(x) - { - if (this._url === x) - return; - - var oldURL = this._url; - this._url = x; - WebInspector.resourceURLChanged(this, oldURL); - this.updateTitleSoon(); - }, - - get domain() - { - return this._domain; - }, - - set domain(x) - { - if (this._domain === x) - return; - this._domain = x; - this.updateTitleSoon(); - }, - - get lastPathComponent() - { - return this._lastPathComponent; - }, - - set lastPathComponent(x) - { - if (this._lastPathComponent === x) - return; - this._lastPathComponent = x; - this._lastPathComponentLowerCase = x ? x.toLowerCase() : null; - this.updateTitleSoon(); - }, - - get displayName() - { - var title = this.lastPathComponent; - if (!title) - title = this.domain; - if (!title) - title = this.url; - return title; - }, - - get startTime() - { - return this._startTime; - }, - - set startTime(x) - { - if (this._startTime === x) - return; - - this._startTime = x; - - if (this.networkTimelineEntry) - this.networkTimelineEntry.refresh(); - }, - - get responseReceivedTime() - { - return this._responseReceivedTime; - }, - - set responseReceivedTime(x) - { - if (this._responseReceivedTime === x) - return; - - this._responseReceivedTime = x; - - if (this.networkTimelineEntry) - this.networkTimelineEntry.refresh(); - }, - - get endTime() - { - return this._endTime; - }, - - set endTime(x) - { - if (this._endTime === x) - return; - - this._endTime = x; - - if (this.networkTimelineEntry) - this.networkTimelineEntry.refresh(); - }, - - get contentLength() - { - return this._contentLength; - }, - - set contentLength(x) - { - if (this._contentLength === x) - return; - - this._contentLength = x; - - if (this._expectedContentLength && this._expectedContentLength > x) { - this.updateTitle(); - var canvas = document.getElementById("loadingIcon" + this.identifier); - if (canvas) - WebInspector.drawLoadingPieChart(canvas, (x / this._expectedContentLength)); - } - - WebInspector.networkPanel.updateSummaryGraphSoon(); - }, - - get expectedContentLength() - { - return this._expectedContentLength; - }, - - set expectedContentLength(x) - { - if (this._expectedContentLength === x) - return; - - this._expectedContentLength = x; - - if (x && this._contentLength && this._contentLength <= x) { - var canvas = document.getElementById("loadingIcon" + this.identifier); - if (canvas) - WebInspector.drawLoadingPieChart(canvas, (this._contentLength / x)); - } - }, - - get finished() - { - return this._finished; - }, - - set finished(x) - { - if (this._finished === x) - return; - - this._finished = x; - - if (x) { - var canvas = document.getElementById("loadingIcon" + this.identifier); - if (canvas) - canvas.parentNode.removeChild(canvas); - - this._checkTips(); - this._checkWarnings(); - } - - this.updateTitleSoon(); - this.updatePanel(); - }, - - get failed() - { - return this._failed; - }, - - set failed(x) - { - this._failed = x; - - this.updateTitleSoon(); - this.updatePanel(); - }, - - get category() - { - return this._category; - }, - - set category(x) - { - if (this._category === x) - return; - - var oldCategory = this._category; - if (oldCategory) - oldCategory.removeResource(this); - - this._category = x; - this.updateTitle(); - - if (this._category) - this._category.addResource(this); - - this.updatePanel(); - }, - - get mimeType() - { - return this._mimeType; - }, - - set mimeType(x) - { - if (this._mimeType === x) - return; - - this._mimeType = x; - }, - - get type() - { - return this._type; - }, - - set type(x) - { - if (this._type === x) - return; - - this._type = x; - - switch (x) { - case WebInspector.Resource.Type.Document: - this.category = WebInspector.resourceCategories.documents; - break; - case WebInspector.Resource.Type.Stylesheet: - this.category = WebInspector.resourceCategories.stylesheets; - break; - case WebInspector.Resource.Type.Script: - this.category = WebInspector.resourceCategories.scripts; - break; - case WebInspector.Resource.Type.Image: - this.category = WebInspector.resourceCategories.images; - break; - case WebInspector.Resource.Type.Font: - this.category = WebInspector.resourceCategories.fonts; - break; - case WebInspector.Resource.Type.Other: - default: - this.category = WebInspector.resourceCategories.other; - break; - } - }, - - get documentNode() { - if ("identifier" in this) - return InspectorController.getResourceDocumentNode(this.identifier); - return null; - }, - - get requestHeaders() - { - if (this._requestHeaders === undefined) - this._requestHeaders = {}; - return this._requestHeaders; - }, - - set requestHeaders(x) - { - if (this._requestHeaders === x) - return; - - this._requestHeaders = x; - delete this._sortedRequestHeaders; - - if (this.networkTimelineEntry) - this.networkTimelineEntry.refreshInfo(); - }, - - get sortedRequestHeaders() - { - if (this._sortedRequestHeaders !== undefined) - return this._sortedRequestHeaders; - - this._sortedRequestHeaders = []; - for (var key in this.requestHeaders) - this._sortedRequestHeaders.push({header: key, value: this.requestHeaders[key]}); - this._sortedRequestHeaders.sort(function(a,b) { return a.header.localeCompare(b.header) }); - - return this._sortedRequestHeaders; - }, - - get responseHeaders() - { - if (this._responseHeaders === undefined) - this._responseHeaders = {}; - return this._responseHeaders; - }, - - set responseHeaders(x) - { - if (this._responseHeaders === x) - return; - - this._responseHeaders = x; - delete this._sortedResponseHeaders; - - if (this.networkTimelineEntry) - this.networkTimelineEntry.refreshInfo(); - }, - - get sortedResponseHeaders() - { - if (this._sortedResponseHeaders !== undefined) - return this._sortedResponseHeaders; - - this._sortedResponseHeaders = []; - for (var key in this.responseHeaders) - this._sortedResponseHeaders.push({header: key, value: this.responseHeaders[key]}); - this._sortedResponseHeaders.sort(function(a,b) { return a.header.localeCompare(b.header) }); - - return this._sortedResponseHeaders; - }, - - get tips() - { - if (!("_tips" in this)) - this._tips = {}; - return this._tips; - }, - - _addTip: function(tip) - { - if (tip.id in this.tips) - return; - - this.tips[tip.id] = tip; - - // FIXME: Re-enable this code once we have a scope bar in the Console. - // Otherwise, we flood the Console with too many tips. - /* - var msg = new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.Other, - WebInspector.ConsoleMessage.MessageLevel.Tip, tip.message, -1, this.url); - WebInspector.consolePanel.addMessage(msg); - */ - - if (this.networkTimelineEntry) - this.networkTimelineEntry.showingTipButton = true; - }, - - _checkTips: function() - { - for (var tip in WebInspector.Tips) - this._checkTip(WebInspector.Tips[tip]); - }, - - _checkTip: function(tip) - { - var addTip = false; - switch (tip.id) { - case WebInspector.Tips.ResourceNotCompressed.id: - addTip = this._shouldCompress(); - break; - } - - if (addTip) - this._addTip(tip); - }, - - _shouldCompress: function() - { - return WebInspector.Resource.Type.isTextType(this.type) - && this.domain - && !("Content-Encoding" in this.responseHeaders) - && this.contentLength !== undefined - && this.contentLength >= 512; - }, - - _mimeTypeIsConsistentWithType: function() - { - if (this.type === undefined || this.type === WebInspector.Resource.Type.Other) - return true; - - if (this.mimeType in WebInspector.MIMETypes) - return this.type in WebInspector.MIMETypes[this.mimeType]; - - return true; - }, - - _checkWarnings: function() - { - for (var warning in WebInspector.Warnings) - this._checkWarning(WebInspector.Warnings[warning]); - }, - - _checkWarning: function(warning) - { - var addWarning = false; - var msg; - switch (warning.id) { - case WebInspector.Warnings.IncorrectMIMEType.id: - if (!this._mimeTypeIsConsistentWithType()) - msg = new WebInspector.ConsoleMessage(WebInspector.ConsoleMessage.MessageSource.Other, - WebInspector.ConsoleMessage.MessageLevel.Warning, - String.sprintf(WebInspector.Warnings.IncorrectMIMEType.message, - WebInspector.Resource.Type.toString(this.type), this.mimeType), - -1, this.url); - break; - } - - if (msg) - WebInspector.consolePanel.addMessage(msg); - }, - - updateTitleSoon: function() - { - if (this.updateTitleTimeout) - return; - this.updateTitleTimeout = setTimeout(this.updateTitle.bind(this), 0); - }, - - updateTitle: function() - { - delete this.updateTitleTimeout; - - var title = this.displayName; - - var info = ""; - if (this.domain && (!WebInspector.mainResource || (WebInspector.mainResource && this.domain !== WebInspector.mainResource.domain))) - info = this.domain; - - if (this.path && this.lastPathComponent) { - var lastPathComponentIndex = this.path.lastIndexOf("/" + this.lastPathComponent); - if (lastPathComponentIndex != -1) - info += this.path.substring(0, lastPathComponentIndex); - } - - var fullTitle = ""; - - if (this.errors) - fullTitle += "<span class=\"count errors\">" + (this.errors + this.warnings) + "</span>"; - else if (this.warnings) - fullTitle += "<span class=\"count warnings\">" + this.warnings + "</span>"; - - fullTitle += "<span class=\"title" + (info && info.length ? "" : " only") + "\">" + title.escapeHTML() + "</span>"; - if (info && info.length) - fullTitle += "<span class=\"info\">" + info.escapeHTML() + "</span>"; - - var iconClass = "icon"; - switch (this.category) { - default: - break; - case WebInspector.resourceCategories.images: - case WebInspector.resourceCategories.other: - iconClass = "icon plain"; - break; - case WebInspector.resourceCategories.fonts: - iconClass = "icon font"; - } - - if (!this.finished) - fullTitle += "<div class=\"" + iconClass + "\"><canvas id=\"loadingIcon" + this.identifier + "\" class=\"progress\" width=\"16\" height=\"16\"></canvas></div>"; - else if (this.category === WebInspector.resourceCategories.images) - fullTitle += "<div class=\"" + iconClass + "\"><img class=\"preview\" src=\"" + this.url + "\"></div>"; - else if (this.category === WebInspector.resourceCategories.fonts) { - var uniqueFontName = "WebInspectorFontPreview" + this.identifier; - - this.fontStyleElement = document.createElement("style"); - this.fontStyleElement.textContent = "@font-face { font-family: \"" + uniqueFontName + "\"; src: url(" + this.url + "); }"; - document.getElementsByTagName("head").item(0).appendChild(this.fontStyleElement); - - fullTitle += "<div class=\"" + iconClass + "\"><div class=\"preview\" style=\"font-family: " + uniqueFontName + "\">Ag</div></div>"; - } else - fullTitle += "<div class=\"" + iconClass + "\"></div>"; - - this.listItem.title = fullTitle; - this.listItem.tooltip = this.url; - }, - - updatePanel: function() - { - if (this._panel) { - var current = (WebInspector.currentPanel === this._panel); - - this._panel.detach(); - delete this._panel; - - if (current) - WebInspector.currentPanel = this.panel; - } - }, - - get panel() - { - if (!this._panel) { - if (this.finished && !this.failed) { - switch (this.category) { - case WebInspector.resourceCategories.documents: - this._panel = new WebInspector.DocumentPanel(this); - break; - case WebInspector.resourceCategories.stylesheets: - case WebInspector.resourceCategories.scripts: - this._panel = new WebInspector.SourcePanel(this); - break; - case WebInspector.resourceCategories.images: - this._panel = new WebInspector.ImagePanel(this); - break; - case WebInspector.resourceCategories.fonts: - this._panel = new WebInspector.FontPanel(this); - break; - } - } - - if (!this._panel) - this._panel = new WebInspector.ResourcePanel(this); - } - - return this._panel; - }, - - select: function() - { - WebInspector.navigateToResource(this); - }, - - deselect: function() - { - this.listItem.deselect(true); - if (WebInspector.currentPanel === this._panel) - WebInspector.currentPanel = null; - }, - - attach: function() - { - if (this._panel) - this._panel.attach(); - }, - - detach: function() - { - if (this._panel) - this._panel.detach(); - if (this.fontStyleElement && this.fontStyleElement.parentNode) - this.fontStyleElement.parentNode.removeChild(this.fontStyleElement); - }, - - get errors() - { - if (!("_errors" in this)) - this._errors = 0; - - return this._errors; - }, - - set errors(x) - { - if (this._errors === x) - return; - - this._errors = x; - this.updateTitleSoon(); - }, - - get warnings() - { - if (!("_warnings" in this)) - this._warnings = 0; - - return this._warnings; - }, - - set warnings(x) - { - if (this._warnings === x) - return; - - this._warnings = x; - this.updateTitleSoon(); - } -} - -WebInspector.ResourceTreeElement = function(resource) -{ - TreeElement.call(this, "", resource, false); - this.resource = resource; -} - -WebInspector.ResourceTreeElement.prototype = { - onselect: function() - { - var selectedElement = WebInspector.fileOutline.selectedTreeElement; - if (selectedElement) - selectedElement.deselect(); - this.resource.select(); - }, - - ondeselect: function() - { - this.resource.deselect(); - }, - - onreveal: function() - { - if (!this.listItemElement || !this.treeOutline || !this.treeOutline.childrenListElement) - return; - this.treeOutline.childrenListElement.scrollToElement(this.listItemElement); - } -} - -WebInspector.ResourceTreeElement.prototype.__proto__ = TreeElement.prototype; diff --git a/WebCore/page/inspector/ResourceCategory.js b/WebCore/page/inspector/ResourceCategory.js deleted file mode 100644 index a2f2ba4..0000000 --- a/WebCore/page/inspector/ResourceCategory.js +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.ResourceCategory = function(title, name) -{ - this.name = name; - this.title = title; - this.resources = []; - this.listItem = new WebInspector.ResourceCategoryTreeElement(this); - this.listItem.hidden = true; - WebInspector.fileOutline.appendChild(this.listItem); -} - -WebInspector.ResourceCategory.prototype = { - toString: function() - { - return this.title; - }, - - addResource: function(resource) - { - var a = resource; - var resourcesLength = this.resources.length; - for (var i = 0; i < resourcesLength; ++i) { - var b = this.resources[i]; - if (a._lastPathComponentLowerCase && b._lastPathComponentLowerCase) - if (a._lastPathComponentLowerCase < b._lastPathComponentLowerCase) - break; - else if (a.name && b.name) - if (a.name < b.name) - break; - } - - this.resources.splice(i, 0, resource); - this.listItem.insertChild(resource.listItem, i); - this.listItem.hidden = false; - - resource.attach(); - }, - - removeResource: function(resource) - { - resource.detach(); - - var resourcesLength = this.resources.length; - for (var i = 0; i < resourcesLength; ++i) { - if (this.resources[i] === resource) { - this.resources.splice(i, 1); - break; - } - } - - this.listItem.removeChild(resource.listItem); - - if (!this.resources.length) - this.listItem.hidden = true; - }, - - removeAllResources: function(resource) - { - var resourcesLength = this.resources.length; - for (var i = 0; i < resourcesLength; ++i) - this.resources[i].detach(); - this.resources = []; - this.listItem.removeChildren(); - this.listItem.hidden = true; - } -} - -WebInspector.ResourceCategoryTreeElement = function(category) -{ - TreeElement.call(this, category.title, category, true); -} - -WebInspector.ResourceCategoryTreeElement.prototype = { - selectable: false, - arrowToggleWidth: 20 -} - -WebInspector.ResourceCategoryTreeElement.prototype.__proto__ = TreeElement.prototype; diff --git a/WebCore/page/inspector/ResourcePanel.js b/WebCore/page/inspector/ResourcePanel.js deleted file mode 100644 index b165c2b..0000000 --- a/WebCore/page/inspector/ResourcePanel.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.ResourcePanel = function(resource, views) -{ - WebInspector.Panel.call(this, views); - this.resource = resource; -} - -WebInspector.ResourcePanel.prototype = { - show: function() - { - WebInspector.Panel.prototype.show.call(this); - this.resource.listItem.select(true); // passing true prevents a cycle - this.resource.listItem.reveal(); - }, - - hide: function() - { - this.resource.listItem.deselect(true); // passing true prevents a cycle - WebInspector.Panel.prototype.hide.call(this); - } -} - -WebInspector.ResourcePanel.prototype.__proto__ = WebInspector.Panel.prototype; diff --git a/WebCore/page/inspector/SidebarPane.js b/WebCore/page/inspector/SidebarPane.js deleted file mode 100644 index 53f9d6d..0000000 --- a/WebCore/page/inspector/SidebarPane.js +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.SidebarPane = function(title) -{ - this.element = document.createElement("div"); - this.element.className = "pane"; - - this.titleElement = document.createElement("div"); - this.titleElement.className = "title"; - this.titleElement.addEventListener("click", this.toggleExpanded.bind(this), false); - - this.bodyElement = document.createElement("div"); - this.bodyElement.className = "body"; - - this.element.appendChild(this.titleElement); - this.element.appendChild(this.bodyElement); - - this.title = title; - this.growbarVisible = false; - this.expanded = false; -} - -WebInspector.SidebarPane.prototype = { - get title() - { - return this._title; - }, - - set title(x) - { - if (this._title === x) - return; - this._title = x; - this.titleElement.textContent = x; - }, - - get growbarVisible() - { - return this._growbarVisible; - }, - - set growbarVisible(x) - { - if (this._growbarVisible === x) - return; - - this._growbarVisible = x; - - if (x && !this._growbarElement) { - this._growbarElement = document.createElement("div"); - this._growbarElement.className = "growbar"; - this.element.appendChild(this._growbarElement); - } else if (!x && this._growbarElement) { - if (this._growbarElement.parentNode) - this._growbarElement.parentNode(this._growbarElement); - delete this._growbarElement; - } - }, - - get expanded() - { - return this._expanded; - }, - - set expanded(x) - { - if (x) - this.expand(); - else - this.collapse(); - }, - - expand: function() - { - if (this._expanded) - return; - this._expanded = true; - this.element.addStyleClass("expanded"); - if (this.onexpand) - this.onexpand(this); - }, - - collapse: function() - { - if (!this._expanded) - return; - this._expanded = false; - this.element.removeStyleClass("expanded"); - if (this.oncollapse) - this.oncollapse(this); - }, - - toggleExpanded: function() - { - this.expanded = !this.expanded; - } -} diff --git a/WebCore/page/inspector/SourcePanel.js b/WebCore/page/inspector/SourcePanel.js deleted file mode 100644 index 9d4139c..0000000 --- a/WebCore/page/inspector/SourcePanel.js +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.SourcePanel = function(resource, views) -{ - var allViews = [{ title: WebInspector.UIString("Source"), name: "source" }]; - if (views) - allViews = allViews.concat(views); - - WebInspector.ResourcePanel.call(this, resource, allViews); - - this.currentView = this.views.source; - - var sourceView = this.views.source; - - sourceView.messages = []; - sourceView.frameNeedsSetup = true; - - sourceView.frameElement = document.createElement("iframe"); - sourceView.frameElement.setAttribute("viewsource", "true"); - sourceView.contentElement.appendChild(sourceView.frameElement); -} - -WebInspector.SourcePanel.prototype = { - show: function() - { - WebInspector.ResourcePanel.prototype.show.call(this); - this.setupSourceFrameIfNeeded(); - }, - - setupSourceFrameIfNeeded: function() - { - if (this.views.source.frameNeedsSetup) { - this.attach(); - - InspectorController.addSourceToFrame(this.resource.identifier, this.views.source.frameElement); - WebInspector.addMainEventListeners(this.views.source.frameElement.contentDocument); - - var length = this.views.source.messages; - for (var i = 0; i < length; ++i) - this._addMessageToSource(this.views.source.messages[i]); - - delete this.views.source.frameNeedsSetup; - } - }, - - sourceRow: function(lineNumber) - { - this.setupSourceFrameIfNeeded(); - - var doc = this.views.source.frameElement.contentDocument; - var rows = doc.getElementsByTagName("table")[0].rows; - - // Line numbers are a 1-based index, but the rows collection is 0-based. - --lineNumber; - if (lineNumber >= rows.length) - lineNumber = rows.length - 1; - - return rows[lineNumber]; - }, - - showSourceLine: function(lineNumber) - { - var row = this.sourceRow(lineNumber); - if (!row) - return; - this.currentView = this.views.source; - row.scrollIntoView(true); - }, - - addMessageToSource: function(msg) - { - this.views.source.messages.push(msg); - if (!this.views.source.frameNeedsSetup) - this._addMessageToSource(msg); - }, - - _addMessageToSource: function(msg) - { - var row = this.sourceRow(msg.line); - if (!row) - return; - - var doc = this.views.source.frameElement.contentDocument; - var cell = row.getElementsByTagName("td")[1]; - - var errorDiv = cell.lastChild; - if (!errorDiv || errorDiv.nodeName.toLowerCase() !== "div" || !errorDiv.hasStyleClass("webkit-html-message-bubble")) { - errorDiv = doc.createElement("div"); - errorDiv.className = "webkit-html-message-bubble"; - cell.appendChild(errorDiv); - } - - var imageURL; - switch (msg.level) { - case WebInspector.ConsoleMessage.MessageLevel.Error: - errorDiv.addStyleClass("webkit-html-error-message"); - imageURL = "Images/errorIcon.png"; - break; - case WebInspector.ConsoleMessage.MessageLevel.Warning: - errorDiv.addStyleClass("webkit-html-warning-message"); - imageURL = "Images/warningIcon.png"; - break; - } - - var lineDiv = doc.createElement("div"); - lineDiv.className = "webkit-html-message-line"; - errorDiv.appendChild(lineDiv); - - var image = doc.createElement("img"); - image.src = imageURL; - image.className = "webkit-html-message-icon"; - lineDiv.appendChild(image); - - lineDiv.appendChild(doc.createTextNode(msg.message)); - } -} - -WebInspector.SourcePanel.prototype.__proto__ = WebInspector.ResourcePanel.prototype; diff --git a/WebCore/page/inspector/StylesSidebarPane.js b/WebCore/page/inspector/StylesSidebarPane.js deleted file mode 100644 index 915fc1a..0000000 --- a/WebCore/page/inspector/StylesSidebarPane.js +++ /dev/null @@ -1,682 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -WebInspector.StylesSidebarPane = function() -{ - WebInspector.SidebarPane.call(this, WebInspector.UIString("Styles")); -} - -WebInspector.StylesSidebarPane.prototype = { - update: function(node, editedSection) - { - var refresh = false; - - if (!node || node === this.node) - refresh = true; - - if (node && node.nodeType === Node.TEXT_NODE && node.parentNode) - node = node.parentNode; - - if (node && node.nodeType !== Node.ELEMENT_NODE) - node = null; - - if (node) - this.node = node; - else - node = this.node; - - var body = this.bodyElement; - if (!refresh || !node) { - body.removeChildren(); - this.sections = []; - } - - if (!node) - return; - - var styleRules = []; - - if (refresh) { - for (var i = 0; i < this.sections.length; ++i) { - var section = this.sections[i]; - if (section.computedStyle) - section.styleRule.style = node.ownerDocument.defaultView.getComputedStyle(node); - var styleRule = { section: section, style: section.styleRule.style, computedStyle: section.computedStyle }; - styleRules.push(styleRule); - } - } else { - var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node); - styleRules.push({ computedStyle: true, selectorText: WebInspector.UIString("Computed Style"), style: computedStyle, editable: false }); - - var nodeName = node.nodeName.toLowerCase(); - for (var i = 0; i < node.attributes.length; ++i) { - var attr = node.attributes[i]; - if (attr.style) { - var attrStyle = { style: attr.style, editable: false }; - attrStyle.subtitle = WebInspector.UIString("element’s “%s” attribute", attr.name); - attrStyle.selectorText = nodeName + "[" + attr.name; - if (attr.value.length) - attrStyle.selectorText += "=" + attr.value; - attrStyle.selectorText += "]"; - styleRules.push(attrStyle); - } - } - - if (node.style && node.style.length) { - var inlineStyle = { selectorText: WebInspector.UIString("Inline Style Attribute"), style: node.style }; - inlineStyle.subtitle = WebInspector.UIString("element’s “%s” attribute", "style"); - styleRules.push(inlineStyle); - } - - var matchedStyleRules = node.ownerDocument.defaultView.getMatchedCSSRules(node, "", !Preferences.showUserAgentStyles); - if (matchedStyleRules) { - // Add rules in reverse order to match the cascade order. - for (var i = (matchedStyleRules.length - 1); i >= 0; --i) - styleRules.push(matchedStyleRules[i]); - } - } - - var usedProperties = {}; - var priorityUsed = false; - - // Walk the style rules and make a list of all used and overloaded properties. - for (var i = 0; i < styleRules.length; ++i) { - var styleRule = styleRules[i]; - if (styleRule.computedStyle) - continue; - - styleRule.usedProperties = {}; - - var style = styleRule.style; - for (var j = 0; j < style.length; ++j) { - var name = style[j]; - - if (!priorityUsed && style.getPropertyPriority(name).length) - priorityUsed = true; - - // If the property name is already used by another rule then this rule's - // property is overloaded, so don't add it to the rule's usedProperties. - if (!(name in usedProperties)) - styleRule.usedProperties[name] = true; - - if (name === "font") { - // The font property is not reported as a shorthand. Report finding the individual - // properties so they are visible in computed style. - // FIXME: remove this when http://bugs.webkit.org/show_bug.cgi?id=15598 is fixed. - styleRule.usedProperties["font-family"] = true; - styleRule.usedProperties["font-size"] = true; - styleRule.usedProperties["font-style"] = true; - styleRule.usedProperties["font-variant"] = true; - styleRule.usedProperties["font-weight"] = true; - styleRule.usedProperties["line-height"] = true; - } - } - - // Add all the properties found in this style to the used properties list. - // Do this here so only future rules are affect by properties used in this rule. - for (var name in styleRules[i].usedProperties) - usedProperties[name] = true; - } - - if (priorityUsed) { - // Walk the properties again and account for !important. - var foundPriorityProperties = []; - - // Walk in reverse to match the order !important overrides. - for (var i = (styleRules.length - 1); i >= 0; --i) { - if (styleRules[i].computedStyle) - continue; - - var style = styleRules[i].style; - var uniqueProperties = style.getUniqueProperties(); - for (var j = 0; j < uniqueProperties.length; ++j) { - var name = uniqueProperties[j]; - if (style.getPropertyPriority(name).length) { - if (!(name in foundPriorityProperties)) - styleRules[i].usedProperties[name] = true; - else - delete styleRules[i].usedProperties[name]; - foundPriorityProperties[name] = true; - } else if (name in foundPriorityProperties) - delete styleRules[i].usedProperties[name]; - } - } - } - - if (refresh) { - // Walk the style rules and update the sections with new overloaded and used properties. - for (var i = 0; i < styleRules.length; ++i) { - var styleRule = styleRules[i]; - var section = styleRule.section; - section._usedProperties = (styleRule.usedProperties || usedProperties); - section.update((section === editedSection) || styleRule.computedStyle); - } - } else { - // Make a property section for each style rule. - for (var i = 0; i < styleRules.length; ++i) { - var styleRule = styleRules[i]; - var subtitle = styleRule.subtitle; - delete styleRule.subtitle; - - var computedStyle = styleRule.computedStyle; - delete styleRule.computedStyle; - - var ruleUsedProperties = styleRule.usedProperties; - delete styleRule.usedProperties; - - var editable = styleRule.editable; - delete styleRule.editable; - - // Default editable to true if it was omitted. - if (typeof editable === "undefined") - editable = true; - - var section = new WebInspector.StylePropertiesSection(styleRule, subtitle, computedStyle, (ruleUsedProperties || usedProperties), editable); - section.expanded = true; - section.pane = this; - - body.appendChild(section.element); - this.sections.push(section); - } - } - } -} - -WebInspector.StylesSidebarPane.prototype.__proto__ = WebInspector.SidebarPane.prototype; - -WebInspector.StylePropertiesSection = function(styleRule, subtitle, computedStyle, usedProperties, editable) -{ - WebInspector.PropertiesSection.call(this, styleRule.selectorText); - - this.styleRule = styleRule; - this.computedStyle = computedStyle; - this.editable = (editable && !computedStyle); - - // Prevent editing the user agent rules. - if (this.styleRule.parentStyleSheet && !this.styleRule.parentStyleSheet.ownerNode) - this.editable = false; - - this._usedProperties = usedProperties; - - if (computedStyle) { - if (Preferences.showInheritedComputedStyleProperties) - this.element.addStyleClass("show-inherited"); - - var showInheritedLabel = document.createElement("label"); - var showInheritedInput = document.createElement("input"); - showInheritedInput.type = "checkbox"; - showInheritedInput.checked = Preferences.showInheritedComputedStyleProperties; - - var computedStyleSection = this; - var showInheritedToggleFunction = function(event) { - Preferences.showInheritedComputedStyleProperties = showInheritedInput.checked; - if (Preferences.showInheritedComputedStyleProperties) - computedStyleSection.element.addStyleClass("show-inherited"); - else - computedStyleSection.element.removeStyleClass("show-inherited"); - event.stopPropagation(); - }; - - showInheritedLabel.addEventListener("click", showInheritedToggleFunction, false); - - showInheritedLabel.appendChild(showInheritedInput); - showInheritedLabel.appendChild(document.createTextNode(WebInspector.UIString("Show inherited properties"))); - this.subtitleElement.appendChild(showInheritedLabel); - } else { - if (!subtitle) { - if (this.styleRule.parentStyleSheet && this.styleRule.parentStyleSheet.href) { - var url = this.styleRule.parentStyleSheet.href; - subtitle = WebInspector.linkifyURL(url, url.trimURL(WebInspector.mainResource.domain).escapeHTML()); - this.subtitleElement.addStyleClass("file"); - } else if (this.styleRule.parentStyleSheet && !this.styleRule.parentStyleSheet.ownerNode) - subtitle = WebInspector.UIString("user agent stylesheet"); - else - subtitle = WebInspector.UIString("inline stylesheet"); - } - - this.subtitle = subtitle; - } -} - -WebInspector.StylePropertiesSection.prototype = { - get usedProperties() - { - return this._usedProperties || {}; - }, - - set usedProperties(x) - { - this._usedProperties = x; - this.update(); - }, - - isPropertyInherited: function(property) - { - if (!this.computedStyle || !this._usedProperties) - return false; - // These properties should always show for Computed Style. - var alwaysShowComputedProperties = { "display": true, "height": true, "width": true }; - return !(property in this.usedProperties) && !(property in alwaysShowComputedProperties); - }, - - isPropertyOverloaded: function(property, shorthand) - { - if (this.computedStyle || !this._usedProperties) - return false; - - var used = (property in this.usedProperties); - if (used || !shorthand) - return !used; - - // Find out if any of the individual longhand properties of the shorthand - // are used, if none are then the shorthand is overloaded too. - var longhandProperties = this.styleRule.style.getLonghandProperties(property); - for (var j = 0; j < longhandProperties.length; ++j) { - var individualProperty = longhandProperties[j]; - if (individualProperty in this.usedProperties) - return false; - } - - return true; - }, - - update: function(full) - { - if (full || this.computedStyle) { - this.propertiesTreeOutline.removeChildren(); - this.populated = false; - } else { - var child = this.propertiesTreeOutline.children[0]; - while (child) { - child.overloaded = this.isPropertyOverloaded(child.name, child.shorthand); - child = child.traverseNextTreeElement(false, null, true); - } - } - }, - - onpopulate: function() - { - var style = this.styleRule.style; - if (!style.length) - return; - - var foundShorthands = {}; - var uniqueProperties = style.getUniqueProperties(); - uniqueProperties.sort(); - - for (var i = 0; i < uniqueProperties.length; ++i) { - var name = uniqueProperties[i]; - var shorthand = style.getPropertyShorthand(name); - - if (shorthand && shorthand in foundShorthands) - continue; - - if (shorthand) { - foundShorthands[shorthand] = true; - name = shorthand; - } - - var isShorthand = (shorthand ? true : false); - var inherited = this.isPropertyInherited(name); - var overloaded = this.isPropertyOverloaded(name, isShorthand); - - var item = new WebInspector.StylePropertyTreeElement(style, name, isShorthand, inherited, overloaded); - this.propertiesTreeOutline.appendChild(item); - } - } -} - -WebInspector.StylePropertiesSection.prototype.__proto__ = WebInspector.PropertiesSection.prototype; - -WebInspector.StylePropertyTreeElement = function(style, name, shorthand, inherited, overloaded) -{ - this.style = style; - this.name = name; - this.shorthand = shorthand; - this._inherited = inherited; - this._overloaded = overloaded; - - // Pass an empty title, the title gets made later in onattach. - TreeElement.call(this, "", null, shorthand); -} - -WebInspector.StylePropertyTreeElement.prototype = { - get inherited() - { - return this._inherited; - }, - - set inherited(x) - { - if (x === this._inherited) - return; - this._inherited = x; - this.updateState(); - }, - - get overloaded() - { - return this._overloaded; - }, - - set overloaded(x) - { - if (x === this._overloaded) - return; - this._overloaded = x; - this.updateState(); - }, - - onattach: function() - { - this.updateTitle(); - }, - - updateTitle: function() - { - // "Nicknames" for some common values that are easier to read. - var valueNicknames = { - "rgb(0, 0, 0)": "black", - "#000": "black", - "#000000": "black", - "rgb(255, 255, 255)": "white", - "#fff": "white", - "#ffffff": "white", - "#FFF": "white", - "#FFFFFF": "white", - "rgba(0, 0, 0, 0)": "transparent", - "rgb(255, 0, 0)": "red", - "rgb(0, 255, 0)": "lime", - "rgb(0, 0, 255)": "blue", - "rgb(255, 255, 0)": "yellow", - "rgb(255, 0, 255)": "magenta", - "rgb(0, 255, 255)": "cyan" - }; - - var priority = (this.shorthand ? this.style.getShorthandPriority(this.name) : this.style.getPropertyPriority(this.name)); - var value = (this.shorthand ? this.style.getShorthandValue(this.name) : this.style.getPropertyValue(this.name)); - var htmlValue = value; - - if (priority && !priority.length) - delete priority; - if (priority) - priority = "!" + priority; - - if (value) { - var urls = value.match(/url\([^)]+\)/); - if (urls) { - for (var i = 0; i < urls.length; ++i) { - var url = urls[i].substring(4, urls[i].length - 1); - htmlValue = htmlValue.replace(urls[i], "url(" + WebInspector.linkifyURL(url) + ")"); - } - } else { - if (value in valueNicknames) - htmlValue = valueNicknames[value]; - htmlValue = htmlValue.escapeHTML(); - } - } else - htmlValue = value = ""; - - this.updateState(); - - var nameElement = document.createElement("span"); - nameElement.className = "name"; - nameElement.textContent = this.name; - - var valueElement = document.createElement("span"); - valueElement.className = "value"; - valueElement.innerHTML = htmlValue; - - if (priority) { - var priorityElement = document.createElement("span"); - priorityElement.className = "priority"; - priorityElement.textContent = priority; - } - - this.listItemElement.removeChildren(); - - this.listItemElement.appendChild(nameElement); - this.listItemElement.appendChild(document.createTextNode(": ")); - this.listItemElement.appendChild(valueElement); - - if (priorityElement) { - this.listItemElement.appendChild(document.createTextNode(" ")); - this.listItemElement.appendChild(priorityElement); - } - - this.listItemElement.appendChild(document.createTextNode(";")); - - if (value) { - // FIXME: this dosen't catch keyword based colors like black and white - var colors = value.match(/((rgb|hsl)a?\([^)]+\))|(#[0-9a-fA-F]{6})|(#[0-9a-fA-F]{3})/g); - if (colors) { - var colorsLength = colors.length; - for (var i = 0; i < colorsLength; ++i) { - var swatchElement = document.createElement("span"); - swatchElement.className = "swatch"; - swatchElement.style.setProperty("background-color", colors[i]); - this.listItemElement.appendChild(swatchElement); - } - } - } - - this.tooltip = this.name + ": " + (valueNicknames[value] || value) + (priority ? " " + priority : ""); - }, - - updateState: function() - { - if (!this.listItemElement) - return; - - var value = (this.shorthand ? this.style.getShorthandValue(this.name) : this.style.getPropertyValue(this.name)); - if (this.style.isPropertyImplicit(this.name) || value === "initial") - this.listItemElement.addStyleClass("implicit"); - else - this.listItemElement.removeStyleClass("implicit"); - - if (this.inherited) - this.listItemElement.addStyleClass("inherited"); - else - this.listItemElement.removeStyleClass("inherited"); - - if (this.overloaded) - this.listItemElement.addStyleClass("overloaded"); - else - this.listItemElement.removeStyleClass("overloaded"); - }, - - onpopulate: function() - { - // Only populate once and if this property is a shorthand. - if (this.children.length || !this.shorthand) - return; - - var longhandProperties = this.style.getLonghandProperties(this.name); - for (var i = 0; i < longhandProperties.length; ++i) { - var name = longhandProperties[i]; - - if (this.treeOutline.section) { - var inherited = this.treeOutline.section.isPropertyInherited(name); - var overloaded = this.treeOutline.section.isPropertyOverloaded(name); - } - - var item = new WebInspector.StylePropertyTreeElement(this.style, name, false, inherited, overloaded); - this.appendChild(item); - } - }, - - ondblclick: function(element, event) - { - this.startEditing(event.target); - }, - - startEditing: function(selectElement) - { - // FIXME: we don't allow editing of longhand properties under a shorthand right now. - if (this.parent.shorthand) - return; - - if (this.editing || (this.treeOutline.section && !this.treeOutline.section.editable)) - return; - - this.editing = true; - this.previousTextContent = this.listItemElement.textContent; - - this.listItemElement.addStyleClass("focusable"); - this.listItemElement.addStyleClass("editing"); - this.wasExpanded = this.expanded; - this.collapse(); - // Lie about out children to prevent toggling on click. - this.hasChildren = false; - - if (!selectElement) - selectElement = this.listItemElement; - - window.getSelection().setBaseAndExtent(selectElement, 0, selectElement, 1); - - var treeElement = this; - this.listItemElement.blurred = function() { treeElement.commitEditing() }; - this.listItemElement.handleKeyEvent = function(event) { - if (event.keyIdentifier === "Enter") { - treeElement.commitEditing(); - event.preventDefault(); - } else if (event.keyCode === 27) { // Escape key - treeElement.cancelEditing(); - event.preventDefault(); - } - }; - - this.previousFocusElement = WebInspector.currentFocusElement; - WebInspector.currentFocusElement = this.listItemElement; - }, - - endEditing: function() - { - // Revert the changes done in startEditing(). - delete this.listItemElement.blurred; - delete this.listItemElement.handleKeyEvent; - - WebInspector.currentFocusElement = this.previousFocusElement; - delete this.previousFocusElement; - - delete this.previousTextContent; - delete this.editing; - - this.listItemElement.removeStyleClass("focusable"); - this.listItemElement.removeStyleClass("editing"); - this.hasChildren = (this.children.length ? true : false); - if (this.wasExpanded) { - delete this.wasExpanded; - this.expand(); - } - }, - - cancelEditing: function() - { - this.endEditing(); - this.updateTitle(); - }, - - commitEditing: function() - { - var previousContent = this.previousTextContent; - - this.endEditing(); - - var userInput = this.listItemElement.textContent; - if (userInput === previousContent) - return; // nothing changed, so do nothing else - - var userInputLength = userInput.trimWhitespace().length; - - // Create a new element to parse the user input CSS. - var parseElement = document.createElement("span"); - parseElement.setAttribute("style", userInput); - - var userInputStyle = parseElement.style; - if (userInputStyle.length || !userInputLength) { - // The input was parsable or the user deleted everything, so remove the - // original property from the real style declaration. If this represents - // a shorthand remove all the longhand properties. - if (this.shorthand) { - var longhandProperties = this.style.getLonghandProperties(this.name); - for (var i = 0; i < longhandProperties.length; ++i) - this.style.removeProperty(longhandProperties[i]); - } else - this.style.removeProperty(this.name); - } - - if (!userInputLength) { - // The user deleted the everything, so remove the tree element and update. - if (this.treeOutline.section && this.treeOutline.section.pane) - this.treeOutline.section.pane.update(); - this.parent.removeChild(this); - return; - } - - if (!userInputStyle.length) { - // The user typed something, but it didn't parse. Just abort and restore - // the original title for this property. - this.updateTitle(); - return; - } - - // Iterate of the properties on the test element's style declaration and - // add them to the real style declaration. We take care to move shorthands. - var foundShorthands = {}; - var uniqueProperties = userInputStyle.getUniqueProperties(); - for (var i = 0; i < uniqueProperties.length; ++i) { - var name = uniqueProperties[i]; - var shorthand = userInputStyle.getPropertyShorthand(name); - - if (shorthand && shorthand in foundShorthands) - continue; - - if (shorthand) { - var value = userInputStyle.getShorthandValue(shorthand); - var priority = userInputStyle.getShorthandPriority(shorthand); - foundShorthands[shorthand] = true; - } else { - var value = userInputStyle.getPropertyValue(name); - var priority = userInputStyle.getPropertyPriority(name); - } - - // Set the property on the real style declaration. - this.style.setProperty((shorthand || name), value, priority); - } - - if (this.treeOutline.section && this.treeOutline.section.pane) - this.treeOutline.section.pane.update(null, this.treeOutline.section); - else if (this.treeOutline.section) - this.treeOutline.section.update(true); - else - this.updateTitle(); // FIXME: this will not show new properties. But we don't hit his case yet. - } -} - -WebInspector.StylePropertyTreeElement.prototype.__proto__ = TreeElement.prototype; diff --git a/WebCore/page/inspector/WebKit.qrc b/WebCore/page/inspector/WebKit.qrc deleted file mode 100644 index 0a5e164..0000000 --- a/WebCore/page/inspector/WebKit.qrc +++ /dev/null @@ -1,137 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource prefix="/webkit/inspector"> - <file>ConsolePanel.js</file> - <file>NetworkPanel.js</file> - <file>Resource.js</file> - <file>ResourceCategory.js</file> - <file>ResourcePanel.js</file> - <file>inspector.css</file> - <file>inspector.html</file> - <file>inspector.js</file> - <file>treeoutline.js</file> - <file>utilities.js</file> - <file>Images/alternateTableRows.png</file> - <file>Images/attachedShadow.png</file> - <file>Images/backNormal.png</file> - <file>Images/bottomShadow.png</file> - <file>Images/breadcrumbBackground.png</file> - <file>Images/checker.png</file> - <file>Images/console.png</file> - <file>Images/darkShadow.png</file> - <file>Images/database.png</file> - <file>Images/databaseBrowserViewNormal.png</file> - <file>Images/databaseBrowserViewNormalSelected.png</file> - <file>Images/databaseBrowserViewSmall.png</file> - <file>Images/databaseBrowserViewSmallSelected.png</file> - <file>Images/databaseQueryViewNormal.png</file> - <file>Images/databaseQueryViewNormalSelected.png</file> - <file>Images/databaseQueryViewSmall.png</file> - <file>Images/databaseQueryViewSmallSelected.png</file> - <file>Images/disclosureDownPressed.png</file> - <file>Images/disclosureRightDown.png</file> - <file>Images/disclosureRightPressed.png</file> - <file>Images/document.png</file> - <file>Images/domViewNormal.png</file> - <file>Images/domViewNormalSelected.png</file> - <file>Images/domViewSmall.png</file> - <file>Images/domViewSmallSelected.png</file> - <file>Images/downTriangle.png</file> - <file>Images/errorIcon.png</file> - <file>Images/errorMediumIcon.png</file> - <file>Images/folder.png</file> - <file>Images/forwardNormal.png</file> - <file>Images/glossyHeader.png</file> - <file>Images/glossyHeaderPressed.png</file> - <file>Images/goArrow.png</file> - <file>Images/gradient.png</file> - <file>Images/gradientHighlight.png</file> - <file>Images/gradientHighlightBottom.png</file> - <file>Images/hideStatusWidget.png</file> - <file>Images/hideStatusWidgetPressed.png</file> - <file>Images/network.png</file> - <file>Images/paneBottomGrow.png</file> - <file>Images/paneBottomGrowActive.png</file> - <file>Images/paneGrowHandleLine.png</file> - <file>Images/paneHeader.png</file> - <file>Images/paneHeaderActive.png</file> - <file>Images/plainDocument.png</file> - <file>Images/popupArrows.png</file> - <file>Images/popupArrowsBlack.png</file> - <file>Images/reload.png</file> - <file>Images/rightTriangle.png</file> - <file>Images/segment.png</file> - <file>Images/segmentEnd.png</file> - <file>Images/segmentHover.png</file> - <file>Images/segmentHoverEnd.png</file> - <file>Images/segmentSelected.png</file> - <file>Images/segmentSelectedEnd.png</file> - <file>Images/showStatusWidget.png</file> - <file>Images/showStatusWidgetPressed.png</file> - <file>Images/sidbarItemBackground.png</file> - <file>Images/sidebarActionWidget.png</file> - <file>Images/sidebarActionWidgetPressed.png</file> - <file>Images/sidebarAttachWidget.png</file> - <file>Images/sidebarAttachWidgetPressed.png</file> - <file>Images/sidebarDetachWidget.png</file> - <file>Images/sidebarDetachWidgetPressed.png</file> - <file>Images/sidebarResizeWidget.png</file> - <file>Images/sidebarSelection.png</file> - <file>Images/sidebarSelectionBlurred.png</file> - <file>Images/sidebarSelectionBlurredTall.png</file> - <file>Images/sidebarSelectionGray.png</file> - <file>Images/sidebarSelectionGrayTall.png</file> - <file>Images/sidebarSelectionTall.png</file> - <file>Images/sidebarStatusAreaBackground.png</file> - <file>Images/sourceViewNormal.png</file> - <file>Images/sourceViewNormalSelected.png</file> - <file>Images/sourceViewSmall.png</file> - <file>Images/sourceViewSmallSelected.png</file> - <file>Images/splitviewDimple.png</file> - <file>Images/splitviewDividerBackground.png</file> - <file>Images/tab.png</file> - <file>Images/tabSelected.png</file> - <file>Images/timelinePillBlue.png</file> - <file>Images/timelinePillGray.png</file> - <file>Images/timelinePillGreen.png</file> - <file>Images/timelinePillOrange.png</file> - <file>Images/timelinePillPurple.png</file> - <file>Images/timelinePillRed.png</file> - <file>Images/timelinePillYellow.png</file> - <file>Images/tipBalloon.png</file> - <file>Images/tipBalloonBottom.png</file> - <file>Images/tipIcon.png</file> - <file>Images/tipIconPressed.png</file> - <file>Images/toggleDown.png</file> - <file>Images/toggleUp.png</file> - <file>Images/toolbarBackground.png</file> - <file>Images/toolbarBackgroundInactive.png</file> - <file>Images/toolbarButtonNormal.png</file> - <file>Images/toolbarButtonNormalInactive.png</file> - <file>Images/toolbarButtonNormalPressed.png</file> - <file>Images/toolbarButtonNormalSelected.png</file> - <file>Images/toolbarButtonNormalSelectedInactive.png</file> - <file>Images/toolbarButtonSmall.png</file> - <file>Images/toolbarButtonSmallInactive.png</file> - <file>Images/toolbarButtonSmallPressed.png</file> - <file>Images/toolbarButtonSmallSelected.png</file> - <file>Images/toolbarButtonSmallSelectedInactive.png</file> - <file>Images/toolbarPopupButtonNormal.png</file> - <file>Images/toolbarPopupButtonNormalInactive.png</file> - <file>Images/toolbarPopupButtonNormalPressed.png</file> - <file>Images/toolbarPopupButtonSmall.png</file> - <file>Images/toolbarPopupButtonSmallInactive.png</file> - <file>Images/toolbarPopupButtonSmallPressed.png</file> - <file>Images/toolbarSplitButtonDividerNormal.png</file> - <file>Images/toolbarSplitButtonDividerNormalInactive.png</file> - <file>Images/toolbarSplitButtonDividerSmall.png</file> - <file>Images/toolbarSplitButtonDividerSmallInactive.png</file> - <file>Images/treeDownTriangleBlack.png</file> - <file>Images/treeDownTriangleWhite.png</file> - <file>Images/treeLeftTriangleBlack.png</file> - <file>Images/treeRightTriangleBlack.png</file> - <file>Images/treeRightTriangleWhite.png</file> - <file>Images/warningIcon.png</file> - <file>Images/warningMediumIcon.png</file> - <file>Images/warningsErrors.png</file> -</qresource> -</RCC> diff --git a/WebCore/page/inspector/inspector.css b/WebCore/page/inspector/inspector.css deleted file mode 100644 index 2ba3208..0000000 --- a/WebCore/page/inspector/inspector.css +++ /dev/null @@ -1,2169 +0,0 @@ -/* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -body { - -webkit-user-select: none; - cursor: default; - height: 100%; - width: 100%; - overflow: hidden; - font-family: Lucida Grande, sans-serif; - margin: 0; - -webkit-text-size-adjust: none; -} - -iframe, a img { - border: none; -} - -img { - -webkit-user-drag: none; -} - -.focused .selected { - background-color: rgb(56, 121, 217); -} - -.blurred .selected, body.inactive .selected { - background-color: rgb(212, 212, 212); -} - -.hidden { - display: none; -} - -#toolbar { - position: absolute; - top: 0; - left: 0; - right: 0; - height: 32px; - background-color: rgb(245, 245, 250); - background-image: url(Images/toolbarBackground.png); - background-repeat: repeat-x; - background-position: top; - border-bottom: 1px solid rgb(80, 80, 80); - padding: 2px 8px; - -webkit-box-sizing: border-box; - -webkit-background-size: auto 135%; -} - -body.detached.platform-mac-leopard #toolbar { - background: transparent !important; -} - -body.inactive #toolbar { - background-image: url(Images/toolbarBackgroundInactive.png); - border-bottom: 1px solid rgb(64%, 64%, 64%); -} - -body.attached #toolbar { - height: 28px; - border-top: 1px solid rgb(80, 80, 80); - background-image: url(Images/darkShadow.png), url(Images/toolbarBackground.png); - background-position: center -2px, top; - -webkit-background-size: auto auto, auto 135%; -} - -body.attached.inactive #toolbar { - background-image: url(Images/darkShadow.png), url(Images/toolbarBackgroundInactive.png); - background-position: center -3px, top; - border-top: 1px solid rgb(100, 100, 100); - border-bottom: 1px solid rgb(64%, 64%, 64%); -} - -#toolbar button, #toolbar button:disabled:active { - border-width: 3px 3px 4px 3px; - border-style: none; - border-color: transparent; - background-color: transparent; - -webkit-border-image: url(Images/toolbarButtonNormal.png) 3 3 4 3; - height: 23px; - -webkit-box-sizing: border-box; - vertical-align: middle; - line-height: 10px; -} - -#toolbar button:focus { - outline: none; -} - -#toolbar button:active { - -webkit-border-image: url(Images/toolbarButtonNormalPressed.png) 3 3 4 3; -} - -#toolbar button.selected { - -webkit-border-image: url(Images/toolbarButtonNormalSelected.png) 3 3 4 3; -} - -body.inactive #toolbar button:active { - -webkit-border-image: url(Images/toolbarButtonNormalPressedInactive.png) 3 3 4 3; -} - -body.inactive #toolbar button.selected { - -webkit-border-image: url(Images/toolbarButtonNormalSelectedInactive.png) 3 3 4 3; -} - -body.inactive #toolbar button, body.inactive #toolbar button:disabled:active { - -webkit-border-image: url(Images/toolbarButtonNormalInactive.png) 3 3 4 3; -} - -body.attached #toolbar button { - height: 19px; - line-height: 7px; - -webkit-border-image: url(Images/toolbarButtonSmall.png) 3 3 4 3; -} - -body.attached #toolbar button:active { - -webkit-border-image: url(Images/toolbarButtonSmallPressed.png) 3 3 4 3; -} - -body.attached #toolbar button.selected { - -webkit-border-image: url(Images/toolbarButtonSmallSelected.png) 3 3 4 3; -} - -body.attached.inactive #toolbar button:active { - -webkit-border-image: url(Images/toolbarButtonSmallPressedInactive.png) 3 3 4 3; -} - -body.attached.inactive #toolbar button.selected { - -webkit-border-image: url(Images/toolbarButtonSmallSelectedInactive.png) 3 3 4 3; -} - -body.attached.inactive #toolbar button, body.inactive #toolbar button:disabled:active { - -webkit-border-image: url(Images/toolbarButtonSmallInactive.png) 3 3 4 3; -} - -#toolbar select, #toolbar select:disabled:active { - background-color: transparent; - border-width: 3px 10px 4px 3px; - border-color: transparent; - -webkit-border-image: url(Images/toolbarPopupButtonNormal.png) 3 10 4 3; - height: 23px; - font-size: 10px; - padding-left: 8px; - padding-right: 6px; - -webkit-box-sizing: border-box; - -webkit-border-radius: 0; - -webkit-appearance: none; - vertical-align: middle; -} - -#toolbar select:focus { - outline: none; -} - -#toolbar select:active { - -webkit-border-image: url(Images/toolbarPopupButtonNormalPressed.png) 3 10 4 3; -} - -body.inactive #toolbar select:active { - -webkit-border-image: url(Images/toolbarPopupButtonNormalPressedInactive.png) 3 10 4 3; -} - -body.inactive #toolbar select, body.inactive #toolbar select:disabled:active { - -webkit-border-image: url(Images/toolbarPopupButtonNormalInactive.png) 3 10 4 3; -} - -body.attached #toolbar select, #toolbar select:disabled:active { - -webkit-border-image: url(Images/toolbarPopupButtonSmall.png) 3 10 4 3; - height: 19px; -} - -body.attached #toolbar select:active { - -webkit-border-image: url(Images/toolbarPopupButtonSmallPressed.png) 3 10 4 3; -} - -body.attached.inactive #toolbar select:active { - -webkit-border-image: url(Images/toolbarPopupButtonSmallPressedInactive.png) 3 10 4 3; -} - -body.attached.inactive #toolbar select, body.inactive #toolbar select:disabled:active { - -webkit-border-image: url(Images/toolbarPopupButtonSmallInactive.png) 3 10 4 3; -} - -#toolbar .split-button-divider { - width: 1px; - height: 23px; - content: url(Images/toolbarSplitButtonDividerNormal.png); - vertical-align: middle; -} - -body.inactive #toolbar .split-button-divider { - content: url(Images/toolbarSplitButtonDividerNormalInactive.png); -} - -body.attached #toolbar .split-button-divider { - height: 19px; - content: url(Images/toolbarSplitButtonDividerSmall.png); -} - -body.attached.inactive #toolbar .split-button-divider { - content: url(Images/toolbarSplitButtonDividerSmallInactive.png); -} - -#toolbar .split-button { - padding: 0; - width: 26px; -} - -body.attached #toolbar .split-button { - width: 20px; -} - -#toolbar .split-button.middle { - border-left: transparent none 0 !important; - border-right: transparent none 0 !important; -} - -#toolbar .split-button.first { - border-right: transparent none 0 !important; -} - -#toolbar .split-button.last { - border-left: transparent none 0 !important; -} - -#back img { - content: url(Images/backNormal.png); - vertical-align: middle; - margin-top: -1px; - width: 8px; - height: 10px; -} - -body.attached #back img { - content: url(Images/treeLeftTriangleBlack.png); - margin-top: -1px; - margin-left: -1px; - width: 8px; - height: 8px; -} - -#back:disabled img, #forward:disabled img { - opacity: 0.45; -} - -#forward img { - content: url(Images/forwardNormal.png); - vertical-align: middle; - margin-top: -1px; - margin-left: 1px; - width: 8px; - height: 10px; -} - -body.attached #forward img { - content: url(Images/treeRightTriangleBlack.png); - margin-top: -1px; - width: 8px; - height: 8px; -} - -.view-button-source img { - content: url(Images/sourceViewNormal.png); - vertical-align: middle; - margin-top: 1px; - margin-left: -1px; - width: 11px; - height: 11px; -} - -.view-button-source.selected img { - content: url(Images/sourceViewNormalSelected.png); -} - -body.attached .view-button-source img { - content: url(Images/sourceViewSmall.png); - width: 8px; - height: 8px; -} - -body.attached .view-button-source.selected img { - content: url(Images/sourceViewSmallSelected.png); -} - -.view-button-dom img { - content: url(Images/domViewNormal.png); - vertical-align: middle; - margin-top: 1px; - margin-left: 3px; - width: 11px; - height: 11px; -} - -.view-button-dom.selected img { - content: url(Images/domViewNormalSelected.png); -} - -body.attached .view-button-dom img { - content: url(Images/domViewSmall.png); - width: 10px; - height: 8px; -} - -body.attached .view-button-dom.selected img { - content: url(Images/domViewSmallSelected.png); -} - -#toolbarButtons { - position: absolute; - left: 200px; - padding-left: 8px; -} - -#search { - float: right; - width: 210px; - font-size: 16px; -} - -body.attached #search { - font-size: 12px; -} - -#searchResults { - position: absolute; - top: -100px; - left: 0; - right: 0; - height: 100px; - z-index: -1; - background-color: white; - border-bottom: 1px solid rgb(180, 180, 180); - overflow-y: auto; - overflow-x: hidden; - -webkit-box-sizing: border-box; -} - -.search-results-section { - color: gray; - width: 28px; - float: left; - margin-left: -45px; - text-align: right; - font-size: 10px; - margin-top: 1px; - white-space: nowrap; -} - -.selected .search-results-section { - color: rgba(255, 255, 255, 0.8); -} - -body.inactive .focused .selected .search-results-section { - color: rgba(0, 0, 0, 0.5); -} - -.blurred .selected .search-results-section { - color: rgba(0, 0, 0, 0.5); -} - -#searchResults > ol > ol > li { - padding-left: 45px; - white-space: nowrap; -} - -.search-matched-string { - background-color: #ff8; -} - -.selected .search-matched-string { - background-color: transparent; -} - -#sidebar { - position: absolute; - top: 32px; - left: 0; - bottom: 0; - width: 200px; - background-color: rgb(214, 221, 229); - border-right: 1px solid rgb(64%, 64%, 64%); - -webkit-box-sizing: border-box; -} - -body.inactive #sidebar { - background-color: rgb(232, 232, 232); -} - -body.attached #sidebar { - top: 28px; -} - -#statusbar { - position: absolute; - padding: 0; - left: 0; - right: 0; - bottom: 0; - height: 21px; - border-top: 1px solid #bbb; - -webkit-box-sizing: border-box; - background-image: url(Images/sidebarStatusAreaBackground.png); - background-position: right, center; - background-repeat: no-repeat, repeat-x; -} - -#statusbar #sidebarResizeWidget { - display: block; - float: right; - width: 17px; - height: 20px; - background: url(Images/sidebarResizeWidget.png) right no-repeat; - cursor: col-resize; -} - -#statusbar button { - -webkit-apearance: none; - vertical-align: top; - border: 0; - width: 32px; - height: 20px; - margin: 0; - margin-left: -1px; - padding: 0; -} - -#statusbar button:focus { - outline: none; -} - -#statusbar button.action { - background-image: url(Images/sidebarActionWidget.png); -} - -#statusbar button.action:active { - background-image: url(Images/sidebarActionWidgetPressed.png); -} - -body.detached #attachToggle { - background-image: url(Images/sidebarAttachWidget.png); -} - -body.detached #attachToggle:active { - background-image: url(Images/sidebarAttachWidgetPressed.png); -} - -body.attached #attachToggle { - background-image: url(Images/sidebarDetachWidget.png); -} - -body.attached #attachToggle:active { - background-image: url(Images/sidebarDetachWidgetPressed.png); -} - -#status { - overflow: hidden; - position: absolute; - bottom: 21px; - left: 0; - width: 100%; - height: 78px; - padding: 2px 0; - margin: 0; - border-top: 1px solid rgb(64%, 64%, 64%); - -webkit-box-sizing: border-box; - list-style: none; - font-size: 11px; - -webkit-transition: bottom 250ms ease-in-out; -} - -#status li { - position: relative; - height: 37px; - -webkit-box-sizing: border-box; -} - -#status li.selected { - background-image: url(Images/sidebarSelectionTall.png); - background-repeat: repeat-x; - background-position: center; - background-color: transparent !important; - color: white; - font-weight: bold; - text-shadow: rgba(0, 0, 0, 0.4) 0 1px 0; -} - -#status .icon { - position: absolute; - top: 2px; - left: 15px; - width: 32px; - height: 32px; - background-repeat: no-repeat; - background-position: center center; -} - -#status .icon.console { - background-image: url(Images/console.png); -} - -#status .icon.network { - background-image: url(Images/network.png); -} - -#status .title { - -webkit-box-sizing: border-box; - position: relative; - top: 5px; - padding-left: 58px; - right: 5px; - display: block; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -#status .title.only { - top: 10px; -} - -#status .info { - -webkit-box-sizing: border-box; - position: relative; - margin-top: 6px; - padding-left: 58px; - right: 5px; - display: block; - font-size: 9px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -#list { - overflow-x: hidden; - overflow-y: auto; - position: absolute; - top: 0; - left: 0; - bottom: 99px; - width: 100%; - padding: 2px 0; - margin: 0; - -webkit-box-sizing: border-box; - list-style: none; - font-size: 11px; - -webkit-transition: bottom 250ms ease-in-out; -} - -#list > li { - height: 26px; - color: rgb(96, 110, 128); - text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0; - font-weight: bold; - line-height: 20px; - text-indent: 20px; - background-image: url(Images/rightTriangle.png); - background-repeat: no-repeat; - background-position: 10px 6px; - text-transform: uppercase; -} - -#list > ol + li { - margin-top: 5px; -} - -#list > li + li { - margin-top: 5px; -} - -#list > li.expanded { - background-image: url(Images/downTriangle.png); - background-position: 10px 7px; -} - -#list > ol { - display: none; - list-style: none; - padding: 0; - margin: 0; -} - -#list > ol.expanded { - display: block; -} - -#list > ol > li { - position: relative; - height: 37px; - -webkit-box-sizing: border-box; -} - -#list > ol > li:-webkit-drag { - background: transparent !important; - color: black !important; - font-weight: normal !important; -} - -#sidebar li:-webkit-drag .count { - display: none; -} - -#list .icon { - position: absolute; - top: 2px; - left: 15px; - width: 32px; - height: 32px; - background-image: url(Images/document.png); - background-repeat: no-repeat; - background-position: center center; -} - -#list .icon.database { - background-image: url(Images/database.png); -} - -#list .icon.plain { - background-image: url(Images/plainDocument.png); -} - -#list .icon.font { - background-image: url(Images/plainDocument.png); -} - -#list .icon.font .preview { - overflow: hidden; - text-align: center; - font-size: 14px; - line-height: 14px; - font-weight: normal; - color: black; - text-shadow: none; -} - -#list .icon .preview { - margin: auto; - display: block; - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - max-width: 20px; - max-height: 22px; - -webkit-box-sizing: border-box; - border-top: 6px solid transparent; -} - -#list .icon .progress { - margin: auto; - display: block; - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; -} - -#list .title { - -webkit-box-sizing: border-box; - position: relative; - top: 5px; - padding-left: 58px; - right: 5px; - display: block; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -#list .title.only { - top: 10px; -} - -#sidebar li .count { - float: right; - margin-top: 11px; - margin-right: 6px; - font-family: Helvetica, sans-serif; - font-weight: bold; - font-size: 11px; - line-height: 10px; - -webkit-border-radius: 7px; - color: white; - text-shadow: none; - background-image: url(Images/gradientHighlight.png), url(Images/gradient.png); - -webkit-background-size: auto 100%, auto 100%; - background-position: center; - padding: 2px 4px; - text-align: center; - text-indent: 0; - min-width: 20px; - -webkit-box-sizing: border-box; -} - -#sidebar li .count.warnings { - background-color: orange; -} - -#sidebar li .count.errors { - background-color: red; -} - -#list .info { - -webkit-box-sizing: border-box; - position: relative; - margin-top: 6px; - padding-left: 58px; - right: 5px; - display: block; - font-size: 9px; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; -} - -#list li.selected { - background-image: url(Images/sidebarSelectionTall.png); - background-repeat: repeat-x; - background-position: center; - background-color: transparent !important; - color: white; - font-weight: bold; - text-shadow: rgba(0, 0, 0, 0.4) 0 1px 0; -} - -#sidebar.blurred li.selected { - background-image: url(Images/sidebarSelectionBlurredTall.png); -} - -body.inactive #sidebar li.selected { - background-image: url(Images/sidebarSelectionGrayTall.png); -} - -#main { - position: absolute; - top: 32px; - left: 200px; - right: 0; - bottom: 0; - overflow: hidden; - background-color: white; - z-index: -100; -} - -body.attached #main { - top: 28px; -} - -#panels { - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - overflow: hidden; - z-index: -100; -} - -.panel { - display: none; - overflow: hidden; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; -} - -.panel.selected { - display: block; - background-color: transparent !important; -} - -.content { - display: none; - -webkit-user-select: text; - cursor: auto; - overflow: none; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; -} - -.content.selected { - display: block; - background-color: transparent !important; -} - -.panel.font { - font-size: 60px; - white-space: pre-wrap; - word-wrap: break-word; - text-align: center; -} - -.panel.font .preview { - position: absolute; - margin-top: auto; - margin-bottom: auto; - top: 0; - left: 0; - right: 0; - bottom: 0; -} - -.panel.image { - position: relative; - width: 100%; - height: 100%; -} - -.panel.image > .image { - position: relative; - -webkit-box-sizing: border-box; - height: 70%; - padding: 20px; -} - -.panel.image > .info { - position: relative; - -webkit-box-sizing: border-box; - height: 30%; - padding-top: 10px; - overflow: auto; - font-size: 11px; -} - -.panel.image img { - margin: auto; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - max-width: 80%; - max-height: 80%; - background-image: url(Images/checker.png); - -webkit-box-shadow: 0px 5px 10px rgba(0, 0, 0, 0.5); -} - -.panel.image .title { - text-align: center; - font-size: 13px; -} - -.panel.image .infoList { - margin: 0; -} - -.panel.image .infoList dt { - font-weight: bold; - display: inline-block; - width: 50%; - text-align: right; -} - -.panel.image .infoList dd { - -webkit-box-sizing: border-box; - display: inline-block; - padding-left: 10px; - width: 50%; - text-align: left; - margin: 0; -} - -.panel.image .infoList dd::after { - white-space: pre; - content: "\A"; -} - -.content.network { -} - -.content.other { - font-family: Monaco, monospace; - font-size: 10px; - white-space: pre-wrap; - padding: 6px; -} - -.content.side { - display: block; - overflow: hidden; - position: absolute; - top: 0; - left: 0; - right: 225px; - bottom: 0; -} - -.content.source iframe { - width: 100%; - height: 100%; -} - -.content.tree { - display: block; - overflow: auto; - padding: 0; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 21px; -} - -.sidebar { - position: absolute; - top: 0; - right: 0; - bottom: 0; - width: 225px; - background-color: rgb(232, 232, 232); - border-left: 1px solid rgb(64%, 64%, 64%); - -webkit-box-sizing: border-box; - -webkit-user-select: none; - cursor: default; - overflow: auto; - padding: 0; -} - -.crumbs { - -webkit-user-select: none; - cursor: default; - -webkit-box-sizing: border-box; - position: absolute; - left: 0; - right: 0; - bottom: 0; - height: 21px; - background-image: url(Images/breadcrumbBackground.png); - background-repeat: repeat-x; - border-top: 1px solid #bbb; - font-size: 11px; - line-height: 19px; - text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0; - color: rgb(20, 20, 20); - overflow: hidden; -} - -.crumbs > div { - position: absolute; -} - -.crumbs .crumb { - -webkit-box-sizing: border-box; - height: 20px; - border-width: 0 11px 0 0; - -webkit-border-image: url(Images/segment.png) 0 11 0 0; - margin-right: -11px; - padding-left: 15px; - padding-right: 2px; - white-space: nowrap; - float: right; -} - -.crumbs .crumb.collapsed > * { - display: none; -} - -.crumbs .crumb.collapsed::before { - content: "\2026"; /* ellipses */ - font-weight: bold; -} - -.crumbs .crumb.compact .extra { - display: none; -} - -.crumbs .crumb.dimmed { - color: rgba(0, 0, 0, 0.45); -} - -.crumbs .crumb.start { - padding-left: 7px; -} - -.crumbs .crumb.end { - border-width: 0 2px 0 0; - padding-right: 6px; - -webkit-border-image: url(Images/segmentEnd.png) 0 2 0 0; -} - -.crumbs .crumb.selected { - -webkit-border-image: url(Images/segmentSelected.png) 0 11 0 0; - background-color: transparent !important; - color: black; -} - -.crumbs .crumb.selected:hover { - -webkit-border-image: url(Images/segmentSelected.png) 0 11 0 0; -} - -.crumbs .crumb.selected.end, .crumbs .crumb.selected.end:hover { - -webkit-border-image: url(Images/segmentSelectedEnd.png) 0 2 0 0; -} - -.crumbs .crumb:hover { - -webkit-border-image: url(Images/segmentHover.png) 0 11 0 0; - color: black; -} - -.crumbs .crumb.dimmed:hover { - -webkit-border-image: url(Images/segmentHover.png) 0 11 0 0; - color: rgba(0, 0, 0, 0.75); -} - -.crumbs .crumb.end:hover { - -webkit-border-image: url(Images/segmentHoverEnd.png) 0 2 0 0; -} - -.outline-disclosure li .selection { - display: none; - position: absolute; - left: 0; - right: 0; - height: 15px; - z-index: -1; -} - -.outline-disclosure li.selected .selection { - display: block; -} - -.content.tree > ol, #searchResults > ol { - position: relative; - padding: 2px 6px !important; - margin: 0; - color: black; - -webkit-user-select: none; - cursor: default; - min-width: 100%; - -webkit-box-sizing: border-box; -} - -.outline-disclosure, .outline-disclosure ol { - list-style-type: none; - font-size: 11px; - -webkit-padding-start: 12px; - margin: 0; -} - -.outline-disclosure li { - padding: 0 0 2px 14px; - -webkit-box-sizing: border-box; - margin-top: 1px; - margin-bottom: 1px; - word-wrap: break-word; - text-indent: -2px -} - -.blurred .outline-disclosure li.selected, body.inactive .outline-disclosure li.selected { - background-color: transparent !important; - color: black; -} - -.outline-disclosure li.selected { - background-color: transparent !important; - color: white; -} - -.outline-disclosure li.parent { - text-indent: -12px -} - -.content.tree li .webkit-html-tag.close { - margin-left: -12px; -} - -.outline-disclosure li.parent::before { - content: url(Images/treeRightTriangleBlack.png); - float: left; - width: 8px; - height: 8px; - margin-top: 1px; - padding-right: 2px; -} - -.blurred .outline-disclosure li.parent.selected::before, body.inactive .outline-disclosure li.parent.selected::before { - content: url(Images/treeRightTriangleBlack.png); -} - -.outline-disclosure li.parent.selected::before { - content: url(Images/treeRightTriangleWhite.png); -} - -.blurred .outline-disclosure li.parent.expanded.selected::before, body.inactive .outline-disclosure li.parent.expanded.selected::before { - content: url(Images/treeDownTriangleBlack.png); -} - -.outline-disclosure li.parent.expanded:before { - content: url(Images/treeDownTriangleBlack.png); -} - -.outline-disclosure li.parent.expanded.selected::before { - content: url(Images/treeDownTriangleWhite.png); -} - -.outline-disclosure ol.children { - display: none; -} - -.outline-disclosure ol.children.expanded { - display: block; -} - -.webkit-html-comment { - /* Keep this in sync with view-source.css (.webkit-html-comment) */ - color: rgb(35, 110, 37); -} - -.webkit-html-tag { - /* Keep this in sync with view-source.css (.webkit-html-tag) */ - color: rgb(136, 18, 128); -} - -.webkit-html-attribute-name { - /* Keep this in sync with view-source.css (.webkit-html-attribute-name) */ - color: rgb(153, 69, 0); -} - -.webkit-html-attribute-value { - /* Keep this in sync with view-source.css (.webkit-html-attribute-value) */ - color: rgb(26, 26, 166); -} - -.webkit-html-external-link, .webkit-html-resource-link { - /* Keep this in sync with view-source.css (.webkit-html-external-link, .webkit-html-resource-link) */ - color: #00e; -} - -.webkit-html-external-link { - /* Keep this in sync with view-source.css (.webkit-html-external-link) */ - text-decoration: none; -} - -.webkit-html-external-link:hover { - /* Keep this in sync with view-source.css (.webkit-html-external-link:hover) */ - text-decoration: underline; -} - -body:not(.inactive) .focused .outline-disclosure li.selected * { - color: inherit; -} - -.section { - display: block; - -webkit-box-shadow: rgba(0, 0, 0, .5) 2px 2px 5px; - -webkit-border-radius: 8px; - background-color: white; - font-size: 11px; - margin-bottom: 8px; -} - -.section .header { - padding: 2px 8px 4px; - border: 2px solid rgba(255, 255, 255, 0.5); - background-color: rgb(214, 221, 229); - background-image: url(Images/gradient.png); - background-repeat: repeat-x; - background-position: bottom; - -webkit-background-size: auto 100%; - -webkit-border-radius: 8px; - text-shadow: rgba(255, 255, 255, 0.75) 0 1px 0; -} - -.section.expanded .header { - border-bottom: 2px ridge rgba(214, 221, 229, 0.5); - -webkit-border-top-right-radius: 8px; - -webkit-border-top-left-radius: 8px; - -webkit-border-bottom-right-radius: 0; - -webkit-border-bottom-left-radius: 0; -} - -.section .header .title { - font-weight: bold; - word-wrap: break-word; -} - -.section .header label { - display: none; -} - -.section.expanded .header label { - display: inline; -} - -.section .header input[type=checkbox] { - height: 1em; - width: 1em; - margin-left: 0; - margin-top: 0; - margin-bottom: 0; - vertical-align: top; -} - -.section .header .subtitle { - margin-top: 2px; - font-size: 10px; - word-wrap: break-word; -} - -.section .header .subtitle a { - color: inherit; -} - -.section .properties { - display: none; - margin: 0; - padding: 2px 6px 5px; - list-style: none; -} - -.section.expanded .properties { - display: block; -} - -.section .properties li { - margin-left: 10px; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - -webkit-user-select: text; - cursor: auto; - outline: none; -} - -.section .properties li.parent { - margin-left: 0; -} - -.section .properties li.selected { - background-color: transparent !important; -} - -.section .properties ol { - display: none; - margin: 0; - -webkit-padding-start: 12px; - list-style: none; -} - -.section .properties ol.expanded { - display: block; -} - -.section .properties li.parent::before { - content: url(Images/treeRightTriangleBlack.png); - opacity: 0.75; - float: left; - width: 8px; - height: 8px; - margin-top: 0; - padding-right: 2px; - -webkit-user-select: none; - cursor: default; -} - -.section .properties li.parent.expanded::before { - content: url(Images/treeDownTriangleBlack.png); - margin-top: 1px; -} - -.section .properties li.editing { - -webkit-box-shadow: rgba(0, 0, 0, .5) 3px 3px 4px; - outline: 1px solid rgb(66%, 66%, 66%); - background-color: white; - -webkit-user-modify: read-write-plaintext-only; - text-overflow: clip; - margin-left: 8px; - padding-left: 2px; - margin-bottom: -1px; - padding-bottom: 1px; - text-decoration: none !important; - opacity: 1.0 !important; -} - -.section .properties li.editing.parent::before { - display: none; -} - -.section .properties li.editing * { - color: black !important; -} - -.section .properties .overloaded { - text-decoration: line-through; -} - -.section .properties .implicit, .section .properties .inherited { - opacity: 0.5; -} - -.section:not(.show-inherited) .properties .inherited { - display: none; -} - -.section .properties .name { - color: rgb(136, 19, 145); -} - -.section .properties .value.dimmed { - color: rgb(100, 100, 100); -} - -.section .properties .number { - color: blue; -} - -.section .properties .priority { - color: rgb(128, 0, 0); -} - -.section .properties .keyword { - color: rgb(136, 19, 79); -} - -.section .properties .color { - color: rgb(118, 15, 21); -} - -.swatch { - display: inline-block; - vertical-align: middle; - margin-left: 4px; - width: 0.75em; - height: 0.75em; - border: 1px solid rgb(180, 180, 180); -} - -.pane { - margin-top: 1px; -} - -.pane > .title { - background-image: url(Images/paneHeader.png); - background-repeat: repeat-x; - background-position: bottom; - -webkit-background-size: auto 100%; - height: 14px; - padding: 0 6px; - border-top: 1px solid rgb(129, 129, 129); - border-bottom: 1px solid rgb(129, 129, 129); - font-weight: bold; - font-size: 11px; - color: rgb(85, 85, 85); -} - -.pane > .title:active { - background-image: url(Images/paneHeaderActive.png); -} - -.pane > .title::before { - content: url(Images/treeRightTriangleBlack.png); - opacity: 0.75; - float: left; - width: 8px; - height: 8px; - margin-right: 3px; - margin-top: 0; -} - -.pane.expanded > .title::before { - margin-top: 1px; - content: url(Images/treeDownTriangleBlack.png); -} - -.pane > .body { - position: relative; - padding: 8px; - display: none; - overflow: auto; -} - -.pane.expanded > .body, .pane.expanded > .growbar { - display: block; -} - -.pane > .growbar { - display: none; - background-image: url(Images/paneGrowHandleLine.png), url(Images/paneBottomGrow.png); - background-repeat: no-repeat, repeat-x; - background-position: center center, bottom; - -webkit-background-size: auto 100%, auto 100%; - height: 5px; -} - -.metrics { - font-size: 10px; - text-align: center; - white-space: nowrap; -} - -.metrics .label { - position: absolute; - margin-top: -10px; - font-size: 9px; - color: grey; - background-color: rgb(232, 232, 232); - margin-left: 3px; - padding-left: 2px; - padding-right: 2px; -} - -.metrics .margin { - border: 1px dashed; - display: inline-block; - -webkit-box-sizing: border-box; - padding: 3px; - margin: 3px; -} - -.metrics .border { - border: 1px black solid; - display: inline-block; - vertical-align: middle; - -webkit-box-sizing: border-box; - padding: 3px; - margin: 3px; -} - -.metrics .padding { - border: 1px grey dashed; - display: inline-block; - vertical-align: middle; - -webkit-box-sizing: border-box; - padding: 3px; - margin: 3px; -} - -.metrics .content { - position: static; - border: 1px grey solid; - display: inline-block; - vertical-align: middle; - -webkit-box-sizing: border-box; - padding: 3px; - margin: 3px; - min-width: 80px; - text-align: center; - overflow: visible; -} - -.metrics .left { - display: inline-block; - text-align: center; - vertical-align: middle; - -webkit-box-sizing: border-box; -} - -.metrics .right { - display: inline-block; - text-align: center; - vertical-align: middle; - -webkit-box-sizing: border-box; -} - -.metrics .top { - text-align: center; -} - -.metrics .bottom { - text-align: center; -} - -.console-message-list { - list-style: none; - margin: 0; - padding: 0; - position: absolute; - top: 0; - bottom: 20px; - left: 0; - right: 0; - overflow: auto; - -webkit-user-select: text; - cursor: auto; -} - -.console-prompt { - font-family: monospace; - font-size: 11px; - margin: 0; - padding: 2px 0 0; - position: absolute; - bottom: 0; - left: 0; - right: 0; - height: 18px; - resize: none; - outline: none; - border: none; - border-top: 1px solid rgb(64%, 64%, 64%); -} - -.console-message, .console-command { - font-size: 10px; - margin: 0; - padding: 3px 3px 3px 24px; - border-bottom: 1px solid rgb(75%, 75%, 75%); - word-break: break-word; - position: relative; -} - -.console-command a:hover { - text-decoration: underline; - cursor: pointer; -} - -.console-message-message { - font-size: 11px; - white-space: pre-wrap; -} - -.console-message-url { - color: rgb(33%, 33%, 33%); - cursor: pointer; -} - -.console-message-url::after { - content: url(Images/goArrow.png); - margin-left: 3px; - width: 12px; - height: 12px; - vertical-align: middle; - opacity: 0.75; - -webkit-user-select: none; -} - -.console-message-url:hover { - color: rgb(15%, 15%, 15%); -} - -.console-message-url:hover::after { - opacity: 1; -} - -.console-error-level::before { - content: url(Images/errorMediumIcon.png); - position: absolute; - left: 5px; - top: 2px; - -webkit-user-select: none; -} - -.console-warning-level::before { - content: url(Images/warningMediumIcon.png); - position: absolute; - left: 4px; - top: 2px; - -webkit-user-select: none; -} - -.console-command-input, .console-command-output { - font-size: 11px; - white-space: pre-wrap; -} - -.console-command-input::before { - content: ">"; - font-weight: bold; - font-size: 15px; - color: blue; - position: absolute; - left: 8px; - top: 1px; - -webkit-user-select: none; -} - -.view-button-browse img { - content: url(Images/databaseBrowserViewNormal.png); - vertical-align: middle; - margin-top: -1px; - margin-left: 1px; - width: 11px; - height: 11px; -} - -.view-button-browse.selected img { - content: url(Images/databaseBrowserViewNormalSelected.png); -} - -body.attached .view-button-browse img { - content: url(Images/databaseBrowserViewSmall.png); - width: 11px; - height: 8px; - margin-top: 1px; - margin-left: 2px; -} - -body.attached .view-button-browse.selected img { - content: url(Images/databaseBrowserViewSmallSelected.png); -} - -.view-button-query img { - content: url(Images/databaseQueryViewNormal.png); - vertical-align: middle; - margin-top: -1px; - margin-left: -1px; - width: 11px; - height: 11px; -} - -.view-button-query.selected img { - content: url(Images/databaseQueryViewNormalSelected.png); -} - -body.attached .view-button-query img { - content: url(Images/databaseQueryViewSmall.png); - width: 10px; - height: 8px; - margin-top: 1px; -} - -body.attached .view-button-query.selected img { - content: url(Images/databaseQueryViewSmallSelected.png); -} - -.database-table-reload { - padding-left: 0; - padding-right: 0; - width: 28px; - margin-left: 6px; -} - -body.attached .database-table-reload { - width: 20px; -} - -.database-table-reload img { - content: url(Images/reload.png); - vertical-align: middle; - margin-top: -2px; - width: 10px; - height: 13px; -} - -.query.content { - bottom: 21px; -} - -.browse.content { - font-size: 10px; - overflow-y: auto; - overflow-x: hidden; - bottom: 21px; -} - -.browse.content .database-result-table { - border: none; -} - -.browse.content .database-table-empty, .browse.content .database-table-error { - position: absolute; - top: 0; - bottom: 25%; - left: 0; - right: 0; - font-size: 24px; - color: rgb(75%, 75%, 75%); - margin-top: auto; - margin-bottom: auto; - height: 50px; - line-height: 26px; - text-align: center; - font-weight: bold; - padding: 10px; - white-space: pre-wrap; -} - -.browse.content .database-table-error { - color: rgb(66%, 33%, 33%); -} - -.database-browse-table { - height: 100%; -} - -.database-result-table .database-result-filler-row { - height: auto; -} - -.database-result-table .database-result-filler-row.alternate td { - background-position-y: 16px; -} - -.database-result-filler-row td { - background-image: url(Images/alternateTableRows.png); -} - -.database-table-select { - margin-left: 6px; - max-width: 150px; - min-width: 75px; -} - -.database-command-list { - list-style: none; - margin: 0; - padding: 0; - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - overflow-y: auto; - overflow-x: hidden; -} - -.database-prompt { - font-family: monospace; - font-size: 11px; - margin: 0; - padding: 2px 0 0; - position: absolute; - bottom: 0; - left: 0; - right: 0; - height: 18px; - resize: none; - outline: none; - border: none; - border-top: 1px solid rgb(64%, 64%, 64%); -} - -.database-command { - font-size: 10px; - margin: 0; - padding: 5px; - border-bottom: 1px solid rgb(75%, 75%, 75%); - word-break: break-word; - position: relative; -} - -.database-command a:hover { - text-decoration: underline; - cursor: pointer; -} - -.database-command-query { - font-family: monospace; - font-size: 11px; - white-space: pre-wrap; -} - -.database-command-result { - margin-top: 3px; -} - -.database-command-result.error { - color: red; -} - -.database-result-table { - border: 1px solid #aaa; - table-layout: fixed; - border-spacing: 0; - border-collapse: collapse; - width: 100%; - -webkit-box-sizing: border-box; -} - -.database-result-table th { - text-align: left; - background: url(Images/glossyHeader.png) repeat-x; - border-right: 1px solid #aaa; - height: 15px; - -webkit-box-sizing: border-box; - border-bottom: 1px solid #aaa; - font-weight: normal; - vertical-align: middle; - padding: 0 4px; - white-space: nowrap; -} - -.database-result-table tr { - height: 16px; -} - -.database-result-table tr.alternate { - background-color: rgb(236, 243, 254); -} - -.database-result-table td { - vertical-align: top; - padding: 2px 4px; - -webkit-box-sizing: border-box; - white-space: nowrap; - border-right: 1px solid #aaa; -} - -.database-result-table td > div, .database-result-table th > div { - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; -} - -.network-timeline { - position: absolute; - top: 0; - bottom: 99px; - left: 0; - right: 0; - font-family: Lucida Grande, sans-serif; - font-size: 11px; -} - -.network-divider { - width: 1px; - height: 100%; - position: absolute; - background-color: rgba(0, 0, 0, 0.1); -} - -.network-divider.last { - background-color: rgb(66%, 66%, 66%); -} - -.network-divider-label { - position: absolute; - top: 2px; - right: 3px; - font-size: 9px; - color: rgb(50%, 50%, 50%); -} - -.network-dividers { - position: absolute; - left: 153px; - right: 20px; - bottom: 0; - top: 0; - z-index: -100; - border-left: 1px solid rgb(66%, 66%, 66%); - -webkit-box-sizing: border-box; -} - -.network-resources { - position: absolute; - width: 100%; - overflow-y: overlay; - overflow-x: hidden; - border-top: 1px solid rgb(66%, 66%, 66%); - top: 15px; - bottom: 0; -} - -.network-title { - position: relative; - height: 18px; -} - -.network-title:hover { - background-color: rgba(0, 0, 200, 0.1); -} - -.network-info { - background-color: rgb(225, 225, 235); - background-image: url(Images/attachedShadow.png), url(Images/bottomShadow.png); - background-repeat: repeat-x; - background-position: top, bottom; - overflow: hidden; - -webkit-user-select: text; - cursor: auto; -} - -.network-info table { - font-size: 11px; - margin: 5px 15px 5px 5px; -} - -.network-info th { - width: 145px; -} - -.network-info thead th { - text-align: right; -} - -.network-info tbody th { - white-space: nowrap; - text-align: right; - font-weight: bold; - color: rgba(0, 0, 0, 0.5); - vertical-align: top; -} - -.network-info td { - word-break: break-word; - white-space: normal; -} - -.network-file { - position: absolute; - left: 5px; - height: 100%; - width: 145px; - overflow: hidden; - white-space: nowrap; - text-overflow: ellipsis; - line-height: 18px; - -webkit-user-select: text; -} - -.network-file a { - color: inherit; - text-decoration: none; -} - -.network-file a:hover { - text-decoration: underline; -} - -.network-area { - position: absolute; - left: 162px; - right: 28px; - height: 100%; -} - -.network-bar { - position: absolute; - top: 0; - bottom: 0; - margin: auto -7px; - border-width: 6px 7px 6px 7px; - height: 13px; - min-width: 14px; - -webkit-box-sizing: border-box; - opacity: 0.8; - -webkit-border-image: url(Images/timelinePillGray.png) 6 7 6 7; -} - -.network-bar.network-category-documents { - -webkit-border-image: url(Images/timelinePillBlue.png) 6 7 6 7; -} - -.network-bar.network-category-stylesheets { - -webkit-border-image: url(Images/timelinePillGreen.png) 6 7 6 7; -} - -.network-bar.network-category-images { - -webkit-border-image: url(Images/timelinePillPurple.png) 6 7 6 7; -} - -.network-bar.network-category-fonts { - -webkit-border-image: url(Images/timelinePillYellow.png) 6 7 6 7; -} - -.network-bar.network-category-scripts { - -webkit-border-image: url(Images/timelinePillOrange.png) 6 7 6 7; -} - -.network-summary { - position: absolute; - bottom: 0; - left: 0; - right: 0; - height: 99px; - background-color: rgb(101, 111, 130); - background-image: url(Images/darkShadow.png), url(Images/gradientHighlightBottom.png); - background-repeat: repeat-x; - background-position: top, bottom; -} - -.network-graph-area { - padding-top: 20px; - position: absolute; - margin: auto; - top: 0; - bottom: 0; - right: 0; - left: 0; - width: 575px; - white-space: nowrap; - color: white; - text-shadow: black 0px 1px 1px; -} - -.network-graph-label { - height: 38px; - display: inline-block; - vertical-align: top; - margin-right: 5px; - margin-top: -2px; - text-align: right; -} - -.network-graph-side { - position: relative; - display: inline-block; - vertical-align: top; -} - -.network-graph-legend-total { - margin-top: 12px; - padding-right: 5px; -} - -.network-graph-legend-total .network-graph-legend-label { - text-align: right; -} - -.network-graph-mode { - -webkit-appearance: none; - background-color: transparent; - border: none; - font-weight: bold; - font-size: 12px; - height: 18px; - line-height: 11px; - text-align: right; - vertical-align: middle; - padding: 2px 16px 2px 8px; - margin: 0; - background-image: url(Images/popupArrows.png); - background-position: right center; - background-repeat: no-repeat; - color: inherit; - border: 1px solid transparent; - text-shadow: black 0px 2px 2px; -} - -.network-graph-mode:focus { - outline: none; -} - -.network-graph-mode:hover { - -webkit-border-radius: 9px; - background-color: rgba(0, 0, 0, 0.2); - border: 1px solid white; - -webkit-box-shadow: black 0px 1px 1px; -} - -.network-graph-legend { - margin-top: -8px; - text-align: center; -} - -.network-graph-legend-item { - display: inline-block; - font-weight: bold; - margin-right: 15px; - vertical-align: top; -} - -.network-graph-legend-label { - display: inline-block; - text-align: left; -} - -.network-graph-legend-header { - font-size: 12px; - text-transform: capitalize; -} - -.network-graph-legend-value { - font-size: 10px; -} - -.network-graph-legend-swatch { - vertical-align: top; - margin-top: 1px; - margin-right: 3px; -} - -.network-summary-graph { - vertical-align: middle; -} - -.tip-button { - background-image: url(Images/tipIcon.png); - border: none; - width: 16px; - height: 16px; - float: right; - background-color: transparent; - margin-top: 1px; -} - -.tip-button:active { - background-image: url(Images/tipIconPressed.png); -} - -.tip-balloon { - position: absolute; - left: 145px; - top: -5px; - z-index: 1000; - border-width: 51px 15px 18px 37px; - -webkit-border-image: url(Images/tipBalloon.png) 51 15 18 37; - width: 265px; -} - -.tip-balloon.bottom { - position: absolute; - left: 145px; - top: auto; - bottom: -7px; - z-index: 1000; - border-width: 18px 15px 51px 37px; - -webkit-border-image: url(Images/tipBalloonBottom.png) 18 15 51 37; -} - -.tip-balloon-content { - margin-top: -40px; - margin-bottom: -2px; - margin-left: 2px; -} - -.tip-balloon.bottom .tip-balloon-content { - margin-top: -10px; - margin-bottom: -35px; -} - -.sidebar-resizer-vertical { - position: absolute; - top: 0; - bottom: 0; - width: 5px; - z-index: 100; - cursor: col-resize; -} - -.sidebar-resizer-vertical-left { - left: 197px; -} - -.sidebar-resizer-vertical-right { - right: 222px; -} - -#searchResultsResizer { - position: absolute; - height: 5px; - left: 0; - right: 0; - cursor: row-resize; -} diff --git a/WebCore/page/inspector/inspector.html b/WebCore/page/inspector/inspector.html deleted file mode 100644 index 3ba0300..0000000 --- a/WebCore/page/inspector/inspector.html +++ /dev/null @@ -1,75 +0,0 @@ -<!-- -Copyright (C) 2006, 2007 Apple Inc. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. -3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - its contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ---> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> - <meta http-equiv="content-type" content="text/html; charset=utf-8" /> - <link rel="stylesheet" type="text/css" href="inspector.css" /> - <script type="text/javascript" src="utilities.js"></script> - <script type="text/javascript" src="treeoutline.js"></script> - <script type="text/javascript" src="inspector.js"></script> - <script type="text/javascript" src="Resource.js"></script> - <script type="text/javascript" src="ResourceCategory.js"></script> - <script type="text/javascript" src="Database.js"></script> - <script type="text/javascript" src="SidebarPane.js"></script> - <script type="text/javascript" src="PropertiesSection.js"></script> - <script type="text/javascript" src="MetricsSidebarPane.js"></script> - <script type="text/javascript" src="PropertiesSidebarPane.js"></script> - <script type="text/javascript" src="StylesSidebarPane.js"></script> - <script type="text/javascript" src="Panel.js"></script> - <script type="text/javascript" src="ResourcePanel.js"></script> - <script type="text/javascript" src="SourcePanel.js"></script> - <script type="text/javascript" src="ConsolePanel.js"></script> - <script type="text/javascript" src="DatabasePanel.js"></script> - <script type="text/javascript" src="DocumentPanel.js"></script> - <script type="text/javascript" src="FontPanel.js"></script> - <script type="text/javascript" src="ImagePanel.js"></script> - <script type="text/javascript" src="NetworkPanel.js"></script> -</head> -<body class="detached"> - <div id="toolbar"> - <button id="back" class="split-button first"><img></button><img class="split-button-divider"><button id="forward" class="split-button last"><img></button> - <span id="toolbarButtons"></span> - <input id="search" type="search" autosave="inspectorSearch" results="20" incremental="incremental" onsearch="WebInspector.performSearch(this.value)"> - </div> - <div id="sidebar" class="focusable focused"> - <ol id="list"></ol> - <ol id="status"></ol> - <div id="statusbar"> - <button id="attachToggle"></button> - <span id="sidebarResizeWidget"></span> - </div> - <div id="sidebarResizer" class="sidebar-resizer-vertical sidebar-resizer-vertical-left"></div> - </div> - <div id="main" class="focusable blurred"> - <div id="searchResults" class="focusable hidden"></div> - <div id="searchResultsResizer" class="hidden"></div> - <div id="panels"></div> - </div> -</body> -</html> diff --git a/WebCore/page/inspector/inspector.js b/WebCore/page/inspector/inspector.js deleted file mode 100644 index 04e78e6..0000000 --- a/WebCore/page/inspector/inspector.js +++ /dev/null @@ -1,1186 +0,0 @@ -/* - * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. - * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -var Preferences = { - ignoreWhitespace: true, - showUserAgentStyles: true, - maxInlineTextChildLength: 80, - maxTextSearchResultLength: 80, - showInheritedComputedStyleProperties: false, - showMissingLocalizedStrings: false -} - -var WebInspector = { - resources: [], - resourceURLMap: {}, - backForwardList: [], - searchResultsHeight: 100, - localizedStrings: {}, - missingLocalizedStrings: {}, - - get consolePanel() - { - if (!this._consolePanel) - this._consolePanel = new WebInspector.ConsolePanel(); - - return this._consolePanel; - }, - - get networkPanel() - { - if (!this._networkPanel) - this._networkPanel = new WebInspector.NetworkPanel(); - - return this._networkPanel; - }, - - get currentBackForwardIndex() - { - if (this._currentBackForwardIndex === undefined) - this._currentBackForwardIndex = -1; - - return this._currentBackForwardIndex; - }, - - set currentBackForwardIndex(x) - { - if (this._currentBackForwardIndex === x) - return; - - this._currentBackForwardIndex = x; - this.updateBackForwardButtons(); - }, - - get currentFocusElement() - { - return this._currentFocusElement; - }, - - set currentFocusElement(x) - { - if (!x || this._currentFocusElement === x) - return; - - if (this._currentFocusElement) { - this._currentFocusElement.removeStyleClass("focused"); - this._currentFocusElement.addStyleClass("blurred"); - if (this._currentFocusElement.blurred) - this._currentFocusElement.blurred(); - } - - this._currentFocusElement = x; - - if (x) { - x.addStyleClass("focused"); - x.removeStyleClass("blurred"); - if (this._currentFocusElement.focused) - this._currentFocusElement.focused(); - } - }, - - get currentPanel() - { - return this._currentPanel; - }, - - set currentPanel(x) - { - if (this._currentPanel === x) - return; - - if (this._currentPanel) - this._currentPanel.hide(); - - this._currentPanel = x; - - if (x) - x.show(); - }, - - get attached() - { - return this._attached; - }, - - set attached(x) - { - if (this._attached === x) - return; - - this._attached = x; - - var body = document.body; - if (x) { - InspectorController.attach(); - body.removeStyleClass("detached"); - body.addStyleClass("attached"); - } else { - InspectorController.detach(); - body.removeStyleClass("attached"); - body.addStyleClass("detached"); - } - }, - - get showingSearchResults() - { - return this._showingSearchResults; - }, - - set showingSearchResults(x) - { - if (this._showingSearchResults === x) - return; - - this._showingSearchResults = x; - - var resultsContainer = document.getElementById("searchResults"); - var searchResultsResizer = document.getElementById("searchResultsResizer"); - - if (x) { - resultsContainer.removeStyleClass("hidden"); - searchResultsResizer.removeStyleClass("hidden"); - - var animations = [ - {element: resultsContainer, end: {top: 0}}, - {element: searchResultsResizer, end: {top: WebInspector.searchResultsHeight - 3}}, - {element: document.getElementById("panels"), end: {top: WebInspector.searchResultsHeight}} - ]; - - WebInspector.animateStyle(animations, 250); - } else { - searchResultsResizer.addStyleClass("hidden"); - - var animations = [ - {element: resultsContainer, end: {top: -WebInspector.searchResultsHeight}}, - {element: searchResultsResizer, end: {top: 0}}, - {element: document.getElementById("panels"), end: {top: 0}} - ]; - - var animationFinished = function() - { - resultsContainer.addStyleClass("hidden"); - resultsContainer.removeChildren(); - delete this.searchResultsTree; - }; - - WebInspector.animateStyle(animations, 250, animationFinished); - } - } -} - -WebInspector.loaded = function() -{ - var platform = InspectorController.platform(); - document.body.addStyleClass("platform-" + platform); - - this.fileOutline = new TreeOutline(document.getElementById("list")); - this.fileOutline.expandTreeElementsWhenArrowing = true; - - this.statusOutline = new TreeOutline(document.getElementById("status")); - this.statusOutline.expandTreeElementsWhenArrowing = true; - - 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"), - fonts: new WebInspector.ResourceCategory(WebInspector.UIString("fonts"), "fonts"), - databases: new WebInspector.ResourceCategory(WebInspector.UIString("databases"), "databases"), - 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.")} - }; - - this.Warnings = { - IncorrectMIMEType: {id: 0, message: WebInspector.UIString("Resource interpreted as %s but transferred with MIME type %s.")} - }; - - this.consoleListItem = new WebInspector.ConsoleStatusTreeElement(WebInspector.consolePanel); - this.statusOutline.appendChild(this.consoleListItem); - - this.networkListItem = new WebInspector.StatusTreeElement(WebInspector.UIString("Network"), "network", WebInspector.networkPanel); - this.statusOutline.appendChild(this.networkListItem); - - this.resourceCategories.documents.listItem.expand(); - - this.currentFocusElement = document.getElementById("sidebar"); - - this.addMainEventListeners(document); - - window.addEventListener("unload", this.windowUnload.bind(this), true); - window.addEventListener("resize", this.windowResize.bind(this), true); - - document.addEventListener("mousedown", this.changeFocus.bind(this), true); - document.addEventListener("focus", this.changeFocus.bind(this), true); - document.addEventListener("keydown", this.documentKeyDown.bind(this), true); - document.addEventListener("beforecopy", this.documentCanCopy.bind(this), true); - document.addEventListener("copy", this.documentCopy.bind(this), true); - - document.getElementById("back").title = WebInspector.UIString("Show previous panel."); - document.getElementById("forward").title = WebInspector.UIString("Show next panel."); - - document.getElementById("search").setAttribute("placeholder", WebInspector.UIString("Search")); - - document.getElementById("back").addEventListener("click", this.back.bind(this), true); - document.getElementById("forward").addEventListener("click", this.forward.bind(this), true); - this.updateBackForwardButtons(); - - document.getElementById("attachToggle").addEventListener("click", this.toggleAttach.bind(this), true); - - document.getElementById("sidebarResizeWidget").addEventListener("mousedown", this.sidebarResizerDragStart, true); - document.getElementById("sidebarResizer").addEventListener("mousedown", this.sidebarResizerDragStart, true); - document.getElementById("searchResultsResizer").addEventListener("mousedown", this.searchResultsResizerDragStart, true); - - if (platform === "mac-leopard") - document.getElementById("toolbar").addEventListener("mousedown", this.toolbarDragStart, true); - - document.body.addStyleClass("detached"); - - InspectorController.loaded(); -} - -var windowLoaded = function() -{ - var localizedStringsURL = InspectorController.localizedStringsURL(); - if (localizedStringsURL) { - var localizedStringsScriptElement = document.createElement("script"); - localizedStringsScriptElement.addEventListener("load", WebInspector.loaded.bind(WebInspector), false); - localizedStringsScriptElement.type = "text/javascript"; - localizedStringsScriptElement.src = localizedStringsURL; - document.getElementsByTagName("head").item(0).appendChild(localizedStringsScriptElement); - } else - WebInspector.loaded(); - - window.removeEventListener("load", windowLoaded, false); - delete windowLoaded; -}; - -window.addEventListener("load", windowLoaded, false); - -WebInspector.windowUnload = function(event) -{ - InspectorController.windowUnloading(); -} - -WebInspector.windowResize = function(event) -{ - if (this.currentPanel && this.currentPanel.resize) - this.currentPanel.resize(); -} - -WebInspector.windowFocused = function(event) -{ - if (event.target.nodeType === Node.DOCUMENT_NODE) - document.body.removeStyleClass("inactive"); -} - -WebInspector.windowBlured = function(event) -{ - if (event.target.nodeType === Node.DOCUMENT_NODE) - document.body.addStyleClass("inactive"); -} - -WebInspector.changeFocus = function(event) -{ - var nextFocusElement; - - var current = event.target; - while (current) { - if (current.nodeName.toLowerCase() === "input") - nextFocusElement = current; - current = current.parentNode; - } - - if (!nextFocusElement) - nextFocusElement = event.target.firstParentWithClass("focusable"); - - this.currentFocusElement = nextFocusElement; -} - -WebInspector.documentClick = function(event) -{ - var anchor = event.target.firstParentOrSelfWithNodeName("a"); - if (!anchor || !anchor.hasStyleClass("webkit-html-resource-link")) - return; - - if (WebInspector.showResourceForURL(anchor.getAttribute("href"))) { - event.preventDefault(); - event.stopPropagation(); - } -} - -WebInspector.documentKeyDown = function(event) -{ - if (!this.currentFocusElement) - return; - if (this.currentFocusElement.handleKeyEvent) - this.currentFocusElement.handleKeyEvent(event); - else if (this.currentFocusElement.id && this.currentFocusElement.id.length && WebInspector[this.currentFocusElement.id + "KeyDown"]) - WebInspector[this.currentFocusElement.id + "KeyDown"](event); -} - -WebInspector.documentCanCopy = function(event) -{ - if (!this.currentFocusElement) - return; - // Calling preventDefault() will say "we support copying, so enable the Copy menu". - if (this.currentFocusElement.handleCopyEvent) - event.preventDefault(); - else if (this.currentFocusElement.id && this.currentFocusElement.id.length && WebInspector[this.currentFocusElement.id + "Copy"]) - event.preventDefault(); -} - -WebInspector.documentCopy = function(event) -{ - if (!this.currentFocusElement) - return; - if (this.currentFocusElement.handleCopyEvent) - this.currentFocusElement.handleCopyEvent(event); - else if (this.currentFocusElement.id && this.currentFocusElement.id.length && WebInspector[this.currentFocusElement.id + "Copy"]) - WebInspector[this.currentFocusElement.id + "Copy"](event); -} - -WebInspector.sidebarKeyDown = function(event) -{ - var nextSelectedElement; - - if (this.fileOutline.selectedTreeElement) { - if (!this.fileOutline.handleKeyEvent(event) && event.keyIdentifier === "Down" && !event.altKey) { - var nextSelectedElement = this.statusOutline.children[0]; - while (nextSelectedElement && !nextSelectedElement.selectable) - nextSelectedElement = nextSelectedElement.traverseNextTreeElement(false); - } - } else if (this.statusOutline.selectedTreeElement) { - if (!this.statusOutline.handleKeyEvent(event) && event.keyIdentifier === "Up" && !event.altKey) { - var nextSelectedElement = this.fileOutline.children[0]; - var lastSelectable = null; - - while (nextSelectedElement) { - if (nextSelectedElement.selectable) - lastSelectable = nextSelectedElement; - nextSelectedElement = nextSelectedElement.traverseNextTreeElement(false); - } - - nextSelectedElement = lastSelectable; - } - } - - if (nextSelectedElement) { - nextSelectedElement.reveal(); - nextSelectedElement.select(); - - event.preventDefault(); - event.stopPropagation(); - } -} - -WebInspector.sidebarCopy = function(event) -{ - event.clipboardData.clearData(); - event.preventDefault(); - - var selectedElement = this.fileOutline.selectedTreeElement; - if (!selectedElement || !selectedElement.representedObject || !selectedElement.representedObject.url) - return; - - event.clipboardData.setData("URL", this.fileOutline.selectedTreeElement.representedObject.url); -} - -WebInspector.mainKeyDown = function(event) -{ - if (this.currentPanel && this.currentPanel.handleKeyEvent) - this.currentPanel.handleKeyEvent(event); -} - -WebInspector.mainCopy = function(event) -{ - if (this.currentPanel && this.currentPanel.handleCopyEvent) - this.currentPanel.handleCopyEvent(event); -} - -WebInspector.searchResultsKeyDown = function(event) -{ - if (this.searchResultsTree) - this.searchResultsTree.handleKeyEvent(event); -} - -WebInspector.animateStyle = function(animations, duration, callback, complete) -{ - if (complete === undefined) - complete = 0; - var slice = (1000 / 30); // 30 frames per second - - var defaultUnit = "px"; - var propertyUnit = {opacity: ""}; - - for (var i = 0; i < animations.length; ++i) { - var animation = animations[i]; - var element = null; - var start = null; - var current = null; - var end = null; - for (key in animation) { - if (key === "element") - element = animation[key]; - else if (key === "start") - start = animation[key]; - else if (key === "current") - current = animation[key]; - else if (key === "end") - end = animation[key]; - } - - if (!element || !end) - continue; - - var computedStyle = element.ownerDocument.defaultView.getComputedStyle(element); - if (!start) { - start = {}; - for (key in end) - start[key] = parseInt(computedStyle.getPropertyValue(key)); - animation.start = start; - } else if (complete == 0) - for (key in start) - element.style.setProperty(key, start[key] + (key in propertyUnit ? propertyUnit[key] : defaultUnit)); - - if (!current) { - current = {}; - for (key in start) - current[key] = start[key]; - animation.current = current; - } - - function cubicInOut(t, b, c, d) - { - if ((t/=d/2) < 1) return c/2*t*t*t + b; - return c/2*((t-=2)*t*t + 2) + b; - } - - var style = element.style; - for (key in end) { - var startValue = start[key]; - var currentValue = current[key]; - var endValue = end[key]; - if ((complete + slice) < duration) { - var delta = (endValue - startValue) / (duration / slice); - var newValue = cubicInOut(complete, startValue, endValue - startValue, duration); - style.setProperty(key, newValue + (key in propertyUnit ? propertyUnit[key] : defaultUnit)); - current[key] = newValue; - } else { - style.setProperty(key, endValue + (key in propertyUnit ? propertyUnit[key] : defaultUnit)); - } - } - } - - if (complete < duration) - setTimeout(WebInspector.animateStyle, slice, animations, duration, callback, complete + slice); - else if (callback) - callback(); -} - -WebInspector.toggleAttach = function() -{ - this.attached = !this.attached; -} - -WebInspector.toolbarDragStart = function(event) -{ - var toolbar = document.getElementById("toolbar"); - if (event.target !== toolbar || WebInspector.attached) - return; - - toolbar.lastScreenX = event.screenX; - toolbar.lastScreenY = event.screenY; - - document.addEventListener("mousemove", WebInspector.toolbarDrag, true); - document.addEventListener("mouseup", WebInspector.toolbarDragEnd, true); - document.body.style.cursor = "default"; - - event.preventDefault(); -} - -WebInspector.toolbarDragEnd = function(event) -{ - var toolbar = document.getElementById("toolbar"); - delete toolbar.lastScreenX; - delete toolbar.lastScreenY; - - document.removeEventListener("mousemove", WebInspector.toolbarDrag, true); - document.removeEventListener("mouseup", WebInspector.toolbarDragEnd, true); - document.body.style.removeProperty("cursor"); - - event.preventDefault(); -} - -WebInspector.toolbarDrag = function(event) -{ - var toolbar = document.getElementById("toolbar"); - - var x = event.screenX - toolbar.lastScreenX; - var y = event.screenY - toolbar.lastScreenY; - - toolbar.lastScreenX = event.screenX; - toolbar.lastScreenY = event.screenY; - - // We cannot call window.moveBy here because it restricts the movement of the window - // at the edges. - InspectorController.moveByUnrestricted(x, y); - - event.preventDefault(); -} - -WebInspector.sidebarResizerDragStart = function(event) -{ - WebInspector.elementDragStart(document.getElementById("sidebar"), WebInspector.sidebarResizerDrag, WebInspector.sidebarResizerDragEnd, event, "col-resize"); -} - -WebInspector.sidebarResizerDragEnd = function(event) -{ - WebInspector.elementDragEnd(document.getElementById("sidebar"), WebInspector.sidebarResizerDrag, WebInspector.sidebarResizerDragEnd, event); -} - -WebInspector.sidebarResizerDrag = function(event) -{ - var x = event.pageX; - - // FIXME: We can should come up with a better hueristic for constraining the size of the sidebar. - var newWidth = Number.constrain(x, 100, window.innerWidth - 100); - - document.getElementById("sidebar").style.width = newWidth + "px"; - document.getElementById("sidebarResizer").style.left = (newWidth - 3) + "px"; - document.getElementById("main").style.left = newWidth + "px"; - document.getElementById("toolbarButtons").style.left = newWidth + "px"; - - if (WebInspector.currentPanel && WebInspector.currentPanel.resize) - WebInspector.currentPanel.resize(); - - event.preventDefault(); -} - -WebInspector.searchResultsResizerDragStart = function(event) -{ - WebInspector.elementDragStart(document.getElementById("searchResults"), WebInspector.searchResultsResizerDrag, WebInspector.searchResultsResizerDragEnd, event, "row-resize"); -} - -WebInspector.searchResultsResizerDragEnd = function(event) -{ - WebInspector.elementDragEnd(document.getElementById("searchResults"), WebInspector.searchResultsResizerDrag, WebInspector.searchResultsResizerDragEnd, event); -} - -WebInspector.searchResultsResizerDrag = function(event) -{ - var y = event.pageY - document.getElementById("main").offsetTop; - var newHeight = Number.constrain(y, 100, window.innerHeight - 100); - - WebInspector.searchResultsHeight = newHeight; - - document.getElementById("searchResults").style.height = WebInspector.searchResultsHeight + "px"; - document.getElementById("panels").style.top = newHeight + "px"; - document.getElementById("searchResultsResizer").style.top = (newHeight - 3) + "px"; - - event.preventDefault(); -} - -WebInspector.elementDragStart = function(element, dividerDrag, elementDragEnd, event, cursor) -{ - if (WebInspector.draggingElement) - return elementDragEnd(event); - - WebInspector.draggingElement = true; - - document.addEventListener("mousemove", dividerDrag, true); - document.addEventListener("mouseup", elementDragEnd, true); - document.body.style.cursor = cursor; - - event.preventDefault(); -} - -WebInspector.elementDragEnd = function(element, dividerDrag, elementDragEnd, event) -{ - document.removeEventListener("mousemove", dividerDrag, true); - document.removeEventListener("mouseup", elementDragEnd, true); - document.body.style.removeProperty("cursor"); - - delete WebInspector.draggingElement; - - event.preventDefault(); -} - -WebInspector.back = function() -{ - if (this.currentBackForwardIndex <= 0) { - console.error("Can't go back from index " + this.currentBackForwardIndex); - return; - } - - this.navigateToPanel(this.backForwardList[--this.currentBackForwardIndex], null, true); -} - -WebInspector.forward = function() -{ - if (this.currentBackForwardIndex >= this.backForwardList.length - 1) { - console.error("Can't go forward from index " + this.currentBackForwardIndex); - return; - } - - this.navigateToPanel(this.backForwardList[++this.currentBackForwardIndex], null, true); -} - -WebInspector.updateBackForwardButtons = function() -{ - var index = this.currentBackForwardIndex; - - document.getElementById("back").disabled = index <= 0; - document.getElementById("forward").disabled = index >= this.backForwardList.length - 1; -} - -WebInspector.showConsole = function() -{ - this.navigateToPanel(WebInspector.consolePanel); -} - -WebInspector.showTimeline = function() -{ - this.navigateToPanel(WebInspector.networkPanel); -} - -WebInspector.addResource = function(resource) -{ - this.resources.push(resource); - - if (resource.mainResource) - this.mainResource = resource; - - if (resource.url) { - this.resourceURLMap[resource.url] = resource; - this.networkPanel.addResourceToTimeline(resource); - } -} - -WebInspector.removeResource = function(resource) -{ - resource.detach(); - - resource.category.removeResource(resource); - - if (resource.url) - delete this.resourceURLMap[resource.url]; - - var resourcesLength = this.resources.length; - for (var i = 0; i < resourcesLength; ++i) { - if (this.resources[i] === resource) { - this.resources.splice(i, 1); - break; - } - } -} - -WebInspector.clearResources = function() -{ - for (var category in this.resourceCategories) - this.resourceCategories[category].removeAllResources(); - this.resources = []; - this.backForwardList = []; - this.currentBackForwardIndex = -1; - delete this.mainResource; -} - -WebInspector.clearDatabaseResources = function() -{ - this.resourceCategories.databases.removeAllResources(); -} - -WebInspector.resourceURLChanged = function(resource, oldURL) -{ - delete this.resourceURLMap[oldURL]; - this.resourceURLMap[resource.url] = resource; -} - -WebInspector.addMessageToConsole = function(msg) -{ - this.consolePanel.addMessage(msg); - switch (msg.level) { - case WebInspector.ConsoleMessage.MessageLevel.Warning: - ++this.consoleListItem.warnings; - break; - case WebInspector.ConsoleMessage.MessageLevel.Error: - ++this.consoleListItem.errors; - break; - } -} - -WebInspector.clearConsoleMessages = function() -{ - this.consolePanel.clearMessages(); - this.consoleListItem.warnings = this.consoleListItem.errors = 0; -} - -WebInspector.clearNetworkTimeline = function() -{ - if (this._networkPanel) - this._networkPanel.clearTimeline(); -} - -WebInspector.drawLoadingPieChart = function(canvas, percent) { - var g = canvas.getContext("2d"); - var darkColor = "rgb(122, 168, 218)"; - var lightColor = "rgb(228, 241, 251)"; - var cx = 8; - var cy = 8; - var r = 7; - - g.beginPath(); - g.arc(cx, cy, r, 0, Math.PI * 2, false); - g.closePath(); - - g.lineWidth = 1; - g.strokeStyle = darkColor; - g.fillStyle = lightColor; - g.fill(); - g.stroke(); - - var startangle = -Math.PI / 2; - var endangle = startangle + (percent * Math.PI * 2); - - g.beginPath(); - g.moveTo(cx, cy); - g.arc(cx, cy, r, startangle, endangle, false); - g.closePath(); - - g.fillStyle = darkColor; - g.fill(); -} - -WebInspector.updateFocusedNode = function(node) -{ - if (!node) - // FIXME: Should we deselect if null is passed in? - return; - - for (var i = 0; i < this.resourceCategories.documents.resources.length; ++i) { - var resource = this.resourceCategories.documents.resources[i]; - if (resource.documentNode !== node.ownerDocument) - continue; - - this.navigateToPanel(resource.panel, "dom"); - resource.panel.focusedDOMNode = node; - - this.currentFocusElement = document.getElementById("main"); - - break; - } -} - -WebInspector.resourceForURL = function(url) -{ - for (var resourceURL in this.resourceURLMap) { - if (resourceURL.hasSubstring(url)) - return this.resourceURLMap[resourceURL]; - } - - return null; -} - -WebInspector.showResourceForURL = function(url) -{ - var resource = this.resourceForURL(url); - if (!resource) - return false; - - this.navigateToResource(resource); - return true; -} - -WebInspector.linkifyURL = function(url, linkText, classes, isExternal) -{ - if (linkText === undefined) - linkText = url.escapeHTML(); - classes = (classes === undefined) ? "" : classes + " "; - classes += isExternal ? "webkit-html-external-link" : "webkit-html-resource-link"; - var link = "<a href=\"" + url + "\" class=\"" + classes + "\" title=\"" + url + "\" target=\"_blank\">" + linkText + "</a>"; - return link; -} - -WebInspector.addMainEventListeners = function(doc) -{ - doc.defaultView.addEventListener("focus", function(event) { WebInspector.windowFocused(event) }, true); - doc.defaultView.addEventListener("blur", function(event) { WebInspector.windowBlured(event) }, true); - doc.addEventListener("click", function(event) { WebInspector.documentClick(event) }, true); -} - -WebInspector.performSearch = function(query) -{ - if (!query || !query.length) { - this.showingSearchResults = false; - return; - } - - var resultsContainer = document.getElementById("searchResults"); - resultsContainer.removeChildren(); - - var isXPath = query.indexOf("/") !== -1; - - var xpathQuery; - if (isXPath) - xpathQuery = query; - else { - var escapedQuery = query.escapeCharacters("'"); - xpathQuery = "//*[contains(name(),'" + escapedQuery + "') or contains(@*,'" + escapedQuery + "')] | //text()[contains(.,'" + escapedQuery + "')] | //comment()[contains(.,'" + escapedQuery + "')]"; - } - - var resourcesToSearch = [].concat(this.resourceCategories.documents.resources, this.resourceCategories.stylesheets.resources, this.resourceCategories.scripts.resources, this.resourceCategories.other.resources); - - var files = []; - for (var i = 0; i < resourcesToSearch.length; ++i) { - var resource = resourcesToSearch[i]; - - var sourceResults = []; - if (!isXPath && "source" in resource.panel.views) { - resource.panel.setupSourceFrameIfNeeded(); - sourceResults = InspectorController.search(resource.panel.views.source.frameElement.contentDocument, query); - } - - var domResults = []; - const searchResultsProperty = "__includedInInspectorSearchResults"; - function addNodesToDOMResults(nodes, length, getItem) - { - for (var i = 0; i < length; ++i) { - var node = getItem(nodes, i); - if (searchResultsProperty in node) - continue; - node[searchResultsProperty] = true; - domResults.push(node); - } - } - - function cleanUpDOMResultsNodes() - { - for (var i = 0; i < domResults.length; ++i) - delete domResults[i][searchResultsProperty]; - } - - if (resource.category === this.resourceCategories.documents) { - var doc = resource.documentNode; - try { - var result = Document.prototype.evaluate.call(doc, xpathQuery, doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); - addNodesToDOMResults(result, result.snapshotLength, function(l, i) { return l.snapshotItem(i); }); - } catch(err) { - // ignore any exceptions. the query might be malformed, but we allow that. - } - - var result = Document.prototype.querySelectorAll.call(doc, query); - addNodesToDOMResults(result, result.length, function(l, i) { return l.item(i); }); - - cleanUpDOMResultsNodes(); - } - - if ((!sourceResults || !sourceResults.length) && !domResults.length) - continue; - - files.push({resource: resource, sourceResults: sourceResults, domResults: domResults}); - } - - if (!files.length) - return; - - this.showingSearchResults = true; - - var fileList = document.createElement("ol"); - fileList.className = "outline-disclosure"; - resultsContainer.appendChild(fileList); - - this.searchResultsTree = new TreeOutline(fileList); - this.searchResultsTree.expandTreeElementsWhenArrowing = true; - - var sourceResultSelected = function(element) - { - var selection = window.getSelection(); - selection.removeAllRanges(); - selection.addRange(element.representedObject.range); - - WebInspector.navigateToPanel(element.representedObject.panel, "source"); - element.representedObject.line.scrollIntoView(true); - resultsContainer.scrollToElement(element.listItemElement); - } - - var domResultSelected = function(element) - { - WebInspector.navigateToPanel(element.representedObject.panel, "dom"); - element.representedObject.panel.focusedDOMNode = element.representedObject.node; - resultsContainer.scrollToElement(element.listItemElement); - } - - for (var i = 0; i < files.length; ++i) { - var file = files[i]; - - var fileItem = new TreeElement(file.resource.displayName, {}, true); - fileItem.expanded = true; - fileItem.selectable = false; - this.searchResultsTree.appendChild(fileItem); - - if (file.sourceResults && file.sourceResults.length) { - for (var j = 0; j < file.sourceResults.length; ++j) { - var range = file.sourceResults[j]; - - var line = range.startContainer; - while (line.parentNode && line.nodeName.toLowerCase() != "tr") - line = line.parentNode; - var lineRange = file.resource.panel.views.source.frameElement.contentDocument.createRange(); - lineRange.selectNodeContents(line); - - // Don't include any error bubbles in the search result - var end = line.lastChild.lastChild; - if (end.nodeName.toLowerCase() == "div" && end.hasStyleClass("webkit-html-message-bubble")) { - while (end && end.nodeName.toLowerCase() == "div" && end.hasStyleClass("webkit-html-message-bubble")) - end = end.previousSibling; - lineRange.setEndAfter(end); - } - - var beforeRange = file.resource.panel.views.source.frameElement.contentDocument.createRange(); - beforeRange.setStart(lineRange.startContainer, lineRange.startOffset); - beforeRange.setEnd(range.startContainer, range.startOffset); - - var afterRange = file.resource.panel.views.source.frameElement.contentDocument.createRange(); - afterRange.setStart(range.endContainer, range.endOffset); - afterRange.setEnd(lineRange.endContainer, lineRange.endOffset); - - var beforeText = beforeRange.toString().trimLeadingWhitespace(); - var text = range.toString(); - var afterText = afterRange.toString().trimTrailingWhitespace(); - - var length = beforeText.length + text.length + afterText.length; - if (length > Preferences.maxTextSearchResultLength) { - var beforeAfterLength = (Preferences.maxTextSearchResultLength - text.length) / 2; - if (beforeText.length > beforeAfterLength) - beforeText = "\u2026" + beforeText.substr(-beforeAfterLength); - if (afterText.length > beforeAfterLength) - afterText = afterText.substr(0, beforeAfterLength) + "\u2026"; - } - - var title = "<div class=\"selection selected\"></div>"; - if (j == 0) - title += "<div class=\"search-results-section\">" + WebInspector.UIString("Source") + "</div>"; - title += beforeText.escapeHTML() + "<span class=\"search-matched-string\">" + text.escapeHTML() + "</span>" + afterText.escapeHTML(); - var item = new TreeElement(title, {panel: file.resource.panel, line: line, range: range}, false); - item.onselect = sourceResultSelected; - fileItem.appendChild(item); - } - } - - if (file.domResults.length) { - for (var j = 0; j < file.domResults.length; ++j) { - var node = file.domResults[j]; - var title = "<div class=\"selection selected\"></div>"; - if (j == 0) - title += "<div class=\"search-results-section\">" + WebInspector.UIString("DOM") + "</div>"; - title += nodeTitleInfo.call(node).title; - var item = new TreeElement(title, {panel: file.resource.panel, node: node}, false); - item.onselect = domResultSelected; - fileItem.appendChild(item); - } - } - } -} - -WebInspector.navigateToResource = function(resource) -{ - this.navigateToPanel(resource.panel); -} - -WebInspector.navigateToPanel = function(panel, view, fromBackForwardAction) -{ - if (this.currentPanel === panel) { - if (panel && view) - panel.currentView = view; - return; - } - - if (!fromBackForwardAction) { - var oldIndex = this.currentBackForwardIndex; - if (oldIndex >= 0) - this.backForwardList.splice(oldIndex + 1, this.backForwardList.length - oldIndex); - this.currentBackForwardIndex++; - this.backForwardList.push(panel); - } - - this.currentPanel = panel; - if (panel && view) - panel.currentView = view; -} - -WebInspector.UIString = function(string) -{ - if (string in this.localizedStrings) - string = this.localizedStrings[string]; - else { - if (!(string in this.missingLocalizedStrings)) { - console.error("Localized string \"" + string + "\" not found."); - this.missingLocalizedStrings[string] = true; - } - - if (Preferences.showMissingLocalizedStrings) - string += " (not localized)"; - } - - return String.vsprintf(string, Array.prototype.slice.call(arguments, 1)); -} - -WebInspector.StatusTreeElement = function(title, iconClass, panel) -{ - TreeElement.call(this, "<span class=\"title only\">" + title + "</span><span class=\"icon " + iconClass + "\"></span>", null, false); - this.panel = panel; -} - -WebInspector.StatusTreeElement.prototype = { - onselect: function() - { - var selectedElement = WebInspector.fileOutline.selectedTreeElement; - if (selectedElement) - selectedElement.deselect(); - if (this.panel) - WebInspector.navigateToPanel(this.panel); - }, - - ondeselect: function() - { - if (this.panel) - this.panel.hide(); - } -} - -WebInspector.StatusTreeElement.prototype.__proto__ = TreeElement.prototype; - -WebInspector.ConsoleStatusTreeElement = function(panel) -{ - WebInspector.StatusTreeElement.call(this, WebInspector.UIString("Console"), "console", panel); -} - -WebInspector.ConsoleStatusTreeElement.prototype = { - get warnings() - { - if (!("_warnings" in this)) - this._warnings = 0; - - return this._warnings; - }, - - set warnings(x) - { - if (this._warnings === x) - return; - - this._warnings = x; - - this._updateTitle(); - }, - - get errors() - { - if (!("_errors" in this)) - this._errors = 0; - - return this._errors; - }, - - set errors(x) - { - if (this._errors === x) - return; - - this._errors = x; - - this._updateTitle(); - }, - - _updateTitle: function() - { - var title = "<span class=\"title"; - if (!this.warnings && !this.errors) - title += " only"; - title += "\">" + WebInspector.UIString("Console") + "</span><span class=\"icon console\"></span>"; - - if (this.warnings || this.errors) { - title += "<span class=\"info\">"; - if (this.errors) { - title += this.errors + " error"; - if (this.errors > 1) - title += "s"; - } - if (this.warnings) { - if (this.errors) - title += ", "; - title += this.warnings + " warning"; - if (this.warnings > 1) - title += "s"; - } - title += "</span>"; - } - - this.title = title; - } -} - -WebInspector.ConsoleStatusTreeElement.prototype.__proto__ = WebInspector.StatusTreeElement.prototype; - -// This table maps MIME types to the Resource.Types which are valid for them. -// The following line: -// "text/html": {0: 1}, -// means that text/html is a valid MIME type for resources that have type -// WebInspector.Resource.Type.Document (which has a value of 0). -WebInspector.MIMETypes = { - "text/html": {0: true}, - "text/xml": {0: true}, - "text/plain": {0: true}, - "application/xhtml+xml": {0: true}, - "text/css": {1: true}, - "text/xsl": {1: true}, - "image/jpeg": {2: true}, - "image/png": {2: true}, - "image/gif": {2: true}, - "image/bmp": {2: true}, - "image/x-icon": {2: true}, - "image/x-xbitmap": {2: true}, - "font/ttf": {3: true}, - "font/opentype": {3: true}, - "application/x-font-type1": {3: true}, - "application/x-font-ttf": {3: true}, - "application/x-truetype-font": {3: true}, - "text/javascript": {4: true}, - "text/ecmascript": {4: true}, - "application/javascript": {4: true}, - "application/ecmascript": {4: true}, - "application/x-javascript": {4: true}, - "text/javascript1.1": {4: true}, - "text/javascript1.2": {4: true}, - "text/javascript1.3": {4: true}, - "text/jscript": {4: true}, - "text/livescript": {4: true}, -} diff --git a/WebCore/page/inspector/treeoutline.js b/WebCore/page/inspector/treeoutline.js deleted file mode 100644 index 228136a..0000000 --- a/WebCore/page/inspector/treeoutline.js +++ /dev/null @@ -1,728 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -function TreeOutline(listNode) -{ - this.children = []; - this.selectedTreeElement = null; - this._childrenListNode = listNode; - this._childrenListNode.removeChildren(); - this._knownTreeElements = []; - this._treeElementsExpandedState = []; - this.expandTreeElementsWhenArrowing = false; - this.root = true; - this.hasChildren = false; - this.expanded = true; - this.selected = false; - this.treeOutline = this; -} - -TreeOutline._knownTreeElementNextIdentifier = 1; - -TreeOutline._appendChild = function(child) -{ - if (!child) - throw("child can't be undefined or null"); - - var lastChild = this.children[this.children.length - 1]; - if (lastChild) { - lastChild.nextSibling = child; - child.previousSibling = lastChild; - } else { - child.previousSibling = null; - child.nextSibling = null; - } - - this.children.push(child); - this.hasChildren = true; - child.parent = this; - child.treeOutline = this.treeOutline; - child.treeOutline._rememberTreeElement(child); - - var current = child.children[0]; - while (current) { - current.treeOutline = this.treeOutline; - current.treeOutline._rememberTreeElement(current); - current = current.traverseNextTreeElement(false, child, true); - } - - if (child.hasChildren && child.treeOutline._treeElementsExpandedState[child.identifier] !== undefined) - child.expanded = child.treeOutline._treeElementsExpandedState[child.identifier]; - - if (!this._childrenListNode) { - this._childrenListNode = this.treeOutline._childrenListNode.ownerDocument.createElement("ol"); - this._childrenListNode.parentTreeElement = this; - this._childrenListNode.addStyleClass("children"); - if (this.hidden) - this._childrenListNode.addStyleClass("hidden"); - } - - child._attach(); -} - -TreeOutline._insertChild = function(child, index) -{ - if (!child) - throw("child can't be undefined or null"); - - var previousChild = (index > 0 ? this.children[index - 1] : null); - if (previousChild) { - previousChild.nextSibling = child; - child.previousSibling = previousChild; - } else { - child.previousSibling = null; - } - - var nextChild = this.children[index]; - if (nextChild) { - nextChild.previousSibling = child; - child.nextSibling = nextChild; - } else { - child.nextSibling = null; - } - - this.children.splice(index, 0, child); - this.hasChildren = true; - child.parent = this; - child.treeOutline = this.treeOutline; - child.treeOutline._rememberTreeElement(child); - - var current = child.children[0]; - while (current) { - current.treeOutline = this.treeOutline; - current.treeOutline._rememberTreeElement(current); - current = current.traverseNextTreeElement(false, child, true); - } - - if (child.hasChildren && child.treeOutline._treeElementsExpandedState[child.identifier] !== undefined) - child.expanded = child.treeOutline._treeElementsExpandedState[child.identifier]; - - if (!this._childrenListNode) { - this._childrenListNode = this.treeOutline._childrenListNode.ownerDocument.createElement("ol"); - this._childrenListNode.parentTreeElement = this; - this._childrenListNode.addStyleClass("children"); - if (this.hidden) - this._childrenListNode.addStyleClass("hidden"); - } - - child._attach(); -} - -TreeOutline._removeChild = function(child) -{ - if (!child) - throw("child can't be undefined or null"); - - for (var i = 0; i < this.children.length; ++i) { - if (this.children[i] === child) { - this.children.splice(i, 1); - break; - } - } - - child.deselect(); - - if (child.previousSibling) - child.previousSibling.nextSibling = child.nextSibling; - if (child.nextSibling) - child.nextSibling.previousSibling = child.previousSibling; - - if (child.treeOutline) - child.treeOutline._forgetTreeElement(child); - child._detach(); - child.treeOutline = null; - child.parent = null; - child.nextSibling = null; - child.previousSibling = null; -} - -TreeOutline._removeChildren = function() -{ - for (var i = 0; i < this.children.length; ++i) { - var child = this.children[i]; - child.deselect(); - if (child.treeOutline) - child.treeOutline._forgetTreeElement(child); - child._detach(); - child.treeOutline = null; - child.parent = null; - child.nextSibling = null; - child.previousSibling = null; - } - - this.children = []; - - if (this._childrenListNode) - this._childrenListNode.offsetTop; // force layout -} - -TreeOutline._removeChildrenRecursive = function() -{ - var childrenToRemove = this.children; - - var child = this.children[0]; - while (child) { - if (child.children.length) - childrenToRemove = childrenToRemove.concat(child.children); - child = child.traverseNextTreeElement(false, this, true); - } - - for (var i = 0; i < childrenToRemove.length; ++i) { - var child = childrenToRemove[i]; - child.deselect(); - if (child.treeOutline) - child.treeOutline._forgetTreeElement(child); - child._detach(); - child.children = []; - child.treeOutline = null; - child.parent = null; - child.nextSibling = null; - child.previousSibling = null; - } - - this.children = []; -} - -TreeOutline.prototype._rememberTreeElement = function(element) -{ - if (!this._knownTreeElements[element.identifier]) - this._knownTreeElements[element.identifier] = []; - - // check if the element is already known - var elements = this._knownTreeElements[element.identifier]; - for (var i = 0; i < elements.length; ++i) - if (elements[i] === element) - return; - - // add the element - elements.push(element); -} - -TreeOutline.prototype._forgetTreeElement = function(element) -{ - if (!this._knownTreeElements[element.identifier]) - return; - - var elements = this._knownTreeElements[element.identifier]; - for (var i = 0; i < elements.length; ++i) { - if (elements[i] === element) { - elements.splice(i, 1); - break; - } - } -} - -TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, getParent) -{ - if (!representedObject) - return null; - - if ("__treeElementIdentifier" in representedObject) { - var elements = this._knownTreeElements[representedObject.__treeElementIdentifier]; - if (elements) { - for (var i = 0; i < elements.length; ++i) - if (elements[i].representedObject === representedObject) - return elements[i]; - } - } - - if (!isAncestor || !(isAncestor instanceof Function) || !getParent || !(getParent instanceof Function)) - return null; - - var item; - var found = false; - for (var i = 0; i < this.children.length; ++i) { - item = this.children[i]; - if (item.representedObject === representedObject || isAncestor(item.representedObject, representedObject)) { - found = true; - break; - } - } - - if (!found) - return null; - - var ancestors = []; - var currentObject = representedObject; - while (currentObject) { - ancestors.unshift(currentObject); - if (currentObject === item.representedObject) - break; - currentObject = getParent(currentObject); - } - - for (var i = 0; i < ancestors.length; ++i) { - item = this.findTreeElement(ancestors[i], isAncestor, getParent); - if (ancestors[i] !== representedObject && item && item.onpopulate) - item.onpopulate(item); - } - - return item; -} - -TreeOutline.prototype.handleKeyEvent = function(event) -{ - if (!this.selectedTreeElement || event.shiftKey || event.metaKey || event.ctrlKey) - return false; - - var handled = false; - var nextSelectedElement; - if (event.keyIdentifier === "Up" && !event.altKey) { - nextSelectedElement = this.selectedTreeElement.traversePreviousTreeElement(true); - while (nextSelectedElement && !nextSelectedElement.selectable) - nextSelectedElement = nextSelectedElement.traversePreviousTreeElement(!this.expandTreeElementsWhenArrowing); - handled = nextSelectedElement ? true : false; - } else if (event.keyIdentifier === "Down" && !event.altKey) { - nextSelectedElement = this.selectedTreeElement.traverseNextTreeElement(true); - while (nextSelectedElement && !nextSelectedElement.selectable) - nextSelectedElement = nextSelectedElement.traverseNextTreeElement(!this.expandTreeElementsWhenArrowing); - handled = nextSelectedElement ? true : false; - } else if (event.keyIdentifier === "Left") { - if (this.selectedTreeElement.expanded) { - if (event.altKey) - this.selectedTreeElement.collapseRecursively(); - else - this.selectedTreeElement.collapse(); - handled = true; - } else if (this.selectedTreeElement.parent && !this.selectedTreeElement.parent.root) { - handled = true; - if (this.selectedTreeElement.parent.selectable) { - nextSelectedElement = this.selectedTreeElement.parent; - handled = nextSelectedElement ? true : false; - } else if (this.selectedTreeElement.parent) - this.selectedTreeElement.parent.collapse(); - } - } else if (event.keyIdentifier === "Right") { - if (!this.selectedTreeElement.revealed()) { - this.selectedTreeElement.reveal(); - handled = true; - } else if (this.selectedTreeElement.hasChildren) { - handled = true; - if (this.selectedTreeElement.expanded) { - nextSelectedElement = this.selectedTreeElement.children[0]; - handled = nextSelectedElement ? true : false; - } else { - if (event.altKey) - this.selectedTreeElement.expandRecursively(); - else - this.selectedTreeElement.expand(); - } - } - } - - if (nextSelectedElement) { - nextSelectedElement.reveal(); - nextSelectedElement.select(); - } - - if (handled) { - event.preventDefault(); - event.stopPropagation(); - } - - return handled; -} - -TreeOutline.prototype.expand = function() -{ - // this is the root, do nothing -} - -TreeOutline.prototype.collapse = function() -{ - // this is the root, do nothing -} - -TreeOutline.prototype.revealed = function() -{ - return true; -} - -TreeOutline.prototype.reveal = function() -{ - // this is the root, do nothing -} - -TreeOutline.prototype.appendChild = TreeOutline._appendChild; -TreeOutline.prototype.insertChild = TreeOutline._insertChild; -TreeOutline.prototype.removeChild = TreeOutline._removeChild; -TreeOutline.prototype.removeChildren = TreeOutline._removeChildren; -TreeOutline.prototype.removeChildrenRecursive = TreeOutline._removeChildrenRecursive; - -function TreeElement(title, representedObject, hasChildren) -{ - this._title = title; - this.representedObject = (representedObject || {}); - - if (this.representedObject.__treeElementIdentifier) - this.identifier = this.representedObject.__treeElementIdentifier; - else { - this.identifier = TreeOutline._knownTreeElementNextIdentifier++; - this.representedObject.__treeElementIdentifier = this.identifier; - } - - this._hidden = false; - this.expanded = false; - this.selected = false; - this.hasChildren = hasChildren; - this.children = []; - this.treeOutline = null; - this.parent = null; - this.previousSibling = null; - this.nextSibling = null; - this._listItemNode = null; -} - -TreeElement.prototype = { - selectable: true, - arrowToggleWidth: 10, - - get listItemElement() { - return this._listItemNode; - }, - - get childrenListElement() { - return this._childrenListNode; - }, - - get title() { - return this._title; - }, - - set title(x) { - this._title = x; - if (this._listItemNode) - this._listItemNode.innerHTML = x; - }, - - get tooltip() { - return this._tooltip; - }, - - set tooltip(x) { - this._tooltip = x; - if (this._listItemNode) - this._listItemNode.title = x ? x : ""; - }, - - get hidden() { - return this._hidden; - }, - - set hidden(x) { - if (this._hidden === x) - return; - - this._hidden = x; - - if (x) { - if (this._listItemNode) - this._listItemNode.addStyleClass("hidden"); - if (this._childrenListNode) - this._childrenListNode.addStyleClass("hidden"); - } else { - if (this._listItemNode) - this._listItemNode.removeStyleClass("hidden"); - if (this._childrenListNode) - this._childrenListNode.removeStyleClass("hidden"); - } - } -} - -TreeElement.prototype.appendChild = TreeOutline._appendChild; -TreeElement.prototype.insertChild = TreeOutline._insertChild; -TreeElement.prototype.removeChild = TreeOutline._removeChild; -TreeElement.prototype.removeChildren = TreeOutline._removeChildren; -TreeElement.prototype.removeChildrenRecursive = TreeOutline._removeChildrenRecursive; - -TreeElement.prototype._attach = function() -{ - if (!this._listItemNode || this.parent.refreshChildren) { - if (this._listItemNode && this._listItemNode.parentNode) - this._listItemNode.parentNode.removeChild(this._listItemNode); - - this._listItemNode = this.treeOutline._childrenListNode.ownerDocument.createElement("li"); - this._listItemNode.treeElement = this; - this._listItemNode.innerHTML = this._title; - this._listItemNode.title = this._tooltip ? this._tooltip : ""; - - if (this.hidden) - this._listItemNode.addStyleClass("hidden"); - if (this.hasChildren) - this._listItemNode.addStyleClass("parent"); - if (this.expanded) - this._listItemNode.addStyleClass("expanded"); - if (this.selected) - this._listItemNode.addStyleClass("selected"); - - this._listItemNode.addEventListener("mousedown", TreeElement.treeElementSelected, false); - this._listItemNode.addEventListener("click", TreeElement.treeElementToggled, false); - this._listItemNode.addEventListener("dblclick", TreeElement.treeElementDoubleClicked, false); - - if (this.onattach) - this.onattach(this); - } - - this.parent._childrenListNode.insertBefore(this._listItemNode, (this.nextSibling ? this.nextSibling._listItemNode : null)); - if (this._childrenListNode) - this.parent._childrenListNode.insertBefore(this._childrenListNode, this._listItemNode.nextSibling); - if (this.selected) - this.select(); - if (this.expanded) - this.expand(); -} - -TreeElement.prototype._detach = function() -{ - if (this._listItemNode && this._listItemNode.parentNode) - this._listItemNode.parentNode.removeChild(this._listItemNode); - if (this._childrenListNode && this._childrenListNode.parentNode) - this._childrenListNode.parentNode.removeChild(this._childrenListNode); -} - -TreeElement.treeElementSelected = function(event) -{ - var element = event.currentTarget; - if (!element || !element.treeElement || !element.treeElement.selectable) - return; - - if (event.offsetX > element.treeElement.arrowToggleWidth || !element.treeElement.hasChildren) - element.treeElement.select(); -} - -TreeElement.treeElementToggled = function(event) -{ - var element = event.currentTarget; - if (!element || !element.treeElement) - return; - - if (event.offsetX <= element.treeElement.arrowToggleWidth && element.treeElement.hasChildren) { - if (element.treeElement.expanded) { - if (event.altKey) - element.treeElement.collapseRecursively(); - else - element.treeElement.collapse(); - } else { - if (event.altKey) - element.treeElement.expandRecursively(); - else - element.treeElement.expand(); - } - } -} - -TreeElement.treeElementDoubleClicked = function(event) -{ - var element = event.currentTarget; - if (!element || !element.treeElement) - return; - - if (element.treeElement.ondblclick) - element.treeElement.ondblclick(element.treeElement, event); - else if (element.treeElement.hasChildren && !element.treeElement.expanded) - element.treeElement.expand(); -} - -TreeElement.prototype.collapse = function() -{ - if (this._listItemNode) - this._listItemNode.removeStyleClass("expanded"); - if (this._childrenListNode) - this._childrenListNode.removeStyleClass("expanded"); - - this.expanded = false; - if (this.treeOutline) - this.treeOutline._treeElementsExpandedState[this.identifier] = true; - - if (this.oncollapse) - this.oncollapse(this); -} - -TreeElement.prototype.collapseRecursively = function() -{ - var item = this; - while (item) { - if (item.expanded) - item.collapse(); - item = item.traverseNextTreeElement(false, this, true); - } -} - -TreeElement.prototype.expand = function() -{ - if (!this.hasChildren || (this.expanded && !this.refreshChildren && this._childrenListNode)) - return; - - if (!this._childrenListNode || this.refreshChildren) { - if (this._childrenListNode && this._childrenListNode.parentNode) - this._childrenListNode.parentNode.removeChild(this._childrenListNode); - - this._childrenListNode = this.treeOutline._childrenListNode.ownerDocument.createElement("ol"); - this._childrenListNode.parentTreeElement = this; - this._childrenListNode.addStyleClass("children"); - - if (this.hidden) - this._childrenListNode.addStyleClass("hidden"); - - if (this.onpopulate) - this.onpopulate(this); - - for (var i = 0; i < this.children.length; ++i) - this.children[i]._attach(); - - delete this.refreshChildren; - } - - if (this._listItemNode) { - this._listItemNode.addStyleClass("expanded"); - if (this._childrenListNode.parentNode != this._listItemNode.parentNode) - this.parent._childrenListNode.insertBefore(this._childrenListNode, this._listItemNode.nextSibling); - } - - if (this._childrenListNode) - this._childrenListNode.addStyleClass("expanded"); - - this.expanded = true; - if (this.treeOutline) - this.treeOutline._treeElementsExpandedState[this.identifier] = true; - - if (this.onexpand) - this.onexpand(this); -} - -TreeElement.prototype.expandRecursively = function() -{ - var item = this; - while (item) { - item.expand(); - item = item.traverseNextTreeElement(false, this); - } -} - -TreeElement.prototype.reveal = function() -{ - var currentAncestor = this.parent; - while (currentAncestor && !currentAncestor.root) { - if (!currentAncestor.expanded) - currentAncestor.expand(); - currentAncestor = currentAncestor.parent; - } - - if (this.onreveal) - this.onreveal(this); -} - -TreeElement.prototype.revealed = function() -{ - var currentAncestor = this.parent; - while (currentAncestor && !currentAncestor.root) { - if (!currentAncestor.expanded) - return false; - currentAncestor = currentAncestor.parent; - } - - return true; -} - -TreeElement.prototype.select = function(supressOnSelect) -{ - if (!this.treeOutline || !this.selectable || this.selected) - return; - - if (this.treeOutline.selectedTreeElement) - this.treeOutline.selectedTreeElement.deselect(); - - this.selected = true; - this.treeOutline.selectedTreeElement = this; - if (this._listItemNode) - this._listItemNode.addStyleClass("selected"); - - if (this.onselect && !supressOnSelect) - this.onselect(this); -} - -TreeElement.prototype.deselect = function(supressOnDeselect) -{ - if (!this.treeOutline || this.treeOutline.selectedTreeElement !== this || !this.selected) - return; - - this.selected = false; - this.treeOutline.selectedTreeElement = null; - if (this._listItemNode) - this._listItemNode.removeStyleClass("selected"); - - if (this.ondeselect && !supressOnDeselect) - this.ondeselect(this); -} - -TreeElement.prototype.traverseNextTreeElement = function(skipHidden, stayWithin, dontPopulate) -{ - if (!dontPopulate && this.hasChildren && this.onpopulate) - this.onpopulate(this); - - var element = skipHidden ? (this.revealed() ? this.children[0] : null) : this.children[0]; - if (element && (!skipHidden || (skipHidden && this.expanded))) - return element; - - if (this === stayWithin) - return null; - - element = skipHidden ? (this.revealed() ? this.nextSibling : null) : this.nextSibling; - if (element) - return element; - - element = this; - while (element && !element.root && !(skipHidden ? (element.revealed() ? element.nextSibling : null) : element.nextSibling) && element.parent !== stayWithin) - element = element.parent; - - if (!element) - return null; - - return (skipHidden ? (element.revealed() ? element.nextSibling : null) : element.nextSibling); -} - -TreeElement.prototype.traversePreviousTreeElement = function(skipHidden, dontPopulate) -{ - var element = skipHidden ? (this.revealed() ? this.previousSibling : null) : this.previousSibling; - if (!dontPopulate && element && element.hasChildren && element.onpopulate) - element.onpopulate(element); - - while (element && (skipHidden ? (element.revealed() && element.expanded ? element.children[element.children.length - 1] : null) : element.children[element.children.length - 1])) { - if (!dontPopulate && element.hasChildren && element.onpopulate) - element.onpopulate(element); - element = (skipHidden ? (element.revealed() && element.expanded ? element.children[element.children.length - 1] : null) : element.children[element.children.length - 1]); - } - - if (element) - return element; - - if (!this.parent || this.parent.root) - return null; - - return this.parent; -} diff --git a/WebCore/page/inspector/utilities.js b/WebCore/page/inspector/utilities.js deleted file mode 100644 index a92fe4d..0000000 --- a/WebCore/page/inspector/utilities.js +++ /dev/null @@ -1,787 +0,0 @@ -/* - * Copyright (C) 2007 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -Object.type = function(obj) -{ - if (obj === null) - return "null"; - - var type = typeof obj; - if (type !== "object" && type !== "function") - return type; - - if (obj instanceof String) - return "string"; - if (obj instanceof Array) - return "array"; - if (obj instanceof Boolean) - return "boolean"; - if (obj instanceof Number) - return "number"; - if (obj instanceof Date) - return "date"; - if (obj instanceof RegExp) - return "regexp"; - if (obj instanceof Error) - return "error"; - return type; -} - -Object.describe = function(obj, abbreviated) -{ - switch (Object.type(obj)) { - case "object": - return Object.prototype.toString.call(obj).replace(/^\[object (.*)\]$/i, "$1"); - case "array": - return "[" + obj.toString() + "]"; - case "string": - if (obj.length > 100) - return "\"" + obj.substring(0, 100) + "\u2026\""; - return "\"" + obj + "\""; - case "function": - var objectText = String(obj); - if (!/^function /.test(objectText)) - objectText = (type2 == "object") ? type1 : type2; - else if (abbreviated) - objectText = /.*/.exec(obj)[0].replace(/ +$/g, ""); - return objectText; - case "regexp": - return String(obj).replace(/([\\\/])/g, "\\$1").replace(/\\(\/[gim]*)$/, "$1").substring(1); - default: - return String(obj); - } -} - -Object.sortedProperties = function(obj) -{ - var properties = []; - for (var prop in obj) - properties.push(prop); - properties.sort(); - return properties; -} - -Function.prototype.bind = function(thisObject) -{ - var func = this; - var args = Array.prototype.slice.call(arguments, 1); - return function() { return func.apply(thisObject, args.concat(Array.prototype.slice.call(arguments, 0))) }; -} - -Element.prototype.removeStyleClass = function(className) -{ - // Test for the simple case before using a RegExp. - if (this.className === className) { - this.className = ""; - return; - } - - var regex = new RegExp("(^|\\s+)" + className.escapeForRegExp() + "($|\\s+)"); - if (regex.test(this.className)) - this.className = this.className.replace(regex, " "); -} - -Element.prototype.addStyleClass = function(className) -{ - if (className && !this.hasStyleClass(className)) - this.className += (this.className.length ? " " + className : className); -} - -Element.prototype.hasStyleClass = function(className) -{ - if (!className) - return false; - // Test for the simple case before using a RegExp. - if (this.className === className) - return true; - var regex = new RegExp("(^|\\s)" + className.escapeForRegExp() + "($|\\s)"); - return regex.test(this.className); -} - -Element.prototype.scrollToElement = function(element) -{ - if (!element || !this.isAncestor(element)) - return; - - var offsetTop = 0; - var current = element - while (current && current !== this) { - offsetTop += current.offsetTop; - current = current.offsetParent; - } - - if (this.scrollTop > offsetTop) - this.scrollTop = offsetTop; - else if ((this.scrollTop + this.offsetHeight) < (offsetTop + element.offsetHeight)) - this.scrollTop = offsetTop - this.offsetHeight + element.offsetHeight; -} - -Node.prototype.firstParentOrSelfWithNodeName = function(nodeName) -{ - for (var node = this; node && (node !== document); node = node.parentNode) - if (node.nodeName.toLowerCase() === nodeName.toLowerCase()) - return node; - return null; -} - -Node.prototype.firstParentOrSelfWithClass = function(className) -{ - for (var node = this; node && (node !== document); node = node.parentNode) - if (node.nodeType === Node.ELEMENT_NODE && node.hasStyleClass(className)) - return node; - return null; -} - -Node.prototype.firstParentWithClass = function(className) -{ - if (!this.parentNode) - return null; - return this.parentNode.firstParentOrSelfWithClass(className); -} - -Element.prototype.query = function(query) -{ - return document.evaluate(query, this, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue; -} - -Element.prototype.removeChildren = function() -{ - while (this.firstChild) - this.removeChild(this.firstChild); -} - -Element.prototype.firstChildSkippingWhitespace = firstChildSkippingWhitespace; -Element.prototype.lastChildSkippingWhitespace = lastChildSkippingWhitespace; - -Node.prototype.isWhitespace = isNodeWhitespace; -Node.prototype.nodeTypeName = nodeTypeName; -Node.prototype.displayName = nodeDisplayName; -Node.prototype.contentPreview = nodeContentPreview; -Node.prototype.isAncestor = isAncestorNode; -Node.prototype.isDescendant = isDescendantNode; -Node.prototype.firstCommonAncestor = firstCommonNodeAncestor; -Node.prototype.nextSiblingSkippingWhitespace = nextSiblingSkippingWhitespace; -Node.prototype.previousSiblingSkippingWhitespace = previousSiblingSkippingWhitespace; -Node.prototype.traverseNextNode = traverseNextNode; -Node.prototype.traversePreviousNode = traversePreviousNode; -Node.prototype.onlyTextChild = onlyTextChild; -Node.prototype.titleInfo = nodeTitleInfo; - -String.prototype.hasSubstring = function(string, caseInsensitive) -{ - if (!caseInsensitive) - return this.indexOf(string) !== -1; - return this.match(new RegExp(string.escapeForRegExp(), "i")); -} - -String.prototype.escapeCharacters = function(chars) -{ - var foundChar = false; - for (var i = 0; i < chars.length; ++i) { - if (this.indexOf(chars.charAt(i)) !== -1) { - foundChar = true; - break; - } - } - - if (!foundChar) - return this; - - var result = ""; - for (var i = 0; i < this.length; ++i) { - if (chars.indexOf(this.charAt(i)) !== -1) - result += "\\"; - result += this.charAt(i); - } - - return result; -} - -String.prototype.escapeForRegExp = function() -{ - return this.escapeCharacters("^[]{}()\\.$*+?|"); -} - -String.prototype.escapeHTML = function() -{ - return this.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"); -} - -String.prototype.collapseWhitespace = function() -{ - return this.replace(/[\s\xA0]+/g, " "); -} - -String.prototype.trimLeadingWhitespace = function() -{ - return this.replace(/^[\s\xA0]+/g, ""); -} - -String.prototype.trimTrailingWhitespace = function() -{ - return this.replace(/[\s\xA0]+$/g, ""); -} - -String.prototype.trimWhitespace = function() -{ - return this.replace(/^[\s\xA0]+|[\s\xA0]+$/g, ""); -} - -String.prototype.trimURL = function(baseURLDomain) -{ - var result = this.replace(new RegExp("^http[s]?:\/\/", "i"), ""); - if (baseURLDomain) - result = result.replace(new RegExp("^" + baseURLDomain.escapeForRegExp(), "i"), ""); - return result; -} - -CSSStyleDeclaration.prototype.getShorthandValue = function(shorthandProperty) -{ - var value = this.getPropertyValue(shorthandProperty); - if (!value) { - // Some shorthands (like border) return a null value, so compute a shorthand value. - // FIXME: remove this when http://bugs.webkit.org/show_bug.cgi?id=15823 is fixed. - - var foundProperties = {}; - for (var i = 0; i < this.length; ++i) { - var individualProperty = this[i]; - if (individualProperty in foundProperties || this.getPropertyShorthand(individualProperty) !== shorthandProperty) - continue; - - var individualValue = this.getPropertyValue(individualProperty); - if (this.isPropertyImplicit(individualProperty) || individualValue === "initial") - continue; - - foundProperties[individualProperty] = true; - - if (!value) - value = ""; - else if (value.length) - value += " "; - value += individualValue; - } - } - return value; -} - -CSSStyleDeclaration.prototype.getShorthandPriority = function(shorthandProperty) -{ - var priority = this.getPropertyPriority(shorthandProperty); - if (!priority) { - for (var i = 0; i < this.length; ++i) { - var individualProperty = this[i]; - if (this.getPropertyShorthand(individualProperty) !== shorthandProperty) - continue; - priority = this.getPropertyPriority(individualProperty); - break; - } - } - return priority; -} - -CSSStyleDeclaration.prototype.getLonghandProperties = function(shorthandProperty) -{ - var properties = []; - var foundProperties = {}; - - for (var i = 0; i < this.length; ++i) { - var individualProperty = this[i]; - if (individualProperty in foundProperties || this.getPropertyShorthand(individualProperty) !== shorthandProperty) - continue; - foundProperties[individualProperty] = true; - properties.push(individualProperty); - } - - return properties; -} - -CSSStyleDeclaration.prototype.getUniqueProperties = function() -{ - var properties = []; - var foundProperties = {}; - - for (var i = 0; i < this.length; ++i) { - var property = this[i]; - if (property in foundProperties) - continue; - foundProperties[property] = true; - properties.push(property); - } - - return properties; -} - -function isNodeWhitespace() -{ - if (!this || this.nodeType !== Node.TEXT_NODE) - return false; - if (!this.nodeValue.length) - return true; - return this.nodeValue.match(/^[\s\xA0]+$/); -} - -function nodeTypeName() -{ - if (!this) - return "(unknown)"; - - switch (this.nodeType) { - case Node.ELEMENT_NODE: return "Element"; - case Node.ATTRIBUTE_NODE: return "Attribute"; - case Node.TEXT_NODE: return "Text"; - case Node.CDATA_SECTION_NODE: return "Character Data"; - case Node.ENTITY_REFERENCE_NODE: return "Entity Reference"; - case Node.ENTITY_NODE: return "Entity"; - case Node.PROCESSING_INSTRUCTION_NODE: return "Processing Instruction"; - case Node.COMMENT_NODE: return "Comment"; - case Node.DOCUMENT_NODE: return "Document"; - case Node.DOCUMENT_TYPE_NODE: return "Document Type"; - case Node.DOCUMENT_FRAGMENT_NODE: return "Document Fragment"; - case Node.NOTATION_NODE: return "Notation"; - } - - return "(unknown)"; -} - -function nodeDisplayName() -{ - if (!this) - return ""; - - switch (this.nodeType) { - case Node.DOCUMENT_NODE: - return "Document"; - - case Node.ELEMENT_NODE: - var name = "<" + this.nodeName.toLowerCase(); - - if (this.hasAttributes()) { - var value = this.getAttribute("id"); - if (value) - name += " id=\"" + value + "\""; - value = this.getAttribute("class"); - if (value) - name += " class=\"" + value + "\""; - if (this.nodeName.toLowerCase() === "a") { - value = this.getAttribute("name"); - if (value) - name += " name=\"" + value + "\""; - value = this.getAttribute("href"); - if (value) - name += " href=\"" + value + "\""; - } else if (this.nodeName.toLowerCase() === "img") { - value = this.getAttribute("src"); - if (value) - name += " src=\"" + value + "\""; - } else if (this.nodeName.toLowerCase() === "iframe") { - value = this.getAttribute("src"); - if (value) - name += " src=\"" + value + "\""; - } else if (this.nodeName.toLowerCase() === "input") { - value = this.getAttribute("name"); - if (value) - name += " name=\"" + value + "\""; - value = this.getAttribute("type"); - if (value) - name += " type=\"" + value + "\""; - } else if (this.nodeName.toLowerCase() === "form") { - value = this.getAttribute("action"); - if (value) - name += " action=\"" + value + "\""; - } - } - - return name + ">"; - - case Node.TEXT_NODE: - if (isNodeWhitespace.call(this)) - return "(whitespace)"; - return "\"" + this.nodeValue + "\""; - - case Node.COMMENT_NODE: - return "<!--" + this.nodeValue + "-->"; - } - - return this.nodeName.toLowerCase().collapseWhitespace(); -} - -function nodeContentPreview() -{ - if (!this || !this.hasChildNodes || !this.hasChildNodes()) - return ""; - - var limit = 0; - var preview = ""; - - // always skip whitespace here - var currentNode = traverseNextNode.call(this, true, this); - while (currentNode) { - if (currentNode.nodeType === Node.TEXT_NODE) - preview += currentNode.nodeValue.escapeHTML(); - else - preview += nodeDisplayName.call(currentNode).escapeHTML(); - - currentNode = traverseNextNode.call(currentNode, true, this); - - if (++limit > 4) { - preview += "…"; // ellipsis - break; - } - } - - return preview.collapseWhitespace(); -} - -function isAncestorNode(ancestor) -{ - if (!this || !ancestor) - return false; - - var currentNode = ancestor.parentNode; - while (currentNode) { - if (this === currentNode) - return true; - currentNode = currentNode.parentNode; - } - - return false; -} - -function isDescendantNode(descendant) -{ - return isAncestorNode.call(descendant, this); -} - -function firstCommonNodeAncestor(node) -{ - if (!this || !node) - return; - - var node1 = this.parentNode; - var node2 = node.parentNode; - - if ((!node1 || !node2) || node1 !== node2) - return null; - - while (node1 && node2) { - if (!node1.parentNode || !node2.parentNode) - break; - if (node1 !== node2) - break; - - node1 = node1.parentNode; - node2 = node2.parentNode; - } - - return node1; -} - -function nextSiblingSkippingWhitespace() -{ - if (!this) - return; - var node = this.nextSibling; - while (node && node.nodeType === Node.TEXT_NODE && isNodeWhitespace.call(node)) - node = node.nextSibling; - return node; -} - -function previousSiblingSkippingWhitespace() -{ - if (!this) - return; - var node = this.previousSibling; - while (node && node.nodeType === Node.TEXT_NODE && isNodeWhitespace.call(node)) - node = node.previousSibling; - return node; -} - -function firstChildSkippingWhitespace() -{ - if (!this) - return; - var node = this.firstChild; - while (node && node.nodeType === Node.TEXT_NODE && isNodeWhitespace.call(node)) - node = nextSiblingSkippingWhitespace.call(node); - return node; -} - -function lastChildSkippingWhitespace() -{ - if (!this) - return; - var node = this.lastChild; - while (node && node.nodeType === Node.TEXT_NODE && isNodeWhitespace.call(node)) - node = previousSiblingSkippingWhitespace.call(node); - return node; -} - -function traverseNextNode(skipWhitespace, stayWithin) -{ - if (!this) - return; - - var node = skipWhitespace ? firstChildSkippingWhitespace.call(this) : this.firstChild; - if (node) - return node; - - if (stayWithin && this === stayWithin) - return null; - - node = skipWhitespace ? nextSiblingSkippingWhitespace.call(this) : this.nextSibling; - if (node) - return node; - - node = this; - while (node && !(skipWhitespace ? nextSiblingSkippingWhitespace.call(node) : node.nextSibling) && (!stayWithin || !node.parentNode || node.parentNode !== stayWithin)) - node = node.parentNode; - if (!node) - return null; - - return skipWhitespace ? nextSiblingSkippingWhitespace.call(node) : node.nextSibling; -} - -function traversePreviousNode(skipWhitespace) -{ - if (!this) - return; - var node = skipWhitespace ? previousSiblingSkippingWhitespace.call(this) : this.previousSibling; - while (node && (skipWhitespace ? lastChildSkippingWhitespace.call(node) : node.lastChild) ) - node = skipWhitespace ? lastChildSkippingWhitespace.call(node) : node.lastChild; - if (node) - return node; - return this.parentNode; -} - -function onlyTextChild(ignoreWhitespace) -{ - if (!this) - return null; - - var firstChild = ignoreWhitespace ? firstChildSkippingWhitespace.call(this) : this.firstChild; - if (!firstChild || firstChild.nodeType !== Node.TEXT_NODE) - return null; - - var sibling = ignoreWhitespace ? nextSiblingSkippingWhitespace.call(firstChild) : firstChild.nextSibling; - return sibling ? null : firstChild; -} - -function nodeTitleInfo(hasChildren, linkify) -{ - var info = {title: "", hasChildren: hasChildren}; - - switch (this.nodeType) { - case Node.DOCUMENT_NODE: - info.title = "Document"; - break; - - case Node.ELEMENT_NODE: - info.title = "<span class=\"webkit-html-tag\"><" + this.nodeName.toLowerCase().escapeHTML(); - - if (this.hasAttributes()) { - for (var i = 0; i < this.attributes.length; ++i) { - var attr = this.attributes[i]; - var value = attr.value.escapeHTML(); - value = value.replace(/([\/;:\)\]\}])/g, "$1​"); - - info.title += " <span class=\"webkit-html-attribute-name\">" + attr.name.escapeHTML() + "</span>=​"; - - if (linkify && (attr.name === "src" || attr.name === "href")) - info.title += linkify(attr.value, value, "webkit-html-attribute-value", this.nodeName.toLowerCase() == "a"); - else - info.title += "<span class=\"webkit-html-attribute-value\">\"" + value + "\"</span>"; - } - } - info.title += "></span>​"; - - // If this element only has a single child that is a text node, - // just show that text and the closing tag inline rather than - // create a subtree for them - - var textChild = onlyTextChild.call(this, Preferences.ignoreWhitespace); - var showInlineText = textChild && textChild.textContent.length < Preferences.maxInlineTextChildLength; - - if (showInlineText) { - info.title += textChild.nodeValue.escapeHTML() + "​<span class=\"webkit-html-tag\"></" + this.nodeName.toLowerCase().escapeHTML() + "></span>"; - info.hasChildren = false; - } - break; - - case Node.TEXT_NODE: - if (isNodeWhitespace.call(this)) - info.title = "(whitespace)"; - else - info.title = "\"" + this.nodeValue.escapeHTML() + "\""; - break - - case Node.COMMENT_NODE: - info.title = "<span class=\"webkit-html-comment\"><!--" + this.nodeValue.escapeHTML() + "--></span>"; - break; - - default: - info.title = this.nodeName.toLowerCase().collapseWhitespace().escapeHTML(); - } - - return info; -} - -Number.secondsToString = function(seconds) -{ - var ms = seconds * 1000; - if (ms < 1000) - return Math.round(ms) + "ms"; - - if (seconds < 60) - return (Math.round(seconds * 100) / 100) + "s"; - - var minutes = seconds / 60; - if (minutes < 60) - return (Math.round(minutes * 10) / 10) + "min"; - - var hours = minutes / 60; - if (hours < 24) - return (Math.round(hours * 10) / 10) + "hrs"; - - var days = hours / 24; - return (Math.round(days * 10) / 10) + " days"; -} - -Number.bytesToString = function(bytes) -{ - if (bytes < 1024) - return bytes + "B"; - - var kilobytes = bytes / 1024; - if (kilobytes < 1024) - return (Math.round(kilobytes * 100) / 100) + "KB"; - - var megabytes = kilobytes / 1024; - return (Math.round(megabytes * 1000) / 1000) + "MB"; -} - -Number.constrain = function(num, min, max) -{ - if (num < min) - num = min; - else if (num > max) - num = max; - return num; -} - -HTMLTextAreaElement.prototype.moveCursorToEnd = function() -{ - var length = this.value.length; - this.setSelectionRange(length, length); -} - -String.sprintf = function(format) -{ - return String.vsprintf(format, Array.prototype.slice.call(arguments, 1)); -} - -String.vsprintf = function(format, substitutions) -{ - if (!format || !substitutions || !substitutions.length) - return format; - - var result = ""; - var substitutionIndex = 0; - - var index = 0; - for (var precentIndex = format.indexOf("%", index); precentIndex !== -1; precentIndex = format.indexOf("%", index)) { - result += format.substring(index, precentIndex); - index = precentIndex + 1; - - if (format[index] === "%") { - result += "%"; - ++index; - continue; - } - - if (!isNaN(format[index])) { - // The first character is a number, it might be a substitution index. - var number = parseInt(format.substring(index)); - while (!isNaN(format[index])) - ++index; - // If the number is greater than zero and ends with a "$", - // then this is a substitution index. - if (number > 0 && format[index] === "$") { - substitutionIndex = (number - 1); - ++index; - } - } - - var precision = -1; - if (format[index] === ".") { - // This is a precision specifier. If no digit follows the ".", - // then the precision should be zero. - ++index; - precision = parseInt(format.substring(index)); - if (isNaN(precision)) - precision = 0; - while (!isNaN(format[index])) - ++index; - } - - if (substitutionIndex >= substitutions.length) { - // If there are not enough substitutions for the current substitutionIndex - // just output the format specifier literally and move on. - console.error("String.vsprintf(\"" + format + "\", \"" + substitutions.join("\", \"") + "\"): not enough substitution arguments. Had " + substitutions.length + " but needed " + (substitutionIndex + 1) + ", so substitution was skipped."); - index = precentIndex + 1; - result += "%"; - continue; - } - - switch (format[index]) { - case "d": - var substitution = parseInt(substitutions[substitutionIndex]); - result += (!isNaN(substitution) ? substitution : 0); - break; - case "f": - var substitution = parseFloat(substitutions[substitutionIndex]); - if (substitution && precision > -1) - substitution = substitution.toFixed(precision); - result += (!isNaN(substitution) ? substitution : (precision > -1 ? Number(0).toFixed(precision) : 0)); - break; - default: - // Encountered an unsupported format character, treat as a string. - console.warn("String.vsprintf(\"" + format + "\", \"" + substitutions.join("\", \"") + "\"): unsupported format character \u201C" + format[index] + "\u201D. Treating as a string."); - // Fall through to treat this like a string. - case "s": - result += substitutions[substitutionIndex]; - break; - } - - ++substitutionIndex; - ++index; - } - - result += format.substring(index); - - return result; -} |