Index: chrome/tools/test/reference_build/chrome_linux/resources/inspector/ElementsPanel.js |
diff --git a/chrome/tools/test/reference_build/chrome_linux/resources/inspector/ElementsPanel.js b/chrome/tools/test/reference_build/chrome_linux/resources/inspector/ElementsPanel.js |
index 3c9be545bea1a4a19f505119eb740564a6d23868..6e247e2f920dc612d772643d603d973d137eb1be 100644 |
--- a/chrome/tools/test/reference_build/chrome_linux/resources/inspector/ElementsPanel.js |
+++ b/chrome/tools/test/reference_build/chrome_linux/resources/inspector/ElementsPanel.js |
@@ -1,6 +1,7 @@ |
/* |
* Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
* Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
+ * Copyright (C) 2009 Joseph Pecoraro |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
@@ -60,6 +61,8 @@ WebInspector.ElementsPanel = function() |
InspectorController.toggleNodeSearch(); |
this.panel.nodeSearchButton.removeStyleClass("toggled-on"); |
} |
+ if (this._focusedDOMNode) |
+ InspectorController.addInspectedNode(this._focusedDOMNode.id, function() {}); |
}; |
this.contentElement.appendChild(this.treeOutline.element); |
@@ -95,10 +98,7 @@ WebInspector.ElementsPanel = function() |
this.sidebarResizeElement.className = "sidebar-resizer-vertical"; |
this.sidebarResizeElement.addEventListener("mousedown", this.rightSidebarResizerDragStart.bind(this), false); |
- this.nodeSearchButton = document.createElement("button"); |
- this.nodeSearchButton.title = WebInspector.UIString("Select an element in the page to inspect it."); |
- this.nodeSearchButton.id = "node-search-status-bar-item"; |
- this.nodeSearchButton.className = "status-bar-item"; |
+ this.nodeSearchButton = new WebInspector.StatusBarButton(WebInspector.UIString("Select an element in the page to inspect it."), "node-search-status-bar-item"); |
this.nodeSearchButton.addEventListener("click", this._nodeSearchButtonClicked.bind(this), false); |
this.searchingForNode = false; |
@@ -107,10 +107,7 @@ WebInspector.ElementsPanel = function() |
this.element.appendChild(this.sidebarElement); |
this.element.appendChild(this.sidebarResizeElement); |
- this._mutationMonitoredWindows = []; |
- this._nodeInsertedEventListener = InspectorController.wrapCallback(this._nodeInserted.bind(this)); |
- this._nodeRemovedEventListener = InspectorController.wrapCallback(this._nodeRemoved.bind(this)); |
- this._contentLoadedEventListener = InspectorController.wrapCallback(this._contentLoaded.bind(this)); |
+ this._changedStyles = {}; |
this.reset(); |
} |
@@ -125,7 +122,7 @@ WebInspector.ElementsPanel.prototype = { |
get statusBarItems() |
{ |
- return [this.nodeSearchButton, this.crumbsElement]; |
+ return [this.nodeSearchButton.element, this.crumbsElement]; |
}, |
updateStatusBarItems: function() |
@@ -151,7 +148,7 @@ WebInspector.ElementsPanel.prototype = { |
if (InspectorController.searchingForNode()) { |
InspectorController.toggleNodeSearch(); |
- this.nodeSearchButton.removeStyleClass("toggled-on"); |
+ this.nodeSearchButton.toggled = false; |
} |
}, |
@@ -170,40 +167,27 @@ WebInspector.ElementsPanel.prototype = { |
if (InspectorController.searchingForNode()) { |
InspectorController.toggleNodeSearch(); |
- this.nodeSearchButton.removeStyleClass("toggled-on"); |
+ this.nodeSearchButton.toggled = false; |
} |
this.recentlyModifiedNodes = []; |
- this.unregisterAllMutationEventListeners(); |
delete this.currentQuery; |
this.searchCanceled(); |
- var inspectedWindow = InspectorController.inspectedWindow(); |
- if (!inspectedWindow || !inspectedWindow.document) |
+ var domWindow = WebInspector.domAgent.domWindow; |
+ if (!domWindow || !domWindow.document || !domWindow.document.firstChild) |
return; |
- if (!inspectedWindow.document.firstChild) { |
- function contentLoaded() |
- { |
- inspectedWindow.document.removeEventListener("DOMContentLoaded", contentLoadedCallback, false); |
- |
- this.reset(); |
- } |
- |
- var contentLoadedCallback = InspectorController.wrapCallback(contentLoaded.bind(this)); |
- inspectedWindow.document.addEventListener("DOMContentLoaded", contentLoadedCallback, false); |
- return; |
- } |
- |
// If the window isn't visible, return early so the DOM tree isn't built |
// and mutation event listeners are not added. |
if (!InspectorController.isWindowVisible()) |
return; |
- this.registerMutationEventListeners(inspectedWindow); |
+ var inspectedRootDocument = domWindow.document; |
+ inspectedRootDocument.addEventListener("DOMNodeInserted", this._nodeInserted.bind(this)); |
+ inspectedRootDocument.addEventListener("DOMNodeRemoved", this._nodeRemoved.bind(this)); |
- var inspectedRootDocument = inspectedWindow.document; |
this.rootDOMNode = inspectedRootDocument; |
var canidateFocusNode = inspectedRootDocument.body || inspectedRootDocument.documentElement; |
@@ -217,19 +201,11 @@ WebInspector.ElementsPanel.prototype = { |
} |
}, |
- includedInSearchResultsPropertyName: "__includedInInspectorSearchResults", |
- |
searchCanceled: function() |
{ |
if (this._searchResults) { |
- const searchResultsProperty = this.includedInSearchResultsPropertyName; |
for (var i = 0; i < this._searchResults.length; ++i) { |
- var node = this._searchResults[i]; |
- |
- // Remove the searchResultsProperty since there might be an unfinished search. |
- delete node[searchResultsProperty]; |
- |
- var treeElement = this.treeOutline.findTreeElement(node); |
+ var treeElement = this.treeOutline.findTreeElement(this._searchResults[i]); |
if (treeElement) |
treeElement.highlighted = false; |
} |
@@ -237,13 +213,9 @@ WebInspector.ElementsPanel.prototype = { |
WebInspector.updateSearchMatchesCount(0, this); |
- if (this._currentSearchChunkIntervalIdentifier) { |
- clearInterval(this._currentSearchChunkIntervalIdentifier); |
- delete this._currentSearchChunkIntervalIdentifier; |
- } |
- |
this._currentSearchResultIndex = 0; |
this._searchResults = []; |
+ InspectorController.searchCanceled(function() {}); |
}, |
performSearch: function(query) |
@@ -255,241 +227,56 @@ WebInspector.ElementsPanel.prototype = { |
if (!whitespaceTrimmedQuery.length) |
return; |
- var tagNameQuery = whitespaceTrimmedQuery; |
- var attributeNameQuery = whitespaceTrimmedQuery; |
- var startTagFound = (tagNameQuery.indexOf("<") === 0); |
- var endTagFound = (tagNameQuery.lastIndexOf(">") === (tagNameQuery.length - 1)); |
- |
- if (startTagFound || endTagFound) { |
- var tagNameQueryLength = tagNameQuery.length; |
- tagNameQuery = tagNameQuery.substring((startTagFound ? 1 : 0), (endTagFound ? (tagNameQueryLength - 1) : tagNameQueryLength)); |
- } |
- |
- // Check the tagNameQuery is it is a possibly valid tag name. |
- if (!/^[a-zA-Z0-9\-_:]+$/.test(tagNameQuery)) |
- tagNameQuery = null; |
- |
- // Check the attributeNameQuery is it is a possibly valid tag name. |
- if (!/^[a-zA-Z0-9\-_:]+$/.test(attributeNameQuery)) |
- attributeNameQuery = null; |
- |
- const escapedQuery = query.escapeCharacters("'"); |
- const escapedTagNameQuery = (tagNameQuery ? tagNameQuery.escapeCharacters("'") : null); |
- const escapedWhitespaceTrimmedQuery = whitespaceTrimmedQuery.escapeCharacters("'"); |
- const searchResultsProperty = this.includedInSearchResultsPropertyName; |
- |
- var updatedMatchCountOnce = false; |
- var matchesCountUpdateTimeout = null; |
- |
- function updateMatchesCount() |
- { |
- WebInspector.updateSearchMatchesCount(this._searchResults.length, this); |
- matchesCountUpdateTimeout = null; |
- updatedMatchCountOnce = true; |
- } |
- |
- function updateMatchesCountSoon() |
- { |
- if (!updatedMatchCountOnce) |
- return updateMatchesCount.call(this); |
- if (matchesCountUpdateTimeout) |
- return; |
- // Update the matches count every half-second so it doesn't feel twitchy. |
- matchesCountUpdateTimeout = setTimeout(updateMatchesCount.bind(this), 500); |
- } |
- |
- function addNodesToResults(nodes, length, getItem) |
- { |
- if (!length) |
- return; |
- |
- for (var i = 0; i < length; ++i) { |
- var node = getItem.call(nodes, i); |
- // Skip this node if it already has the property. |
- if (searchResultsProperty in node) |
- continue; |
- |
- if (!this._searchResults.length) { |
- this._currentSearchResultIndex = 0; |
- this.focusedDOMNode = node; |
- } |
- |
- node[searchResultsProperty] = true; |
- this._searchResults.push(node); |
- |
- // Highlight the tree element to show it matched the search. |
- // FIXME: highlight the substrings in text nodes and attributes. |
- var treeElement = this.treeOutline.findTreeElement(node); |
- if (treeElement) |
- treeElement.highlighted = true; |
- } |
- |
- updateMatchesCountSoon.call(this); |
- } |
- |
- function matchExactItems(doc) |
- { |
- matchExactId.call(this, doc); |
- matchExactClassNames.call(this, doc); |
- matchExactTagNames.call(this, doc); |
- matchExactAttributeNames.call(this, doc); |
- } |
- |
- function matchExactId(doc) |
- { |
- const result = doc.__proto__.getElementById.call(doc, whitespaceTrimmedQuery); |
- addNodesToResults.call(this, result, (result ? 1 : 0), function() { return this }); |
- } |
- |
- function matchExactClassNames(doc) |
- { |
- const result = doc.__proto__.getElementsByClassName.call(doc, whitespaceTrimmedQuery); |
- addNodesToResults.call(this, result, result.length, result.item); |
- } |
- |
- function matchExactTagNames(doc) |
- { |
- if (!tagNameQuery) |
- return; |
- const result = doc.__proto__.getElementsByTagName.call(doc, tagNameQuery); |
- addNodesToResults.call(this, result, result.length, result.item); |
- } |
- |
- function matchExactAttributeNames(doc) |
- { |
- if (!attributeNameQuery) |
- return; |
- const result = doc.__proto__.querySelectorAll.call(doc, "[" + attributeNameQuery + "]"); |
- addNodesToResults.call(this, result, result.length, result.item); |
- } |
- |
- function matchPartialTagNames(doc) |
- { |
- if (!tagNameQuery) |
- return; |
- const result = doc.__proto__.evaluate.call(doc, "//*[contains(name(), '" + escapedTagNameQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); |
- addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); |
- } |
- |
- function matchStartOfTagNames(doc) |
- { |
- if (!tagNameQuery) |
- return; |
- const result = doc.__proto__.evaluate.call(doc, "//*[starts-with(name(), '" + escapedTagNameQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); |
- addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); |
- } |
- |
- function matchPartialTagNamesAndAttributeValues(doc) |
- { |
- if (!tagNameQuery) { |
- matchPartialAttributeValues.call(this, doc); |
- return; |
- } |
- |
- const result = doc.__proto__.evaluate.call(doc, "//*[contains(name(), '" + escapedTagNameQuery + "') or contains(@*, '" + escapedQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); |
- addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); |
- } |
- |
- function matchPartialAttributeValues(doc) |
- { |
- const result = doc.__proto__.evaluate.call(doc, "//*[contains(@*, '" + escapedQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); |
- addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); |
- } |
+ this._updatedMatchCountOnce = false; |
+ this._matchesCountUpdateTimeout = null; |
- function matchStyleSelector(doc) |
- { |
- const result = doc.__proto__.querySelectorAll.call(doc, whitespaceTrimmedQuery); |
- addNodesToResults.call(this, result, result.length, result.item); |
- } |
- |
- function matchPlainText(doc) |
- { |
- const result = doc.__proto__.evaluate.call(doc, "//text()[contains(., '" + escapedQuery + "')] | //comment()[contains(., '" + escapedQuery + "')]", doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); |
- addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); |
- } |
- |
- function matchXPathQuery(doc) |
- { |
- const result = doc.__proto__.evaluate.call(doc, whitespaceTrimmedQuery, doc, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE); |
- addNodesToResults.call(this, result, result.snapshotLength, result.snapshotItem); |
- } |
- |
- function finishedSearching() |
- { |
- // Remove the searchResultsProperty now that the search is finished. |
- for (var i = 0; i < this._searchResults.length; ++i) |
- delete this._searchResults[i][searchResultsProperty]; |
- } |
+ InspectorController.performSearch(whitespaceTrimmedQuery, function() {}); |
+ }, |
- const mainFrameDocument = InspectorController.inspectedWindow().document; |
- const searchDocuments = [mainFrameDocument]; |
- |
- if (tagNameQuery && startTagFound && endTagFound) |
- const searchFunctions = [matchExactTagNames, matchPlainText]; |
- else if (tagNameQuery && startTagFound) |
- const searchFunctions = [matchStartOfTagNames, matchPlainText]; |
- else if (tagNameQuery && endTagFound) { |
- // FIXME: we should have a matchEndOfTagNames search function if endTagFound is true but not startTagFound. |
- // This requires ends-with() support in XPath, WebKit only supports starts-with() and contains(). |
- const searchFunctions = [matchPartialTagNames, matchPlainText]; |
- } else if (whitespaceTrimmedQuery === "//*" || whitespaceTrimmedQuery === "*") { |
- // These queries will match every node. Matching everything isn't useful and can be slow for large pages, |
- // so limit the search functions list to plain text and attribute matching. |
- const searchFunctions = [matchPartialAttributeValues, matchPlainText]; |
- } else |
- const searchFunctions = [matchExactItems, matchStyleSelector, matchPartialTagNamesAndAttributeValues, matchPlainText, matchXPathQuery]; |
- |
- // Find all frames, iframes and object elements to search their documents. |
- const querySelectorAllFunction = InspectorController.inspectedWindow().Document.prototype.querySelectorAll; |
- const subdocumentResult = querySelectorAllFunction.call(mainFrameDocument, "iframe, frame, object"); |
- |
- for (var i = 0; i < subdocumentResult.length; ++i) { |
- var element = subdocumentResult.item(i); |
- if (element.contentDocument) |
- searchDocuments.push(element.contentDocument); |
- } |
+ _updateMatchesCount: function() |
+ { |
+ WebInspector.updateSearchMatchesCount(this._searchResults.length, this); |
+ this._matchesCountUpdateTimeout = null; |
+ this._updatedMatchCountOnce = true; |
+ }, |
- const panel = this; |
- var documentIndex = 0; |
- var searchFunctionIndex = 0; |
- var chunkIntervalIdentifier = null; |
+ _updateMatchesCountSoon: function() |
+ { |
+ if (!this._updatedMatchCountOnce) |
+ return this._updateMatchesCount(); |
+ if (this._matchesCountUpdateTimeout) |
+ return; |
+ // Update the matches count every half-second so it doesn't feel twitchy. |
+ this._matchesCountUpdateTimeout = setTimeout(this._updateMatchesCount.bind(this), 500); |
+ }, |
- // Split up the work into chunks so we don't block the UI thread while processing. |
+ addNodesToSearchResult: function(nodeIds) |
+ { |
+ if (!nodeIds) |
+ return; |
- function processChunk() |
- { |
- var searchDocument = searchDocuments[documentIndex]; |
- var searchFunction = searchFunctions[searchFunctionIndex]; |
- |
- if (++searchFunctionIndex > searchFunctions.length) { |
- searchFunction = searchFunctions[0]; |
- searchFunctionIndex = 0; |
- |
- if (++documentIndex > searchDocuments.length) { |
- if (panel._currentSearchChunkIntervalIdentifier === chunkIntervalIdentifier) |
- delete panel._currentSearchChunkIntervalIdentifier; |
- clearInterval(chunkIntervalIdentifier); |
- finishedSearching.call(panel); |
- return; |
- } |
+ var nodeIdsArray = nodeIds.split(","); |
+ for (var i = 0; i < nodeIdsArray.length; ++i) { |
+ var nodeId = nodeIdsArray[i]; |
+ var node = WebInspector.domAgent.nodeForId(nodeId); |
+ if (!node) |
+ continue; |
- searchDocument = searchDocuments[documentIndex]; |
+ if (!this._searchResults.length) { |
+ this._currentSearchResultIndex = 0; |
+ this.focusedDOMNode = node; |
} |
- if (!searchDocument || !searchFunction) |
- return; |
+ this._searchResults.push(node); |
- try { |
- searchFunction.call(panel, searchDocument); |
- } catch(err) { |
- // ignore any exceptions. the query might be malformed, but we allow that. |
- } |
+ // Highlight the tree element to show it matched the search. |
+ // FIXME: highlight the substrings in text nodes and attributes. |
+ var treeElement = this.treeOutline.findTreeElement(node); |
+ if (treeElement) |
+ treeElement.highlighted = true; |
} |
- processChunk(); |
- |
- chunkIntervalIdentifier = setInterval(processChunk, 25); |
- this._currentSearchChunkIntervalIdentifier = chunkIntervalIdentifier; |
+ this._updateMatchesCountSoon(); |
}, |
jumpToNextSearchResult: function() |
@@ -510,57 +297,118 @@ WebInspector.ElementsPanel.prototype = { |
this.focusedDOMNode = this._searchResults[this._currentSearchResultIndex]; |
}, |
- inspectedWindowCleared: function(window) |
- { |
- if (InspectorController.isWindowVisible()) |
- this.updateMutationEventListeners(window); |
- }, |
- |
- _addMutationEventListeners: function(monitoredWindow) |
+ renameSelector: function(oldIdentifier, newIdentifier, oldSelector, newSelector) |
{ |
- monitoredWindow.document.addEventListener("DOMNodeInserted", this._nodeInsertedEventListener, true); |
- monitoredWindow.document.addEventListener("DOMNodeRemoved", this._nodeRemovedEventListener, true); |
- if (monitoredWindow.frameElement) |
- monitoredWindow.addEventListener("DOMContentLoaded", this._contentLoadedEventListener, true); |
+ // TODO: Implement Shifting the oldSelector, and its contents to a newSelector |
}, |
- _removeMutationEventListeners: function(monitoredWindow) |
+ addStyleChange: function(identifier, style, property) |
{ |
- if (monitoredWindow.frameElement) |
- monitoredWindow.removeEventListener("DOMContentLoaded", this._contentLoadedEventListener, true); |
- if (!monitoredWindow.document) |
+ if (!style.parentRule) |
return; |
- monitoredWindow.document.removeEventListener("DOMNodeInserted", this._nodeInsertedEventListener, true); |
- monitoredWindow.document.removeEventListener("DOMNodeRemoved", this._nodeRemovedEventListener, true); |
- }, |
- updateMutationEventListeners: function(monitoredWindow) |
- { |
- this._addMutationEventListeners(monitoredWindow); |
+ var selector = style.parentRule.selectorText; |
+ if (!this._changedStyles[identifier]) |
+ this._changedStyles[identifier] = {}; |
+ |
+ if (!this._changedStyles[identifier][selector]) |
+ this._changedStyles[identifier][selector] = {}; |
+ |
+ if (!this._changedStyles[identifier][selector][property]) |
+ WebInspector.styleChanges += 1; |
+ |
+ this._changedStyles[identifier][selector][property] = style.getPropertyValue(property); |
}, |
- registerMutationEventListeners: function(monitoredWindow) |
+ removeStyleChange: function(identifier, style, property) |
{ |
- if (!monitoredWindow || this._mutationMonitoredWindows.indexOf(monitoredWindow) !== -1) |
+ if (!style.parentRule) |
return; |
- this._mutationMonitoredWindows.push(monitoredWindow); |
- if (InspectorController.isWindowVisible()) |
- this._addMutationEventListeners(monitoredWindow); |
- }, |
- unregisterMutationEventListeners: function(monitoredWindow) |
- { |
- if (!monitoredWindow || this._mutationMonitoredWindows.indexOf(monitoredWindow) === -1) |
+ var selector = style.parentRule.selectorText; |
+ if (!this._changedStyles[identifier] || !this._changedStyles[identifier][selector]) |
return; |
- this._mutationMonitoredWindows.remove(monitoredWindow); |
- this._removeMutationEventListeners(monitoredWindow); |
+ |
+ if (this._changedStyles[identifier][selector][property]) { |
+ delete this._changedStyles[identifier][selector][property]; |
+ WebInspector.styleChanges -= 1; |
+ } |
}, |
- unregisterAllMutationEventListeners: function() |
+ generateStylesheet: function() |
{ |
- for (var i = 0; i < this._mutationMonitoredWindows.length; ++i) |
- this._removeMutationEventListeners(this._mutationMonitoredWindows[i]); |
- this._mutationMonitoredWindows = []; |
+ if (!WebInspector.styleChanges) |
+ return; |
+ |
+ // Merge Down to Just Selectors |
+ var mergedSelectors = {}; |
+ for (var identifier in this._changedStyles) { |
+ for (var selector in this._changedStyles[identifier]) { |
+ if (!mergedSelectors[selector]) |
+ mergedSelectors[selector] = this._changedStyles[identifier][selector]; |
+ else { // merge on selector |
+ var merge = {}; |
+ for (var property in mergedSelectors[selector]) |
+ merge[property] = mergedSelectors[selector][property]; |
+ for (var property in this._changedStyles[identifier][selector]) { |
+ if (!merge[property]) |
+ merge[property] = this._changedStyles[identifier][selector][property]; |
+ else { // merge on property within a selector, include comment to notify user |
+ var value1 = merge[property]; |
+ var value2 = this._changedStyles[identifier][selector][property]; |
+ |
+ if (value1 === value2) |
+ merge[property] = [value1]; |
+ else if (Object.type(value1) === "array") |
+ merge[property].push(value2); |
+ else |
+ merge[property] = [value1, value2]; |
+ } |
+ } |
+ mergedSelectors[selector] = merge; |
+ } |
+ } |
+ } |
+ |
+ var builder = []; |
+ builder.push("/**"); |
+ builder.push(" * Inspector Generated Stylesheet"); // UIString? |
+ builder.push(" */\n"); |
+ |
+ var indent = " "; |
+ function displayProperty(property, value, comment) { |
+ if (comment) |
+ return indent + "/* " + property + ": " + value + "; */"; |
+ else |
+ return indent + property + ": " + value + ";"; |
+ } |
+ |
+ for (var selector in mergedSelectors) { |
+ var psuedoStyle = mergedSelectors[selector]; |
+ var properties = Object.properties(psuedoStyle); |
+ if (properties.length) { |
+ builder.push(selector + " {"); |
+ for (var i = 0; i < properties.length; ++i) { |
+ var property = properties[i]; |
+ var value = psuedoStyle[property]; |
+ if (Object.type(value) !== "array") |
+ builder.push(displayProperty(property, value)); |
+ else { |
+ if (value.length === 1) |
+ builder.push(displayProperty(property, value) + " /* merged from equivalent edits */"); // UIString? |
+ else { |
+ builder.push(indent + "/* There was a Conflict... There were Multiple Edits for '" + property + "' */"); // UIString? |
+ for (var j = 0; j < value.length; ++j) |
+ builder.push(displayProperty(property, value, true)); |
+ } |
+ } |
+ } |
+ builder.push("}\n"); |
+ } |
+ } |
+ |
+ WebInspector.showConsole(); |
+ WebInspector.console.addMessage(new WebInspector.ConsoleTextMessage(builder.join("\n"))); |
}, |
get rootDOMNode() |
@@ -583,13 +431,6 @@ WebInspector.ElementsPanel.prototype = { |
this.treeOutline.focusedDOMNode = x; |
}, |
- _contentLoaded: function(event) |
- { |
- this.recentlyModifiedNodes.push({node: event.target, parent: event.target.defaultView.frameElement, replaced: true}); |
- if (this.visible) |
- this._updateModifiedNodesSoon(); |
- }, |
- |
_nodeInserted: function(event) |
{ |
this.recentlyModifiedNodes.push({node: event.target, parent: event.relatedNode, inserted: true}); |
@@ -627,14 +468,14 @@ WebInspector.ElementsPanel.prototype = { |
if (!parent) |
continue; |
- var parentNodeItem = this.treeOutline.findTreeElement(parent, null, null, objectsAreSame); |
+ var parentNodeItem = this.treeOutline.findTreeElement(parent); |
if (parentNodeItem && !parentNodeItem.alreadyUpdatedChildren) { |
parentNodeItem.updateChildren(replaced); |
parentNodeItem.alreadyUpdatedChildren = true; |
updatedParentTreeElements.push(parentNodeItem); |
} |
- if (!updateBreadcrumbs && (objectsAreSame(this.focusedDOMNode, parent) || isAncestorIncludingParentFrames(this.focusedDOMNode, parent))) |
+ if (!updateBreadcrumbs && (this.focusedDOMNode === parent || isAncestor(this.focusedDOMNode, parent))) |
updateBreadcrumbs = true; |
} |
@@ -694,7 +535,7 @@ WebInspector.ElementsPanel.prototype = { |
var foundRoot = false; |
var crumb = crumbs.firstChild; |
while (crumb) { |
- if (objectsAreSame(crumb.representedObject, this.rootDOMNode)) |
+ if (crumb.representedObject === this.rootDOMNode) |
foundRoot = true; |
if (foundRoot) |
@@ -702,7 +543,7 @@ WebInspector.ElementsPanel.prototype = { |
else |
crumb.removeStyleClass("dimmed"); |
- if (objectsAreSame(crumb.representedObject, this.focusedDOMNode)) { |
+ if (crumb.representedObject === this.focusedDOMNode) { |
crumb.addStyleClass("selected"); |
handled = true; |
} else { |
@@ -755,11 +596,11 @@ WebInspector.ElementsPanel.prototype = { |
} |
foundRoot = false; |
- for (var current = this.focusedDOMNode; current; current = parentNodeOrFrameElement(current)) { |
+ for (var current = this.focusedDOMNode; current; current = current.parentNode) { |
if (current.nodeType === Node.DOCUMENT_NODE) |
continue; |
- if (objectsAreSame(current, this.rootDOMNode)) |
+ if (current === this.rootDOMNode) |
foundRoot = true; |
var crumb = document.createElement("span"); |
@@ -842,7 +683,7 @@ WebInspector.ElementsPanel.prototype = { |
if (foundRoot) |
crumb.addStyleClass("dimmed"); |
- if (objectsAreSame(current, this.focusedDOMNode)) |
+ if (current === this.focusedDOMNode) |
crumb.addStyleClass("selected"); |
if (!crumbs.childNodes.length) |
crumb.addStyleClass("end"); |
@@ -913,7 +754,7 @@ WebInspector.ElementsPanel.prototype = { |
{ |
var rightPadding = 20; |
var errorWarningElement = document.getElementById("error-warning-count"); |
- if (!WebInspector.console.visible && errorWarningElement) |
+ if (!WebInspector.drawer.visible && errorWarningElement) |
rightPadding += errorWarningElement.offsetWidth; |
return ((crumbs.totalOffsetLeft + crumbs.offsetWidth + rightPadding) < window.innerWidth); |
} |
@@ -1149,7 +990,8 @@ WebInspector.ElementsPanel.prototype = { |
switch (this.focusedDOMNode.nodeType) { |
case Node.ELEMENT_NODE: |
- var data = this.focusedDOMNode.outerHTML; |
+ // TODO: Introduce InspectorController.copyEvent that pushes appropriate markup into the clipboard. |
+ var data = null; |
break; |
case Node.COMMENT_NODE: |
@@ -1196,10 +1038,7 @@ WebInspector.ElementsPanel.prototype = { |
{ |
InspectorController.toggleNodeSearch(); |
- if (InspectorController.searchingForNode()) |
- this.nodeSearchButton.addStyleClass("toggled-on"); |
- else |
- this.nodeSearchButton.removeStyleClass("toggled-on"); |
+ this.nodeSearchButton.toggled = InspectorController.searchingForNode(); |
} |
} |