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

Side by Side Diff: pkg/polymer/lib/src/declaration.dart

Issue 588373003: Update to polymer js version 0.4.1 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: review updates Created 6 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 | « pkg/polymer/CHANGELOG.md ('k') | pkg/polymer/lib/src/instance.dart » ('j') | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 polymer; 5 part of polymer;
6 6
7 /// *Warning* this class is experimental and subject to change. 7 /// *Warning* this class is experimental and subject to change.
8 /// 8 ///
9 /// The data associated with a polymer-element declaration, if it is backed 9 /// The data associated with a polymer-element declaration, if it is backed
10 /// by a Dart class instead of a JavaScript prototype. 10 /// by a Dart class instead of a JavaScript prototype.
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 map['$path'.toLowerCase()] = value; 455 map['$path'.toLowerCase()] = value;
456 }); 456 });
457 return map; 457 return map;
458 } 458 }
459 459
460 void createPropertyAccessors() { 460 void createPropertyAccessors() {
461 // Dart note: since we don't have a prototype in Dart, most of the work of 461 // Dart note: since we don't have a prototype in Dart, most of the work of
462 // createPolymerAccessors is done lazily on the first access of properties. 462 // createPolymerAccessors is done lazily on the first access of properties.
463 // Here we just extract the information from annotations and store it as 463 // Here we just extract the information from annotations and store it as
464 // properties on the declaration. 464 // properties on the declaration.
465
466 // Dart Note: The js side makes computed properties read only, and does
467 // special logic right here for them. For us they are automatically read
468 // only unless you define a setter for them, so we left that out.
465 var options = const smoke.QueryOptions(includeInherited: true, 469 var options = const smoke.QueryOptions(includeInherited: true,
466 includeUpTo: HtmlElement, withAnnotations: const [ComputedProperty]); 470 includeUpTo: HtmlElement, withAnnotations: const [ComputedProperty]);
467 var existing = {}; 471 var existing = {};
468 for (var decl in smoke.query(type, options)) { 472 for (var decl in smoke.query(type, options)) {
469 var meta = decl.annotations.firstWhere((e) => e is ComputedProperty); 473 var meta = decl.annotations.firstWhere((e) => e is ComputedProperty);
470 var name = decl.name; 474 var name = decl.name;
471 var prev = existing[name]; 475 var prev = existing[name];
472 // The definition of a child class takes priority. 476 // The definition of a child class takes priority.
473 if (prev == null || smoke.isSubclassOf(decl.type, prev.type)) { 477 if (prev == null || smoke.isSubclassOf(decl.type, prev.type)) {
474 _computed[name] = meta.expression; 478 _computed[name] = meta.expression;
475 existing[name] = decl; 479 existing[name] = decl;
476 } 480 }
477 } 481 }
478 } 482 }
479 } 483 }
480 484
481 /// maps tag names to prototypes 485 /// maps tag names to prototypes
482 final Map _typesByName = new Map<String, Type>(); 486 final Map _typesByName = new Map<String, Type>();
483 487
484 Type _getRegisteredType(String name) => _typesByName[name]; 488 Type _getRegisteredType(String name) => _typesByName[name];
485 489
490 /// Dart Note: instanceOfType not implemented for dart, its not needed.
491
486 /// track document.register'ed tag names and their declarations 492 /// track document.register'ed tag names and their declarations
487 final Map _declarations = new Map<String, PolymerDeclaration>(); 493 final Map _declarations = new Map<String, PolymerDeclaration>();
488 494
489 bool _isRegistered(String name) => _declarations.containsKey(name); 495 bool _isRegistered(String name) => _declarations.containsKey(name);
490 PolymerDeclaration _getDeclaration(String name) => _declarations[name]; 496 PolymerDeclaration _getDeclaration(String name) => _declarations[name];
491 497
492 /// Using Polymer's platform/src/ShadowCSS.js passing the style tag's content. 498 /// Using Polymer's platform/src/ShadowCSS.js passing the style tag's content.
493 void _shimShadowDomStyling(DocumentFragment template, String name, 499 void _shimShadowDomStyling(DocumentFragment template, String name,
494 String extendee) { 500 String extendee) {
495 if (_ShadowCss == null ||!_hasShadowDomPolyfill) return; 501 if (_ShadowCss == null ||!_hasShadowDomPolyfill) return;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 String name = smoke.symbolToName(symbol); 553 String name = smoke.symbolToName(symbol);
548 if (name == null) return false; 554 if (name == null) return false;
549 return name.endsWith('Changed') && name != 'attributeChanged'; 555 return name.endsWith('Changed') && name != 'attributeChanged';
550 } 556 }
551 557
552 558
553 final _ATTRIBUTES_REGEX = new RegExp(r'\s|,'); 559 final _ATTRIBUTES_REGEX = new RegExp(r'\s|,');
554 560
555 final JsObject _Platform = js.context['Platform']; 561 final JsObject _Platform = js.context['Platform'];
556 final JsObject _Polymer = js.context['Polymer']; 562 final JsObject _Polymer = js.context['Polymer'];
OLDNEW
« no previous file with comments | « pkg/polymer/CHANGELOG.md ('k') | pkg/polymer/lib/src/instance.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698