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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 CssRect get marginEdge; | 257 CssRect get marginEdge; |
258 $!STREAM_GETTER_SIGNATURES | 258 $!STREAM_GETTER_SIGNATURES |
259 } | 259 } |
260 | 260 |
261 // Wrapper over an immutable NodeList to make it implement ElementList. | 261 // Wrapper over an immutable NodeList to make it implement ElementList. |
262 // | 262 // |
263 // Clients are {`Document`, `DocumentFragment`}.`querySelectorAll` which are | 263 // Clients are {`Document`, `DocumentFragment`}.`querySelectorAll` which are |
264 // declared to return `ElementList`. This provides all the static analysis | 264 // declared to return `ElementList`. This provides all the static analysis |
265 // benefit so there is no need for this class have a constrained type parameter. | 265 // benefit so there is no need for this class have a constrained type parameter. |
266 // | 266 // |
267 class _FrozenElementList extends ListBase | 267 class _FrozenElementList extends ListBase<Element> |
268 implements ElementList, NodeListWrapper { | 268 implements ElementList<Element>, NodeListWrapper { |
269 final List<Node> _nodeList; | 269 final List<Node> _nodeList; |
270 | 270 |
271 $if JSINTEROP | 271 $if JSINTEROP |
272 var dartClass_instance; | 272 var dartClass_instance; |
273 | 273 |
274 _FrozenElementList._wrap(this._nodeList) { | 274 _FrozenElementList._wrap(this._nodeList) { |
275 this.dartClass_instance = this._nodeList; | 275 this.dartClass_instance = this._nodeList; |
276 } | 276 } |
277 $else | 277 $else |
278 _FrozenElementList._wrap(this._nodeList); | 278 _FrozenElementList._wrap(this._nodeList); |
(...skipping 30 matching lines...) Expand all Loading... |
309 CssStyleDeclarationBase get style => | 309 CssStyleDeclarationBase get style => |
310 new _CssStyleDeclarationSet(this); | 310 new _CssStyleDeclarationSet(this); |
311 | 311 |
312 set classes(Iterable<String> value) { | 312 set classes(Iterable<String> value) { |
313 // TODO(sra): This might be faster for Sets: | 313 // TODO(sra): This might be faster for Sets: |
314 // | 314 // |
315 // new _MultiElementCssClassSet(this).writeClasses(value) | 315 // new _MultiElementCssClassSet(this).writeClasses(value) |
316 // | 316 // |
317 // as the code below converts the Iterable[value] to a string multiple | 317 // as the code below converts the Iterable[value] to a string multiple |
318 // times. Maybe compute the string and set className here. | 318 // times. Maybe compute the string and set className here. |
319 _nodeList.forEach((e) => e.classes = value); | 319 forEach((e) => e.classes = value); |
320 } | 320 } |
321 | 321 |
322 CssRect get contentEdge => new _ContentCssListRect(this); | 322 CssRect get contentEdge => new _ContentCssListRect(this); |
323 | 323 |
324 CssRect get paddingEdge => this.first.paddingEdge; | 324 CssRect get paddingEdge => this.first.paddingEdge; |
325 | 325 |
326 CssRect get borderEdge => this.first.borderEdge; | 326 CssRect get borderEdge => this.first.borderEdge; |
327 | 327 |
328 CssRect get marginEdge => this.first.marginEdge; | 328 CssRect get marginEdge => this.first.marginEdge; |
329 | 329 |
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1326 throw new ArgumentError( | 1326 throw new ArgumentError( |
1327 'validator can only be passed if treeSanitizer is null'); | 1327 'validator can only be passed if treeSanitizer is null'); |
1328 } | 1328 } |
1329 | 1329 |
1330 if (_parseDocument == null) { | 1330 if (_parseDocument == null) { |
1331 _parseDocument = document.implementation.createHtmlDocument(''); | 1331 _parseDocument = document.implementation.createHtmlDocument(''); |
1332 _parseRange = _parseDocument.createRange(); | 1332 _parseRange = _parseDocument.createRange(); |
1333 | 1333 |
1334 // Workaround for Safari bug. Was also previously Chrome bug 229142 | 1334 // Workaround for Safari bug. Was also previously Chrome bug 229142 |
1335 // - URIs are not resolved in new doc. | 1335 // - URIs are not resolved in new doc. |
1336 var base = _parseDocument.createElement('base'); | 1336 BaseElement base = _parseDocument.createElement('base'); |
1337 base.href = document.baseUri; | 1337 base.href = document.baseUri; |
1338 _parseDocument.head.append(base); | 1338 _parseDocument.head.append(base); |
1339 } | 1339 } |
1340 var contextElement; | 1340 var contextElement; |
1341 if (this is BodyElement) { | 1341 if (this is BodyElement) { |
1342 contextElement = _parseDocument.body; | 1342 contextElement = _parseDocument.body; |
1343 } else { | 1343 } else { |
1344 contextElement = _parseDocument.createElement(tagName); | 1344 contextElement = _parseDocument.createElement(tagName); |
1345 _parseDocument.body.append(contextElement); | 1345 _parseDocument.body.append(contextElement); |
1346 } | 1346 } |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1670 const ScrollAlignment._internal(this._value); | 1670 const ScrollAlignment._internal(this._value); |
1671 toString() => 'ScrollAlignment.$_value'; | 1671 toString() => 'ScrollAlignment.$_value'; |
1672 | 1672 |
1673 /// Attempt to align the element to the top of the scrollable area. | 1673 /// Attempt to align the element to the top of the scrollable area. |
1674 static const TOP = const ScrollAlignment._internal('TOP'); | 1674 static const TOP = const ScrollAlignment._internal('TOP'); |
1675 /// Attempt to center the element in the scrollable area. | 1675 /// Attempt to center the element in the scrollable area. |
1676 static const CENTER = const ScrollAlignment._internal('CENTER'); | 1676 static const CENTER = const ScrollAlignment._internal('CENTER'); |
1677 /// Attempt to align the element to the bottom of the scrollable area. | 1677 /// Attempt to align the element to the bottom of the scrollable area. |
1678 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); | 1678 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); |
1679 } | 1679 } |
OLD | NEW |