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

Side by Side Diff: Source/devtools/front_end/ui/View.js

Issue 731093002: DevTools: Use View.registerRequiredCSS() in View-based web components (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « Source/devtools/front_end/ui/FlameChart.js ('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 22 matching lines...) Expand all
33 { 33 {
34 this.contentElement = createElementWithClass("div", "view"); 34 this.contentElement = createElementWithClass("div", "view");
35 if (isWebComponent) { 35 if (isWebComponent) {
36 WebInspector.installComponentRootStyles(this.contentElement); 36 WebInspector.installComponentRootStyles(this.contentElement);
37 this.element = createElementWithClass("div", "vbox flex-auto"); 37 this.element = createElementWithClass("div", "vbox flex-auto");
38 this._shadowRoot = this.element.createShadowRoot(); 38 this._shadowRoot = this.element.createShadowRoot();
39 this._shadowRoot.appendChild(this.contentElement); 39 this._shadowRoot.appendChild(this.contentElement);
40 } else { 40 } else {
41 this.element = this.contentElement; 41 this.element = this.contentElement;
42 } 42 }
43 this._isWebComponent = isWebComponent;
43 this.element.__view = this; 44 this.element.__view = this;
44 this._visible = true; 45 this._visible = true;
45 this._isRoot = false; 46 this._isRoot = false;
46 this._isShowing = false; 47 this._isShowing = false;
47 this._children = []; 48 this._children = [];
48 this._hideOnDetach = false; 49 this._hideOnDetach = false;
49 this._cssFiles = []; 50 this._cssFiles = [];
50 this._notificationDepth = 0; 51 this._notificationDepth = 0;
51 } 52 }
52 53
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 }, 356 },
356 357
357 doLayout: function() 358 doLayout: function()
358 { 359 {
359 if (!this.isShowing()) 360 if (!this.isShowing())
360 return; 361 return;
361 this._notify(this.onLayout); 362 this._notify(this.onLayout);
362 this.doResize(); 363 this.doResize();
363 }, 364 },
364 365
366 /**
367 * @param {string} cssFile
368 */
365 registerRequiredCSS: function(cssFile) 369 registerRequiredCSS: function(cssFile)
366 { 370 {
367 this.element.appendChild(WebInspector.View.createStyleElement(cssFile)); 371 (this._isWebComponent ? this._shadowRoot : this.element).appendChild(Web Inspector.View.createStyleElement(cssFile));
368 }, 372 },
369 373
370 printViewHierarchy: function() 374 printViewHierarchy: function()
371 { 375 {
372 var lines = []; 376 var lines = [];
373 this._collectViewHierarchy("", lines); 377 this._collectViewHierarchy("", lines);
374 console.log(lines.join("\n")); 378 console.log(lines.join("\n"));
375 }, 379 },
376 380
377 _collectViewHierarchy: function(prefix, lines) 381 _collectViewHierarchy: function(prefix, lines)
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 { 665 {
662 WebInspector.View.__assert(!child.__viewCounter && !child.__view, "Attempt t o remove element containing view via regular DOM operation"); 666 WebInspector.View.__assert(!child.__viewCounter && !child.__view, "Attempt t o remove element containing view via regular DOM operation");
663 return WebInspector.View._originalRemoveChild.call(this, child); 667 return WebInspector.View._originalRemoveChild.call(this, child);
664 } 668 }
665 669
666 Element.prototype.removeChildren = function() 670 Element.prototype.removeChildren = function()
667 { 671 {
668 WebInspector.View.__assert(!this.__viewCounter, "Attempt to remove element c ontaining view via regular DOM operation"); 672 WebInspector.View.__assert(!this.__viewCounter, "Attempt to remove element c ontaining view via regular DOM operation");
669 WebInspector.View._originalRemoveChildren.call(this); 673 WebInspector.View._originalRemoveChildren.call(this);
670 } 674 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/ui/FlameChart.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698