OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 library fn; | 5 library fn; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:sky' as sky; | 9 import 'dart:sky' as sky; |
10 import 'reflect.dart' as reflect; | 10 import 'reflect.dart' as reflect; |
11 | 11 |
12 bool _initIsInCheckedMode() { | 12 bool _initIsInCheckedMode() { |
13 void testFn(double i) {} | 13 String testFn(i) { double d = i; return d.toString(); } |
14 try { | 14 try { |
15 testFn('not a double'); | 15 testFn('not a double'); |
16 } catch (ex) { | 16 } catch (ex) { |
17 return true; | 17 return true; |
18 } | 18 } |
19 return false; | 19 return false; |
20 } | 20 } |
21 | 21 |
22 final bool _isInCheckedMode = _initIsInCheckedMode(); | 22 final bool _isInCheckedMode = _initIsInCheckedMode(); |
23 final bool _shouldLogRenderDuration = false; | 23 final bool _shouldLogRenderDuration = false; |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 oldElement._children = null; | 398 oldElement._children = null; |
399 return false; | 399 return false; |
400 } | 400 } |
401 } | 401 } |
402 | 402 |
403 class Container extends Element { | 403 class Container extends Element { |
404 | 404 |
405 String get _tagName => 'div'; | 405 String get _tagName => 'div'; |
406 | 406 |
407 static final Container _emptyContainer = new Container(); | 407 static final Container _emptyContainer = new Container(); |
408 | |
409 Element get _emptyElement => _emptyContainer; | 408 Element get _emptyElement => _emptyContainer; |
410 | 409 |
411 Container({ | 410 Container({ |
412 Object key, | 411 Object key, |
413 List<Node> children, | 412 List<Node> children, |
414 Style style, | 413 Style style, |
415 String inlineStyle | 414 String inlineStyle |
416 }) : super( | 415 }) : super( |
417 key: key, | 416 key: key, |
418 children: children, | 417 children: children, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 skyImage.style['height'] = '${height}px'; | 462 skyImage.style['height'] = '${height}px'; |
464 } | 463 } |
465 } | 464 } |
466 } | 465 } |
467 | 466 |
468 class Anchor extends Element { | 467 class Anchor extends Element { |
469 | 468 |
470 String get _tagName => 'a'; | 469 String get _tagName => 'a'; |
471 | 470 |
472 static final Anchor _emptyAnchor = new Anchor(); | 471 static final Anchor _emptyAnchor = new Anchor(); |
| 472 Element get _emptyElement => _emptyAnchor; |
473 | 473 |
474 String href; | 474 String href; |
| 475 int width; |
| 476 int height; |
475 | 477 |
476 Anchor({ | 478 Anchor({ |
477 Object key, | 479 Object key, |
478 List<Node> children, | 480 List<Node> children, |
479 Style style, | 481 Style style, |
480 String inlineStyle, | 482 String inlineStyle, |
481 this.width, | 483 this.width, |
482 this.height, | 484 this.height, |
483 this.href | 485 this.href |
484 }) : super( | 486 }) : super( |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 | 653 |
652 _sync(null, _host, null); | 654 _sync(null, _host, null); |
653 assert(_root is sky.Node); | 655 assert(_root is sky.Node); |
654 | 656 |
655 sw.stop(); | 657 sw.stop(); |
656 if (_shouldLogRenderDuration) | 658 if (_shouldLogRenderDuration) |
657 print("Initial render: ${sw.elapsedMicroseconds} microseconds"); | 659 print("Initial render: ${sw.elapsedMicroseconds} microseconds"); |
658 }); | 660 }); |
659 } | 661 } |
660 } | 662 } |
OLD | NEW |