Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/Widget.js

Issue 2570633004: DevTools: remove invalidateSize from Widget, make show/hideWidget receive no params. (Closed)
Patch Set: rebaselined Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/TabbedPane.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/ui/Widget.js
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/Widget.js b/third_party/WebKit/Source/devtools/front_end/ui/Widget.js
index b355d80f4024acf562547e207a58dc8ad25b1bf0..310f44c33c033e23aa47384b8c302fd5bd75b29e 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/Widget.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/Widget.js
@@ -258,30 +258,42 @@ UI.Widget = class extends Common.Object {
while (currentParent && !currentParent.__widget)
currentParent = currentParent.parentElementOrShadowHost();
UI.Widget.__assert(currentParent, 'Attempt to attach widget to orphan node');
- this.attach(currentParent.__widget);
+ this.attach(currentParent.__widget, parentElement, insertBefore);
+ } else {
+ this._attachedToParentElement = parentElement;
+ this._attachedBeforeElement = insertBefore;
}
- this.showWidget(parentElement, insertBefore);
+ this.showWidget();
}
/**
* @param {!UI.Widget} parentWidget
+ * @param {!Element} parentElement
+ * @param {?Element=} insertBefore
*/
- attach(parentWidget) {
- if (parentWidget === this._parentWidget)
+ attach(parentWidget, parentElement, insertBefore) {
caseq 2016/12/14 01:29:26 Let's avoid exposing this to the public interface,
pfeldman 2016/12/14 01:38:40 Done.
+ if (parentWidget === this._parentWidget) {
+ this._attachedToParentElement = parentElement;
+ this._attachedBeforeElement = insertBefore;
caseq 2016/12/14 01:29:25 s/Element/Node?
pfeldman 2016/12/14 01:38:40 Done.
+ if (this._visible)
+ this.showWidget();
return;
+ }
if (this._parentWidget)
this.detach();
this._parentWidget = parentWidget;
this._parentWidget._children.push(this);
+ this._attachedToParentElement = parentElement;
+ this._attachedBeforeElement = insertBefore;
this._isRoot = false;
}
- /**
- * @param {!Element} parentElement
- * @param {?Element=} insertBefore
- */
- showWidget(parentElement, insertBefore) {
+ showWidget() {
+ UI.Widget.__assert(this._parentWidget || this._isRoot, 'Attempt to show widget that has not been attached');
+ var parentElement = this._attachedToParentElement;
+ var insertBefore = this._attachedBeforeElement;
caseq 2016/12/14 01:29:26 Add a check that the element is not gone?
pfeldman 2016/12/14 01:38:40 Browser would throw if something like that happens
+
var currentParent = parentElement;
while (currentParent && !currentParent.__widget)
currentParent = currentParent.parentElementOrShadowHost();
@@ -324,8 +336,7 @@ UI.Widget = class extends Common.Object {
}
hideWidget() {
- if (!this._parentWidget)
- return;
+ UI.Widget.__assert(this._parentWidget || this._isRoot, 'Attempt to hide widget that has not been attached');
this._hideWidget();
}
@@ -337,6 +348,8 @@ UI.Widget = class extends Common.Object {
return;
this._visible = false;
var parentElement = this.element.parentElement;
+ this._attachedToParentElement = parentElement;
+ this._attachedBeforeElement = this.element.nextSibling;
if (this._parentIsShowing())
this._processWillHide();
@@ -376,6 +389,9 @@ UI.Widget = class extends Common.Object {
} else {
UI.Widget.__assert(this._isRoot, 'Removing non-root widget from DOM');
}
+
+ this._attachedToParentElement = null;
+ this._attachedBeforeElement = null;
}
detachChildWidgets() {
@@ -586,11 +602,6 @@ UI.Widget = class extends Common.Object {
else
this.doLayout();
}
-
- invalidateSize() {
- if (this._parentWidget)
- this._parentWidget.doLayout();
- }
};
UI.Widget._originalAppendChild = Element.prototype.appendChild;
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/TabbedPane.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698