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

Side by Side Diff: sky/framework/fn.dart

Issue 1134163003: [Effen] Use the checkbox widget in the stocks app. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fix tests Created 5 years, 7 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
OLDNEW
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;
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 313
314 void _sync(UINode old, RenderCSSContainer host, RenderCSS insertBefore) { 314 void _sync(UINode old, RenderCSSContainer host, RenderCSS insertBefore) {
315 for (var type in listeners.keys) { 315 for (var type in listeners.keys) {
316 _ensureDocumentListener(type); 316 _ensureDocumentListener(type);
317 } 317 }
318 318
319 super._sync(old, host, insertBefore); 319 super._sync(old, host, insertBefore);
320 } 320 }
321 } 321 }
322 322
323 class Text extends SkyNodeWrapper {
324 final String data;
325
326 // Text nodes are special cases of having non-unique keys (which don't need
327 // to be assigned as part of the API). Since they are unique in not having
328 // children, there's little point to reordering, so we always just re-assign
329 // the data.
330 Text(this.data) : super(key:'*text*');
331
332 static final Text _emptyText = new Text(null);
333
334 SkyNodeWrapper get _emptyNode => _emptyText;
335
336 RenderCSSText _root;
337 RenderCSS _createNode() {
338 return new RenderCSSText(this, this.data);
339 }
340
341 void _syncNode(SkyNodeWrapper old) {
342 if (old == _emptyText)
343 return; // we set inside _createNode();
344 _root.data = data;
345 }
346 }
347
348 final List<UINode> _emptyList = new List<UINode>(); 323 final List<UINode> _emptyList = new List<UINode>();
349 324
350 abstract class SkyElementWrapper extends SkyNodeWrapper { 325 abstract class SkyElementWrapper extends SkyNodeWrapper {
351 326
352 final List<UINode> children; 327 final List<UINode> children;
353 final Style style; 328 final Style style;
354 final String inlineStyle; 329 final String inlineStyle;
355 330
356 SkyElementWrapper({ 331 SkyElementWrapper({
357 Object key, 332 Object key,
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 style: style, 562 style: style,
588 inlineStyle: inlineStyle 563 inlineStyle: inlineStyle
589 ); 564 );
590 565
591 void _syncNode(UINode old) { 566 void _syncNode(UINode old) {
592 super._syncNode(old); 567 super._syncNode(old);
593 _root.direction = direction; 568 _root.direction = direction;
594 } 569 }
595 } 570 }
596 571
572 class Text extends SkyElementWrapper {
573
574 RenderCSSText _root;
575 RenderCSSText _createNode() => new RenderCSSText(this, this.data);
576
577 static final Text _emptyText = new Text('');
578
579 SkyNodeWrapper get _emptyNode => _emptyText;
580
581 final String data;
582
583 // Text nodes are special cases of having non-unique keys (which don't need
584 // to be assigned as part of the API). Since they are unique in not having
585 // children, there's little point to reordering, so we always just re-assign
586 // the data.
587 Text(this.data, {
588 Style style,
589 String inlineStyle
590 }) : super(
591 key: '*text*',
592 style: style,
593 inlineStyle: inlineStyle
594 );
595
596 void _syncNode(UINode old) {
597 super._syncNode(old);
598 _root.data = data;
599 }
600 }
601
597 class Image extends SkyElementWrapper { 602 class Image extends SkyElementWrapper {
598 603
599 RenderCSSImage _root; 604 RenderCSSImage _root;
600 RenderCSSImage _createNode() => new RenderCSSImage(this, this.src, this.width, this.height); 605 RenderCSSImage _createNode() => new RenderCSSImage(this, this.src, this.width, this.height);
601 606
602 static final Image _emptyImage = new Image(); 607 static final Image _emptyImage = new Image();
603 608
604 SkyNodeWrapper get _emptyNode => _emptyImage; 609 SkyNodeWrapper get _emptyNode => _emptyImage;
605 610
606 final String src; 611 final String src;
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 } 853 }
849 854
850 void _buildIfDirty() { 855 void _buildIfDirty() {
851 if (!_dirty || _defunct) 856 if (!_dirty || _defunct)
852 return; 857 return;
853 858
854 _trace('$_key rebuilding...'); 859 _trace('$_key rebuilding...');
855 _sync(null, _host, _root); 860 _sync(null, _host, _root);
856 } 861 }
857 } 862 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698