| 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(); |
| 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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 { | 526 { |
| 518 if (!condition) { | 527 if (!condition) { |
| 519 console.trace(); | 528 console.trace(); |
| 520 throw new Error(message); | 529 throw new Error(message); |
| 521 } | 530 } |
| 522 } | 531 } |
| 523 | 532 |
| 524 /** | 533 /** |
| 525 * @constructor | 534 * @constructor |
| 526 * @extends {WebInspector.View} | 535 * @extends {WebInspector.View} |
| 536 * @param {boolean=} isWebComponent |
| 527 */ | 537 */ |
| 528 WebInspector.VBox = function() | 538 WebInspector.VBox = function(isWebComponent) |
| 529 { | 539 { |
| 530 WebInspector.View.call(this); | 540 WebInspector.View.call(this, isWebComponent); |
| 531 this.element.classList.add("vbox"); | 541 this.contentElement.classList.add("vbox"); |
| 532 }; | 542 }; |
| 533 | 543 |
| 534 WebInspector.VBox.prototype = { | 544 WebInspector.VBox.prototype = { |
| 535 /** | 545 /** |
| 536 * @return {!Constraints} | 546 * @return {!Constraints} |
| 537 */ | 547 */ |
| 538 calculateConstraints: function() | 548 calculateConstraints: function() |
| 539 { | 549 { |
| 540 var constraints = new Constraints(new Size(0, 0)); | 550 var constraints = new Constraints(new Size(0, 0)); |
| 541 | 551 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 553 this._callOnVisibleChildren(updateForChild); | 563 this._callOnVisibleChildren(updateForChild); |
| 554 return constraints; | 564 return constraints; |
| 555 }, | 565 }, |
| 556 | 566 |
| 557 __proto__: WebInspector.View.prototype | 567 __proto__: WebInspector.View.prototype |
| 558 }; | 568 }; |
| 559 | 569 |
| 560 /** | 570 /** |
| 561 * @constructor | 571 * @constructor |
| 562 * @extends {WebInspector.View} | 572 * @extends {WebInspector.View} |
| 573 * @param {boolean=} isWebComponent |
| 563 */ | 574 */ |
| 564 WebInspector.HBox = function() | 575 WebInspector.HBox = function(isWebComponent) |
| 565 { | 576 { |
| 566 WebInspector.View.call(this); | 577 WebInspector.View.call(this, isWebComponent); |
| 567 this.element.classList.add("hbox"); | 578 this.contentElement.classList.add("hbox"); |
| 568 }; | 579 }; |
| 569 | 580 |
| 570 WebInspector.HBox.prototype = { | 581 WebInspector.HBox.prototype = { |
| 571 /** | 582 /** |
| 572 * @return {!Constraints} | 583 * @return {!Constraints} |
| 573 */ | 584 */ |
| 574 calculateConstraints: function() | 585 calculateConstraints: function() |
| 575 { | 586 { |
| 576 var constraints = new Constraints(new Size(0, 0)); | 587 var constraints = new Constraints(new Size(0, 0)); |
| 577 | 588 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 { | 656 { |
| 646 WebInspector.View.__assert(!child.__viewCounter && !child.__view, "Attempt t
o remove element containing view via regular DOM operation"); | 657 WebInspector.View.__assert(!child.__viewCounter && !child.__view, "Attempt t
o remove element containing view via regular DOM operation"); |
| 647 return WebInspector.View._originalRemoveChild.call(this, child); | 658 return WebInspector.View._originalRemoveChild.call(this, child); |
| 648 } | 659 } |
| 649 | 660 |
| 650 Element.prototype.removeChildren = function() | 661 Element.prototype.removeChildren = function() |
| 651 { | 662 { |
| 652 WebInspector.View.__assert(!this.__viewCounter, "Attempt to remove element c
ontaining view via regular DOM operation"); | 663 WebInspector.View.__assert(!this.__viewCounter, "Attempt to remove element c
ontaining view via regular DOM operation"); |
| 653 WebInspector.View._originalRemoveChildren.call(this); | 664 WebInspector.View._originalRemoveChildren.call(this); |
| 654 } | 665 } |
| OLD | NEW |