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

Side by Side Diff: sky/framework/editing/editable_text.dart

Issue 1139123007: [Effen] remove the last traces of the 'display' property from the effen component library. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: update test 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
« no previous file with comments | « sky/framework/components/input.dart ('k') | sky/framework/fn.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 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 import '../fn.dart'; 5 import '../fn.dart';
6 import '../theme/colors.dart'; 6 import '../theme/colors.dart';
7 import 'dart:async'; 7 import 'dart:async';
8 import 'editable_string.dart'; 8 import 'editable_string.dart';
9 9
10 class EditableText extends Component { 10 class EditableText extends Component {
11 static final Style _style = new Style('''
12 display: inline;'''
13 );
14 11
15 static final Style _cursorStyle = new Style(''' 12 static final Style _cursorStyle = new Style('''
16 display: inline-flex;
17 width: 2px; 13 width: 2px;
18 height: 1.2em; 14 height: 1.2em;
19 vertical-align: top; 15 vertical-align: top;
20 background-color: ${Blue[500]};''' 16 background-color: ${Blue[500]};'''
21 ); 17 );
22 18
23 static final Style _composingStyle = new Style(''' 19 static final Style _composingStyle = new Style('''
24 display: inline;
25 text-decoration: underline;''' 20 text-decoration: underline;'''
26 ); 21 );
27 22
28 EditableString value; 23 EditableString value;
29 bool focused; 24 bool focused;
30 Timer _cursorTimer; 25 Timer _cursorTimer;
31 bool _showCursor = false; 26 bool _showCursor = false;
32 27
33 EditableText({Object key, this.value, this.focused}) 28 EditableText({Object key, this.value, this.focused})
34 : super(key: key, stateful: true) { 29 : super(key: key, stateful: true) {
(...skipping 23 matching lines...) Expand all
58 53
59 UINode build() { 54 UINode build() {
60 if (focused && _cursorTimer == null) 55 if (focused && _cursorTimer == null)
61 _startCursorTimer(); 56 _startCursorTimer();
62 else if (!focused && _cursorTimer != null) 57 else if (!focused && _cursorTimer != null)
63 _stopCursorTimer(); 58 _stopCursorTimer();
64 59
65 List<UINode> children = new List<UINode>(); 60 List<UINode> children = new List<UINode>();
66 61
67 if (!value.composing.isValid) { 62 if (!value.composing.isValid) {
68 children.add(new Text(value.text)); 63 children.add(new TextFragment(value.text));
69 } else { 64 } else {
70 String beforeComposing = value.textBefore(value.composing); 65 String beforeComposing = value.textBefore(value.composing);
71 if (!beforeComposing.isEmpty) 66 if (!beforeComposing.isEmpty)
72 children.add(new Text(beforeComposing)); 67 children.add(new TextFragment(beforeComposing));
73 68
74 String composing = value.textInside(value.composing); 69 String composing = value.textInside(value.composing);
75 if (!composing.isEmpty) { 70 if (!composing.isEmpty) {
76 children.add(new Container( 71 children.add(new TextFragment(
72 composing,
77 key: 'composing', 73 key: 'composing',
78 style: _composingStyle, 74 style: _composingStyle
79 children: [new Text(composing)]
80 )); 75 ));
81 } 76 }
82 77
83 String afterComposing = value.textAfter(value.composing); 78 String afterComposing = value.textAfter(value.composing);
84 if (!afterComposing.isEmpty) 79 if (!afterComposing.isEmpty)
85 children.add(new Text(afterComposing)); 80 children.add(new TextFragment(afterComposing));
86 } 81 }
87 82
88 if (_showCursor) 83 if (_showCursor)
89 children.add(new Container(key: 'cursor', style: _cursorStyle)); 84 children.add(new Container(key: 'cursor', style: _cursorStyle));
90 85
91 return new Container( 86 return new Paragraph(
92 style: _style,
93 children: children 87 children: children
94 ); 88 );
95 } 89 }
96 } 90 }
OLDNEW
« no previous file with comments | « sky/framework/components/input.dart ('k') | sky/framework/fn.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698