| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // TODO(jacobr): use _Lists.dart to remove some of the duplicated | 5 // TODO(jacobr): use _Lists.dart to remove some of the duplicated |
| 6 // functionality. | 6 // functionality. |
| 7 class _ChildrenElementList implements ElementList { | 7 class _ChildrenElementList implements ElementList { |
| 8 // Raw Element. | 8 // Raw Element. |
| 9 final _ElementImpl _element; | 9 final _ElementImpl _element; |
| 10 final _HTMLCollectionImpl _childElements; | 10 final _HTMLCollectionImpl _childElements; |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 * All your element measurement needs in one place | 617 * All your element measurement needs in one place |
| 618 * @domName none | 618 * @domName none |
| 619 */ | 619 */ |
| 620 class _ElementRectImpl implements ElementRect { | 620 class _ElementRectImpl implements ElementRect { |
| 621 final ClientRect client; | 621 final ClientRect client; |
| 622 final ClientRect offset; | 622 final ClientRect offset; |
| 623 final ClientRect scroll; | 623 final ClientRect scroll; |
| 624 | 624 |
| 625 // TODO(jacobr): should we move these outside of ElementRect to avoid the | 625 // TODO(jacobr): should we move these outside of ElementRect to avoid the |
| 626 // overhead of computing them every time even though they are rarely used. | 626 // overhead of computing them every time even though they are rarely used. |
| 627 final _ClientRectImpl _boundingClientRect; | 627 final _ClientRectImpl _boundingClientRect; |
| 628 final _ClientRectListImpl _clientRects; | 628 final _ClientRectListImpl _clientRects; |
| 629 | 629 |
| 630 _ElementRectImpl(_ElementImpl element) : | 630 _ElementRectImpl(_ElementImpl element) : |
| 631 client = new _SimpleClientRect(element.$dom_clientLeft, | 631 client = new _SimpleClientRect(element.$dom_clientLeft, |
| 632 element.$dom_clientTop, | 632 element.$dom_clientTop, |
| 633 element.$dom_clientWidth, | 633 element.$dom_clientWidth, |
| 634 element.$dom_clientHeight), | 634 element.$dom_clientHeight), |
| 635 offset = new _SimpleClientRect(element.$dom_offsetLeft, | 635 offset = new _SimpleClientRect(element.$dom_offsetLeft, |
| 636 element.$dom_offsetTop, | 636 element.$dom_offsetTop, |
| 637 element.$dom_offsetWidth, | 637 element.$dom_offsetWidth, |
| 638 element.$dom_offsetHeight), | 638 element.$dom_offsetHeight), |
| 639 scroll = new _SimpleClientRect(element.$dom_scrollLeft, | 639 scroll = new _SimpleClientRect(element.$dom_scrollLeft, |
| 640 element.$dom_scrollTop, | 640 element.$dom_scrollTop, |
| 641 element.$dom_scrollWidth, | 641 element.$dom_scrollWidth, |
| 642 element.$dom_scrollHeight), | 642 element.$dom_scrollHeight), |
| 643 _boundingClientRect = element.$dom_getBoundingClientRect(), | 643 _boundingClientRect = element.$dom_getBoundingClientRect(), |
| 644 _clientRects = element.$dom_getClientRects(); | 644 _clientRects = element.$dom_getClientRects(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 // TODO(jacobr): last param should be null, see b/5045788 | 713 // TODO(jacobr): last param should be null, see b/5045788 |
| 714 return getComputedStyle(''); | 714 return getComputedStyle(''); |
| 715 } | 715 } |
| 716 | 716 |
| 717 Future<CSSStyleDeclaration> getComputedStyle(String pseudoElement) { | 717 Future<CSSStyleDeclaration> getComputedStyle(String pseudoElement) { |
| 718 return _createMeasurementFuture( | 718 return _createMeasurementFuture( |
| 719 () => _window.$dom_getComputedStyle(this, pseudoElement), | 719 () => _window.$dom_getComputedStyle(this, pseudoElement), |
| 720 new Completer<CSSStyleDeclaration>()); | 720 new Completer<CSSStyleDeclaration>()); |
| 721 } | 721 } |
| 722 | 722 |
| 723 void addText(String text) { |
| 724 this.insertAdjacentText('beforeend', text); |
| 725 } |
| 726 |
| 727 void addHTML(String text) { |
| 728 this.insertAdjacentHTML('beforeend', text); |
| 729 } |
| 730 |
| 723 // Hooks to support custom WebComponents. | 731 // Hooks to support custom WebComponents. |
| 724 var xtag; | 732 var xtag; |
| 725 | 733 |
| 726 $if DARTIUM | 734 $if DARTIUM |
| 727 noSuchMethod(String name, List args) { | 735 noSuchMethod(String name, List args) { |
| 728 if (dynamicUnknownElementDispatcher == null) { | 736 if (dynamicUnknownElementDispatcher == null) { |
| 729 throw new NoSuchMethodException(this, name, args); | 737 throw new NoSuchMethodException(this, name, args); |
| 730 } else { | 738 } else { |
| 731 return dynamicUnknownElementDispatcher(this, name, args); | 739 return dynamicUnknownElementDispatcher(this, name, args); |
| 732 } | 740 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 | 803 |
| 796 /** @domName Document.createElement */ | 804 /** @domName Document.createElement */ |
| 797 $if DART2JS | 805 $if DART2JS |
| 798 // Optimization to improve performance until the dart2js compiler inlines this | 806 // Optimization to improve performance until the dart2js compiler inlines this |
| 799 // method. | 807 // method. |
| 800 factory Element.tag(String tag) native "return document.createElement(tag)"; | 808 factory Element.tag(String tag) native "return document.createElement(tag)"; |
| 801 $else | 809 $else |
| 802 factory Element.tag(String tag) => _document.$dom_createElement(tag); | 810 factory Element.tag(String tag) => _document.$dom_createElement(tag); |
| 803 $endif | 811 $endif |
| 804 } | 812 } |
| OLD | NEW |