Commit 5f911460 authored by pfeldman's avatar pfeldman Committed by Commit bot

DevTools: follow up to the widget hierarchy change, account for local widget reparending.

Review-Url: https://codereview.chromium.org/2180853003
Cr-Commit-Position: refs/heads/master@{#407705}
parent ed1a0da4
......@@ -244,3 +244,15 @@ Parent()
Child()
Error: Attempt to show under node belonging to alien widget
Running: testReparentWithinWidget
Parent()
Parent.show()
Parent.wasShown()
Parent.onResize()
Child()
Child.show()
Child.wasShown()
Child.onResize()
Child.show()
Child.onResize()
......@@ -355,6 +355,18 @@ function test()
InspectorTest.addResult(e);
}
next();
},
function testReparentWithinWidget(next)
{
var parentWidget = new TestWidget("Parent");
parentWidget.show(WebInspector.inspectorView.element);
var childWidget = new TestWidget("Child");
var container1 = parentWidget.element.createChild("div");
var container2 = parentWidget.element.createChild("div");
childWidget.show(container1);
childWidget.show(container2);
next();
}
]);
}
......
......@@ -256,11 +256,13 @@ WebInspector.Widget.prototype = {
else
WebInspector.Widget.__assert(currentParent && currentParent.__widget === this._parentWidget, "Attempt to show under node belonging to alien widget");
if (this._visible)
var wasVisible = this._visible;
if (wasVisible && this.element.parentElement === parentElement)
return;
this._visible = true;
if (this._parentIsShowing())
if (!wasVisible && this._parentIsShowing())
this._processWillShow();
this.element.classList.remove("hidden");
......@@ -274,7 +276,7 @@ WebInspector.Widget.prototype = {
WebInspector.Widget._originalAppendChild.call(parentElement, this.element);
}
if (this._parentIsShowing())
if (!wasVisible && this._parentIsShowing())
this._processWasShown();
if (this._parentWidget && this._hasNonZeroConstraints())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment