diff options
Diffstat (limited to 'WebCore/inspector/front-end/treeoutline.js')
-rw-r--r-- | WebCore/inspector/front-end/treeoutline.js | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/WebCore/inspector/front-end/treeoutline.js b/WebCore/inspector/front-end/treeoutline.js index 579e7fb..67f35c2 100644 --- a/WebCore/inspector/front-end/treeoutline.js +++ b/WebCore/inspector/front-end/treeoutline.js @@ -249,21 +249,18 @@ TreeOutline.prototype._forgetChildrenRecursive = function(parentElement) } } -TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, getParent, equal) +TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, getParent) { if (!representedObject) return null; - if (!equal) - equal = function(a, b) { return a === b }; - if ("__treeElementIdentifier" in representedObject) { // If this representedObject has a tree element identifier, and it is a known TreeElement // in our tree we can just return that tree element. var elements = this._knownTreeElements[representedObject.__treeElementIdentifier]; if (elements) { for (var i = 0; i < elements.length; ++i) - if (equal(elements[i].representedObject, representedObject)) + if (elements[i].representedObject === representedObject) return elements[i]; } } @@ -277,7 +274,7 @@ TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, var found = false; for (var i = 0; i < this.children.length; ++i) { item = this.children[i]; - if (equal(item.representedObject, representedObject) || isAncestor(item.representedObject, representedObject)) { + if (item.representedObject === representedObject || isAncestor(item.representedObject, representedObject)) { found = true; break; } @@ -292,7 +289,7 @@ TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, var currentObject = representedObject; while (currentObject) { ancestors.unshift(currentObject); - if (equal(currentObject, item.representedObject)) + if (currentObject === item.representedObject) break; currentObject = getParent(currentObject); } @@ -301,18 +298,18 @@ TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, for (var i = 0; i < ancestors.length; ++i) { // Make sure we don't call findTreeElement with the same representedObject // again, to prevent infinite recursion. - if (equal(ancestors[i], representedObject)) + if (ancestors[i] === representedObject) continue; // FIXME: we could do something faster than findTreeElement since we will know the next // ancestor exists in the tree. - item = this.findTreeElement(ancestors[i], isAncestor, getParent, equal); + item = this.findTreeElement(ancestors[i], isAncestor, getParent); if (item && item.onpopulate) item.onpopulate(item); } // Now that all the ancestors are populated, try to find the representedObject again. This time // without the isAncestor and getParent functions to prevent an infinite recursion if it isn't found. - return this.findTreeElement(representedObject, null, null, equal); + return this.findTreeElement(representedObject); } TreeOutline.prototype.treeElementFromPoint = function(x, y) |