Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1157)

Side by Side Diff: tools/dom/templates/html/impl/impl_Element.darttemplate

Issue 24267028: Try caching attribute map to try to improve performance. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Raw Element. 8 // Raw Element.
9 final Element _element; 9 final Element _element;
10 final HtmlCollection _childElements; 10 final HtmlCollection _childElements;
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 /// Creates a new `<ul>` element. 493 /// Creates a new `<ul>` element.
494 /// 494 ///
495 /// This is identical to calling `new Element.tag('ul')`. 495 /// This is identical to calling `new Element.tag('ul')`.
496 factory Element.ul() => new Element.tag('ul'); 496 factory Element.ul() => new Element.tag('ul');
497 497
498 /// Creates a new `<video>` element. 498 /// Creates a new `<video>` element.
499 /// 499 ///
500 /// This is identical to calling `new Element.tag('video')`. 500 /// This is identical to calling `new Element.tag('video')`.
501 factory Element.video() => new Element.tag('video'); 501 factory Element.video() => new Element.tag('video');
502 502
503 Map<String, String> _cachedAttributeMap;
503 /** 504 /**
504 * All attributes on this element. 505 * All attributes on this element.
505 * 506 *
506 * Any modifications to the attribute map will automatically be applied to 507 * Any modifications to the attribute map will automatically be applied to
507 * this element. 508 * this element.
508 * 509 *
509 * This only includes attributes which are not in a namespace 510 * This only includes attributes which are not in a namespace
510 * (such as 'xlink:href'), additional attributes can be accessed via 511 * (such as 'xlink:href'), additional attributes can be accessed via
511 * [getNamespacedAttributes]. 512 * [getNamespacedAttributes].
512 */ 513 */
513 Map<String, String> get attributes => new _ElementAttributeMap(this); 514 Map<String, String> get attributes {
515 if (_cachedAttributeMap == null) {
516 _cachedAttributeMap = new _ElementAttributeMap(this);
517 }
518 return _cachedAttributeMap;
519 }
514 520
515 void set attributes(Map<String, String> value) { 521 void set attributes(Map<String, String> value) {
516 Map<String, String> attributes = this.attributes; 522 Map<String, String> attributes = this.attributes;
517 attributes.clear(); 523 attributes.clear();
518 for (String key in value.keys) { 524 for (String key in value.keys) {
519 attributes[key] = value[key]; 525 attributes[key] = value[key];
520 } 526 }
521 } 527 }
522 528
523 /** 529 /**
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 const ScrollAlignment._internal(this._value); 1359 const ScrollAlignment._internal(this._value);
1354 toString() => 'ScrollAlignment.$_value'; 1360 toString() => 'ScrollAlignment.$_value';
1355 1361
1356 /// Attempt to align the element to the top of the scrollable area. 1362 /// Attempt to align the element to the top of the scrollable area.
1357 static const TOP = const ScrollAlignment._internal('TOP'); 1363 static const TOP = const ScrollAlignment._internal('TOP');
1358 /// Attempt to center the element in the scrollable area. 1364 /// Attempt to center the element in the scrollable area.
1359 static const CENTER = const ScrollAlignment._internal('CENTER'); 1365 static const CENTER = const ScrollAlignment._internal('CENTER');
1360 /// Attempt to align the element to the bottom of the scrollable area. 1366 /// Attempt to align the element to the bottom of the scrollable area.
1361 static const BOTTOM = const ScrollAlignment._internal('BOTTOM'); 1367 static const BOTTOM = const ScrollAlignment._internal('BOTTOM');
1362 } 1368 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698