Chromium Code Reviews| 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 part of $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
| 6 | 6 |
| 7 class _ChildrenElementList extends ListBase<Element> | 7 class _ChildrenElementList extends ListBase<Element> |
| 8 implements NodeListWrapper { | 8 implements NodeListWrapper { |
| 9 // Raw Element. | 9 // Raw Element. |
| 10 final Element _element; | 10 final Element _element; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 throw new UnimplementedError(); | 90 throw new UnimplementedError(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void fillRange(int start, int end, [Element fillValue]) { | 93 void fillRange(int start, int end, [Element fillValue]) { |
| 94 throw new UnimplementedError(); | 94 throw new UnimplementedError(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 bool remove(Object object) { | 97 bool remove(Object object) { |
| 98 if (object is Element) { | 98 if (object is Element) { |
| 99 Element element = object; | 99 Element element = object; |
| 100 $if JSINTEROP | |
| 101 // We aren't preserving identity of nodes in JSINTEROP mode | |
| 102 if (element.parentNode == _element) { | |
| 103 $else | |
| 100 if (identical(element.parentNode, _element)) { | 104 if (identical(element.parentNode, _element)) { |
| 105 $endif | |
| 101 _element._removeChild(element); | 106 _element._removeChild(element); |
| 102 return true; | 107 return true; |
| 103 } | 108 } |
| 104 } | 109 } |
| 105 return false; | 110 return false; |
| 106 } | 111 } |
| 107 | 112 |
| 108 void insert(int index, Element element) { | 113 void insert(int index, Element element) { |
| 109 if (index < 0 || index > length) { | 114 if (index < 0 || index > length) { |
| 110 throw new RangeError.range(index, 0, length); | 115 throw new RangeError.range(index, 0, length); |
| (...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1252 @Experimental() | 1257 @Experimental() |
| 1253 Point offsetTo(Element parent) { | 1258 Point offsetTo(Element parent) { |
| 1254 return Element._offsetToHelper(this, parent); | 1259 return Element._offsetToHelper(this, parent); |
| 1255 } | 1260 } |
| 1256 | 1261 |
| 1257 static Point _offsetToHelper(Element current, Element parent) { | 1262 static Point _offsetToHelper(Element current, Element parent) { |
| 1258 // We're hopping from _offsetParent_ to offsetParent (not just parent), so | 1263 // We're hopping from _offsetParent_ to offsetParent (not just parent), so |
| 1259 // offsetParent, "tops out" at BODY. But people could conceivably pass in | 1264 // offsetParent, "tops out" at BODY. But people could conceivably pass in |
| 1260 // the document.documentElement and I want it to return an absolute offset, | 1265 // the document.documentElement and I want it to return an absolute offset, |
| 1261 // so we have the special case checking for HTML. | 1266 // so we have the special case checking for HTML. |
| 1262 bool foundAsParent = identical(current, parent) || parent.tagName == 'HTML'; | 1267 $if JSINTEROP |
|
terry
2015/08/17 14:40:29
Comment?
// We aren't preserving identity of node
| |
| 1263 if (current == null || identical(current, parent)) { | 1268 bool sameAsParent = current == parent; |
| 1269 $else | |
| 1270 bool sameAsParent = identical(current, parent); | |
| 1271 $endif | |
| 1272 bool foundAsParent = sameAsParent || parent.tagName == 'HTML'; | |
| 1273 if (current == null || sameAsParent) { | |
| 1264 if (foundAsParent) return new Point(0, 0); | 1274 if (foundAsParent) return new Point(0, 0); |
| 1265 throw new ArgumentError("Specified element is not a transitive offset " | 1275 throw new ArgumentError("Specified element is not a transitive offset " |
| 1266 "parent of this element."); | 1276 "parent of this element."); |
| 1267 } | 1277 } |
| 1268 Element parentOffset = current.offsetParent; | 1278 Element parentOffset = current.offsetParent; |
| 1269 Point p = Element._offsetToHelper(parentOffset, parent); | 1279 Point p = Element._offsetToHelper(parentOffset, parent); |
| 1270 return new Point(p.x + current.offsetLeft, p.y + current.offsetTop); | 1280 return new Point(p.x + current.offsetLeft, p.y + current.offsetTop); |
| 1271 } | 1281 } |
| 1272 | 1282 |
| 1273 static HtmlDocument _parseDocument; | 1283 static HtmlDocument _parseDocument; |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1670 const ScrollAlignment._internal(this._value); | 1680 const ScrollAlignment._internal(this._value); |
| 1671 toString() => 'ScrollAlignment.$_value'; | 1681 toString() => 'ScrollAlignment.$_value'; |
| 1672 | 1682 |
| 1673 /// Attempt to align the element to the top of the scrollable area. | 1683 /// Attempt to align the element to the top of the scrollable area. |
| 1674 static const TOP = const ScrollAlignment._internal('TOP'); | 1684 static const TOP = const ScrollAlignment._internal('TOP'); |
| 1675 /// Attempt to center the element in the scrollable area. | 1685 /// Attempt to center the element in the scrollable area. |
| 1676 static const CENTER = const ScrollAlignment._internal('CENTER'); | 1686 static const CENTER = const ScrollAlignment._internal('CENTER'); |
| 1677 /// Attempt to align the element to the bottom of the scrollable area. | 1687 /// Attempt to align the element to the bottom of the scrollable area. |
| 1678 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); | 1688 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); |
| 1679 } | 1689 } |
| OLD | NEW |