Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 |
| 11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
| 12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
| 13 * | 13 * |
| 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
| 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
| 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 /** | 27 /** |
| 28 * @constructor | 28 * @constructor |
| 29 * @extends {WebInspector.Object} | 29 * @extends {WebInspector.Object} |
| 30 * @param {boolean=} isWebComponent | |
| 30 */ | 31 */ |
| 31 WebInspector.View = function() | 32 WebInspector.View = function(isWebComponent) |
| 32 { | 33 { |
| 33 this.element = createElementWithClass("div", "view"); | 34 this.contentElement = createElementWithClass("div", "view"); |
| 35 if (isWebComponent) { | |
| 36 WebInspector.installComponentRootStyles(this.contentElement); | |
| 37 this.element = createElementWithClass("div", "vbox flex-auto"); | |
| 38 this._shadowRoot = this.element.createShadowRoot(); | |
|
yurys
2014/10/21 04:28:34
What's the point in having this property if we nev
pfeldman
2014/10/22 09:32:49
Lets leave it here for the tests. I ended up in ne
| |
| 39 this._shadowRoot.appendChild(this.contentElement); | |
| 40 } else { | |
| 41 this.element = this.contentElement; | |
| 42 } | |
| 34 this.element.__view = this; | 43 this.element.__view = this; |
| 35 this._visible = true; | 44 this._visible = true; |
| 36 this._isRoot = false; | 45 this._isRoot = false; |
| 37 this._isShowing = false; | 46 this._isShowing = false; |
| 38 this._children = []; | 47 this._children = []; |
| 39 this._hideOnDetach = false; | 48 this._hideOnDetach = false; |
| 40 this._cssFiles = []; | 49 this._cssFiles = []; |
| 41 this._notificationDepth = 0; | 50 this._notificationDepth = 0; |
| 42 } | 51 } |
| 43 | 52 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 61 } | 70 } |
| 62 var styleElement = createElement("style"); | 71 var styleElement = createElement("style"); |
| 63 styleElement.type = "text/css"; | 72 styleElement.type = "text/css"; |
| 64 styleElement.textContent = content; | 73 styleElement.textContent = content; |
| 65 return styleElement; | 74 return styleElement; |
| 66 } | 75 } |
| 67 | 76 |
| 68 WebInspector.View.prototype = { | 77 WebInspector.View.prototype = { |
| 69 markAsRoot: function() | 78 markAsRoot: function() |
| 70 { | 79 { |
| 71 this.element.classList.add("component-root"); | 80 WebInspector.installComponentRootStyles(this.element); |
| 72 WebInspector.View.__assert(!this.element.parentElement, "Attempt to mark as root attached node"); | 81 WebInspector.View.__assert(!this.element.parentElement, "Attempt to mark as root attached node"); |
| 73 this._isRoot = true; | 82 this._isRoot = true; |
| 74 }, | 83 }, |
| 75 | 84 |
| 76 /** | 85 /** |
| 77 * @return {?WebInspector.View} | 86 * @return {?WebInspector.View} |
| 78 */ | 87 */ |
| 79 parentView: function() | 88 parentView: function() |
| 80 { | 89 { |
| 81 return this._parentView; | 90 return this._parentView; |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 516 { | 525 { |
| 517 if (!condition) { | 526 if (!condition) { |
| 518 console.trace(); | 527 console.trace(); |
| 519 throw new Error(message); | 528 throw new Error(message); |
| 520 } | 529 } |
| 521 } | 530 } |
| 522 | 531 |
| 523 /** | 532 /** |
| 524 * @constructor | 533 * @constructor |
| 525 * @extends {WebInspector.View} | 534 * @extends {WebInspector.View} |
| 535 * @param {boolean=} isWebComponent | |
| 526 */ | 536 */ |
| 527 WebInspector.VBox = function() | 537 WebInspector.VBox = function(isWebComponent) |
| 528 { | 538 { |
| 529 WebInspector.View.call(this); | 539 WebInspector.View.call(this, isWebComponent); |
| 530 this.element.classList.add("vbox"); | 540 this.contentElement.classList.add("vbox"); |
| 531 }; | 541 }; |
| 532 | 542 |
| 533 WebInspector.VBox.prototype = { | 543 WebInspector.VBox.prototype = { |
| 534 /** | 544 /** |
| 535 * @return {!Constraints} | 545 * @return {!Constraints} |
| 536 */ | 546 */ |
| 537 calculateConstraints: function() | 547 calculateConstraints: function() |
| 538 { | 548 { |
| 539 var constraints = new Constraints(new Size(0, 0)); | 549 var constraints = new Constraints(new Size(0, 0)); |
| 540 | 550 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 552 this._callOnVisibleChildren(updateForChild); | 562 this._callOnVisibleChildren(updateForChild); |
| 553 return constraints; | 563 return constraints; |
| 554 }, | 564 }, |
| 555 | 565 |
| 556 __proto__: WebInspector.View.prototype | 566 __proto__: WebInspector.View.prototype |
| 557 }; | 567 }; |
| 558 | 568 |
| 559 /** | 569 /** |
| 560 * @constructor | 570 * @constructor |
| 561 * @extends {WebInspector.View} | 571 * @extends {WebInspector.View} |
| 572 * @param {boolean=} isWebComponent | |
| 562 */ | 573 */ |
| 563 WebInspector.HBox = function() | 574 WebInspector.HBox = function(isWebComponent) |
| 564 { | 575 { |
| 565 WebInspector.View.call(this); | 576 WebInspector.View.call(this, isWebComponent); |
| 566 this.element.classList.add("hbox"); | 577 this.contentElement.classList.add("hbox"); |
| 567 }; | 578 }; |
| 568 | 579 |
| 569 WebInspector.HBox.prototype = { | 580 WebInspector.HBox.prototype = { |
| 570 /** | 581 /** |
| 571 * @return {!Constraints} | 582 * @return {!Constraints} |
| 572 */ | 583 */ |
| 573 calculateConstraints: function() | 584 calculateConstraints: function() |
| 574 { | 585 { |
| 575 var constraints = new Constraints(new Size(0, 0)); | 586 var constraints = new Constraints(new Size(0, 0)); |
| 576 | 587 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 644 { | 655 { |
| 645 WebInspector.View.__assert(!child.__viewCounter && !child.__view, "Attempt t o remove element containing view via regular DOM operation"); | 656 WebInspector.View.__assert(!child.__viewCounter && !child.__view, "Attempt t o remove element containing view via regular DOM operation"); |
| 646 return WebInspector.View._originalRemoveChild.call(this, child); | 657 return WebInspector.View._originalRemoveChild.call(this, child); |
| 647 } | 658 } |
| 648 | 659 |
| 649 Element.prototype.removeChildren = function() | 660 Element.prototype.removeChildren = function() |
| 650 { | 661 { |
| 651 WebInspector.View.__assert(!this.__viewCounter, "Attempt to remove element c ontaining view via regular DOM operation"); | 662 WebInspector.View.__assert(!this.__viewCounter, "Attempt to remove element c ontaining view via regular DOM operation"); |
| 652 WebInspector.View._originalRemoveChildren.call(this); | 663 WebInspector.View._originalRemoveChildren.call(this); |
| 653 } | 664 } |
| OLD | NEW |