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

Side by Side Diff: sky/sdk/lib/framework/fn2.dart

Issue 1176133002: Add support for text styles - Work In Progress (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 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 'app.dart'; 7 import 'app.dart';
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:collection'; 9 import 'dart:collection';
10 import 'dart:mirrors'; 10 import 'dart:mirrors';
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 StackPositionedChild(UINode content, { 743 StackPositionedChild(UINode content, {
744 double top, double right, double bottom, double left 744 double top, double right, double bottom, double left
745 }) : super(content, new StackParentData()..top = top 745 }) : super(content, new StackParentData()..top = top
746 ..right = right 746 ..right = right
747 ..bottom = bottom 747 ..bottom = bottom
748 ..left = left); 748 ..left = left);
749 } 749 }
750 750
751 class Paragraph extends RenderObjectWrapper { 751 class Paragraph extends RenderObjectWrapper {
752 752
753 Paragraph({ Object key, this.text }) : super(key: key); 753 Paragraph({ Object key, this.text, this.style }) : super(key: key);
754 754
755 RenderParagraph root; 755 RenderParagraph root;
756 RenderParagraph createNode() => new RenderParagraph(text: text); 756 RenderParagraph createNode() => new RenderParagraph(text: text, style: style);
757 757
758 final String text; 758 final String text;
759 final TextStyle style;
759 760
760 void syncRenderObject(UINode old) { 761 void syncRenderObject(UINode old) {
761 super.syncRenderObject(old); 762 super.syncRenderObject(old);
762 root.text = text; 763 root.text = text;
764 root.style = style;
763 } 765 }
764 766
765 void insert(RenderObjectWrapper child, dynamic slot) { 767 void insert(RenderObjectWrapper child, dynamic slot) {
766 assert(false); 768 assert(false);
767 // Paragraph does not support having children currently 769 // Paragraph does not support having children currently
768 } 770 }
769 771
770 } 772 }
771 773
772 class FlexContainer extends MultiChildRenderObjectWrapper { 774 class FlexContainer extends MultiChildRenderObjectWrapper {
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 assert(_mounted); 1123 assert(_mounted);
1122 _sync(null, null); 1124 _sync(null, null);
1123 if (root.parent == null) 1125 if (root.parent == null)
1124 _appView.root = root; 1126 _appView.root = root;
1125 assert(root.parent is RenderView); 1127 assert(root.parent is RenderView);
1126 } 1128 }
1127 1129
1128 } 1130 }
1129 1131
1130 class Text extends Component { 1132 class Text extends Component {
1131 Text(this.data) : super(key: '*text*'); 1133 Text(this.data, { TextStyle this.style }) : super(key: '*text*');
1132 final String data; 1134 final String data;
1135 final TextStyle style;
1133 bool get interchangeable => true; 1136 bool get interchangeable => true;
1134 UINode build() => new Paragraph(text: data); 1137 UINode build() => new Paragraph(text: data, style: style);
1135 } 1138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698