| Index: chrome/tools/test/reference_build/chrome_linux/resources/inspector/treeoutline.js
|
| diff --git a/chrome/tools/test/reference_build/chrome_linux/resources/inspector/treeoutline.js b/chrome/tools/test/reference_build/chrome_linux/resources/inspector/treeoutline.js
|
| index 579e7fb030540fdc5f39f251d7935fbfa8211318..ecc322b9725f6149a5bc315a190c11e19321d701 100644
|
| --- a/chrome/tools/test/reference_build/chrome_linux/resources/inspector/treeoutline.js
|
| +++ b/chrome/tools/test/reference_build/chrome_linux/resources/inspector/treeoutline.js
|
| @@ -249,35 +249,40 @@ TreeOutline.prototype._forgetChildrenRecursive = function(parentElement)
|
| }
|
| }
|
|
|
| -TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, getParent, equal)
|
| +TreeOutline.prototype.getCachedTreeElement = function(representedObject)
|
| {
|
| 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];
|
| }
|
| }
|
| + return null;
|
| +}
|
|
|
| - if (!isAncestor || !(isAncestor instanceof Function) || !getParent || !(getParent instanceof Function))
|
| +TreeOutline.prototype.findTreeElement = function(representedObject, isAncestor, getParent)
|
| +{
|
| + if (!representedObject)
|
| return null;
|
|
|
| + var cachedElement = this.getCachedTreeElement(representedObject);
|
| + if (cachedElement)
|
| + return cachedElement;
|
| +
|
| // The representedObject isn't know, so we start at the top of the tree and work down to find the first
|
| // tree element that represents representedObject or one of its ancestors.
|
| var item;
|
| 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 +297,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 +306,16 @@ 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.getCachedTreeElement(representedObject);
|
| }
|
|
|
| TreeOutline.prototype.treeElementFromPoint = function(x, y)
|
|
|