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

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

Issue 1078973002: [Effen] make fn wrap text in display:paragraph nodes (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 8 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
« 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 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // to be assigned as part of the API). Since they are unique in not having 345 // to be assigned as part of the API). Since they are unique in not having
346 // children, there's little point to reordering, so we always just re-assign 346 // children, there's little point to reordering, so we always just re-assign
347 // the data. 347 // the data.
348 Text(this.data) : super(key:'*text*'); 348 Text(this.data) : super(key:'*text*');
349 349
350 static final Text _emptyText = new Text(null); 350 static final Text _emptyText = new Text(null);
351 351
352 SkyNodeWrapper get _emptyNode => _emptyText; 352 SkyNodeWrapper get _emptyNode => _emptyText;
353 353
354 sky.Node _createNode() { 354 sky.Node _createNode() {
355 return new sky.Text(data); 355 return sky.document.createElement('div')
356 ..setChild(new sky.Text(this.data))
357 ..setAttribute('style', 'display:paragraph');
abarth-chromium 2015/04/09 22:48:45 We should do this with a class rather than inline
356 } 358 }
357 359
358 void _syncNode(SkyNodeWrapper old) { 360 void _syncNode(SkyNodeWrapper old) {
359 if (old == _emptyText) 361 if (old == _emptyText)
360 return; // we set inside _createNode(); 362 return; // we set inside _createNode();
361 363
362 (_root as sky.Text).data = data; 364 (_root.firstChild as sky.Text).data = data;
363 } 365 }
364 } 366 }
365 367
366 final List<UINode> _emptyList = new List<UINode>(); 368 final List<UINode> _emptyList = new List<UINode>();
367 369
368 abstract class SkyElementWrapper extends SkyNodeWrapper { 370 abstract class SkyElementWrapper extends SkyNodeWrapper {
369 371
370 String get _tagName; 372 String get _tagName;
371 373
372 sky.Node _createNode() => sky.document.createElement(_tagName); 374 sky.Node _createNode() => sky.document.createElement(_tagName);
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 883
882 abstract class App extends Component { 884 abstract class App extends Component {
883 sky.Node _host; 885 sky.Node _host;
884 886
885 App() : super(stateful: true) { 887 App() : super(stateful: true) {
886 _host = sky.document.createElement('div'); 888 _host = sky.document.createElement('div');
887 sky.document.appendChild(_host); 889 sky.document.appendChild(_host);
888 _scheduleComponentForRender(this); 890 _scheduleComponentForRender(this);
889 } 891 }
890 } 892 }
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