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

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

Issue 2180853003: DevTools: follow up to the widget hierarchy change, account for local widget reparending. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/components/widget-events-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2011 Google Inc. All Rights Reserved. 3 * Copyright (C) 2011 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 { 249 {
250 var currentParent = parentElement; 250 var currentParent = parentElement;
251 while (currentParent && !currentParent.__widget) 251 while (currentParent && !currentParent.__widget)
252 currentParent = currentParent.parentElementOrShadowHost(); 252 currentParent = currentParent.parentElementOrShadowHost();
253 253
254 if (this._isRoot) 254 if (this._isRoot)
255 WebInspector.Widget.__assert(!currentParent, "Attempt to show root w idget under another widget"); 255 WebInspector.Widget.__assert(!currentParent, "Attempt to show root w idget under another widget");
256 else 256 else
257 WebInspector.Widget.__assert(currentParent && currentParent.__widget === this._parentWidget, "Attempt to show under node belonging to alien widget") ; 257 WebInspector.Widget.__assert(currentParent && currentParent.__widget === this._parentWidget, "Attempt to show under node belonging to alien widget") ;
258 258
259 if (this._visible) 259 var wasVisible = this._visible;
260 if (wasVisible && this.element.parentElement === parentElement)
260 return; 261 return;
262
261 this._visible = true; 263 this._visible = true;
262 264
263 if (this._parentIsShowing()) 265 if (!wasVisible && this._parentIsShowing())
264 this._processWillShow(); 266 this._processWillShow();
265 267
266 this.element.classList.remove("hidden"); 268 this.element.classList.remove("hidden");
267 269
268 // Reparent 270 // Reparent
269 if (this.element.parentElement !== parentElement) { 271 if (this.element.parentElement !== parentElement) {
270 WebInspector.Widget._incrementWidgetCounter(parentElement, this.elem ent); 272 WebInspector.Widget._incrementWidgetCounter(parentElement, this.elem ent);
271 if (insertBefore) 273 if (insertBefore)
272 WebInspector.Widget._originalInsertBefore.call(parentElement, th is.element, insertBefore); 274 WebInspector.Widget._originalInsertBefore.call(parentElement, th is.element, insertBefore);
273 else 275 else
274 WebInspector.Widget._originalAppendChild.call(parentElement, thi s.element); 276 WebInspector.Widget._originalAppendChild.call(parentElement, thi s.element);
275 } 277 }
276 278
277 if (this._parentIsShowing()) 279 if (!wasVisible && this._parentIsShowing())
278 this._processWasShown(); 280 this._processWasShown();
279 281
280 if (this._parentWidget && this._hasNonZeroConstraints()) 282 if (this._parentWidget && this._hasNonZeroConstraints())
281 this._parentWidget.invalidateConstraints(); 283 this._parentWidget.invalidateConstraints();
282 else 284 else
283 this._processOnResize(); 285 this._processOnResize();
284 }, 286 },
285 287
286 hideWidget: function() 288 hideWidget: function()
287 { 289 {
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 { 785 {
784 WebInspector.Widget.__assert(!child.__widgetCounter && !child.__widget, "Att empt to remove element containing widget via regular DOM operation"); 786 WebInspector.Widget.__assert(!child.__widgetCounter && !child.__widget, "Att empt to remove element containing widget via regular DOM operation");
785 return WebInspector.Widget._originalRemoveChild.call(this, child); 787 return WebInspector.Widget._originalRemoveChild.call(this, child);
786 } 788 }
787 789
788 Element.prototype.removeChildren = function() 790 Element.prototype.removeChildren = function()
789 { 791 {
790 WebInspector.Widget.__assert(!this.__widgetCounter, "Attempt to remove eleme nt containing widget via regular DOM operation"); 792 WebInspector.Widget.__assert(!this.__widgetCounter, "Attempt to remove eleme nt containing widget via regular DOM operation");
791 WebInspector.Widget._originalRemoveChildren.call(this); 793 WebInspector.Widget._originalRemoveChildren.call(this);
792 } 794 }
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/components/widget-events-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698