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

Side by Side Diff: sky/sdk/lib/widgets/basic.dart

Issue 1206373002: Implement ClipRRect (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: cr feedback Created 5 years, 5 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 import 'dart:sky' as sky; 5 import 'dart:sky' as sky;
6 6
7 import 'package:vector_math/vector_math.dart'; 7 import 'package:vector_math/vector_math.dart';
8 8
9 import '../painting/text_style.dart'; 9 import '../painting/text_style.dart';
10 import '../rendering/block.dart'; 10 import '../rendering/block.dart';
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 98
99 } 99 }
100 100
101 class ClipRect extends OneChildRenderObjectWrapper { 101 class ClipRect extends OneChildRenderObjectWrapper {
102 ClipRect({ String key, Widget child }) 102 ClipRect({ String key, Widget child })
103 : super(key: key, child: child); 103 : super(key: key, child: child);
104 104
105 RenderClipRect get root => super.root; 105 RenderClipRect get root => super.root;
106 RenderClipRect createNode() => new RenderClipRect(); 106 RenderClipRect createNode() => new RenderClipRect();
107
108 void syncRenderObject(ClipRect old) {
109 // ClipRect has nothing to sync
Hixie 2015/06/25 18:24:47 see comment below
110 super.syncRenderObject(old);
111 }
112 }
113
114 class ClipRRect extends OneChildRenderObjectWrapper {
115 final double xRadius;
116 final double yRadius;
117 ClipRRect({ String key, Widget child, this.xRadius, this.yRadius })
118 : super(key: key, child: child);
119
120 RenderClipRRect get root => super.root;
121 RenderClipRRect createNode() => new RenderClipRRect(xRadius: xRadius, yRadius: yRadius);
122
123 void syncRenderObject(ClipRRect old) {
124 super.syncRenderObject(old);
125 root.xRadius = xRadius;
126 root.yRadius = yRadius;
127 }
107 } 128 }
108 129
109 class ClipOval extends OneChildRenderObjectWrapper { 130 class ClipOval extends OneChildRenderObjectWrapper {
110 ClipOval({ String key, Widget child }) 131 ClipOval({ String key, Widget child })
111 : super(key: key, child: child); 132 : super(key: key, child: child);
112 133
113 RenderClipOval get root => super.root; 134 RenderClipOval get root => super.root;
114 RenderClipOval createNode() => new RenderClipOval(); 135 RenderClipOval createNode() => new RenderClipOval();
136
137 void syncRenderObject(ClipOval old) {
Hixie 2015/06/25 18:24:47 Don't have functions that do nothing but call supe
138 // ClipOval has nothing to sync
139 super.syncRenderObject(old);
140 }
115 } 141 }
116 142
117
118 // POSITIONING AND SIZING NODES 143 // POSITIONING AND SIZING NODES
119 144
120 class Transform extends OneChildRenderObjectWrapper { 145 class Transform extends OneChildRenderObjectWrapper {
121 146
122 Transform({ String key, this.transform, Widget child }) 147 Transform({ String key, this.transform, Widget child })
123 : super(key: key, child: child); 148 : super(key: key, child: child);
124 149
125 RenderTransform get root => super.root; 150 RenderTransform get root => super.root;
126 final Matrix4 transform; 151 final Matrix4 transform;
127 152
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 combinedStyle = defaultStyle; 445 combinedStyle = defaultStyle;
421 } else { 446 } else {
422 combinedStyle = style; 447 combinedStyle = style;
423 } 448 }
424 if (combinedStyle != null) 449 if (combinedStyle != null)
425 text = new InlineStyle(combinedStyle, [text]); 450 text = new InlineStyle(combinedStyle, [text]);
426 return new Inline(text: text); 451 return new Inline(text: text);
427 } 452 }
428 } 453 }
429 454
455 enum ObjectFit { fill, contain, cover, none, scaleDown }
456
457 // class Image extends Component {
458 // Image(this.src, { String key, this.fit }) : super(key: key);
459 // final ObjectFit fit;
460 // Size size;
461 // Widget build() {
462 // return new SizedImage(src: src, size: size);
463 // }
464 // }
465
abarth-chromium 2015/06/25 18:04:12 Looks like this part of the diff is from your next
430 class Image extends LeafRenderObjectWrapper { 466 class Image extends LeafRenderObjectWrapper {
431 467
432 Image({ 468 Image({
433 src, 469 src,
434 this.size 470 this.size
435 }) : src = src, 471 }) : src = src,
436 super(key: src) { 472 super(key: src) {
437 assert(src != null); 473 assert(src != null);
438 } 474 }
439 475
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 } 507 }
472 508
473 void remove() { 509 void remove() {
474 RenderObjectWrapper ancestor = findAncestor(RenderObjectWrapper); 510 RenderObjectWrapper ancestor = findAncestor(RenderObjectWrapper);
475 assert(ancestor is RenderObjectWrapper); 511 assert(ancestor is RenderObjectWrapper);
476 ancestor.detachChildRoot(this); 512 ancestor.detachChildRoot(this);
477 super.remove(); 513 super.remove();
478 } 514 }
479 515
480 } 516 }
OLDNEW
« sky/sdk/lib/rendering/box.dart ('K') | « sky/sdk/lib/rendering/box.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698