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

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

Issue 1160013004: Implement RenderImage and Image for Sky (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: CR feedback from Eric 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 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 import 'dart:mirrors'; 9 import 'dart:mirrors';
10 import 'dart:sky' as sky; 10 import 'dart:sky' as sky;
11 import 'reflect.dart' as reflect; 11 import 'reflect.dart' as reflect;
12 import 'app.dart'; 12 import 'app.dart';
13 import 'rendering/block.dart'; 13 import 'rendering/block.dart';
14 import 'rendering/box.dart'; 14 import 'rendering/box.dart';
15 import 'rendering/flex.dart'; 15 import 'rendering/flex.dart';
16 import 'rendering/image.dart';
16 import 'rendering/node.dart'; 17 import 'rendering/node.dart';
17 import 'rendering/paragraph.dart'; 18 import 'rendering/paragraph.dart';
18 19
19 // final sky.Tracing _tracing = sky.window.tracing; 20 // final sky.Tracing _tracing = sky.window.tracing;
20 21
21 final bool _shouldLogRenderDuration = false; 22 final bool _shouldLogRenderDuration = false;
22 final bool _shouldTrace = false; 23 final bool _shouldTrace = false;
23 24
24 enum _SyncOperation { IDENTICAL, INSERTION, STATEFUL, STATELESS, REMOVAL } 25 enum _SyncOperation { IDENTICAL, INSERTION, STATEFUL, STATELESS, REMOVAL }
25 26
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 root.direction = direction; 607 root.direction = direction;
607 } 608 }
608 } 609 }
609 610
610 class FlexExpandingChild extends ParentDataNode { 611 class FlexExpandingChild extends ParentDataNode {
611 FlexExpandingChild(UINode content, [int flex = 1]) 612 FlexExpandingChild(UINode content, [int flex = 1])
612 : super(content, new FlexBoxParentData()..flex = flex); 613 : super(content, new FlexBoxParentData()..flex = flex);
613 } 614 }
614 615
615 class Image extends RenderNodeWrapper { 616 class Image extends RenderNodeWrapper {
616 RenderCSSImage root; 617 RenderImage root;
617 RenderCSSImage createNode() => new RenderCSSImage(this, this.src, this.width, this.height); 618 RenderImage createNode() => new RenderImage(this.src, this.width, this.height) ;
619
620 static final Image _emptyImage = new Image();
621
622 RenderNodeWrapper get emptyNode => _emptyImage;
618 623
619 final String src; 624 final String src;
620 final int width; 625 final double width;
621 final int height; 626 final double height;
abarth-chromium 2015/06/03 00:16:31 These should be held as a sky.Size not separately
jackson 2015/06/03 17:41:43 Done.
622 627
623 Image({ 628 Image({
624 Object key, 629 Object key,
625 this.width, 630 this.width,
626 this.height, 631 this.height,
627 this.src 632 this.src
628 }) : super(key: key); 633 }) : super(key: key);
629 634
630 void syncRenderNode(UINode old) { 635 void syncRenderNode(UINode old) {
631 super.syncRenderNode(old); 636 super.syncRenderNode(old);
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 assert(root.parent is RenderView); 924 assert(root.parent is RenderView);
920 } 925 }
921 } 926 }
922 927
923 class Text extends Component { 928 class Text extends Component {
924 Text(this.data) : super(key: '*text*'); 929 Text(this.data) : super(key: '*text*');
925 final String data; 930 final String data;
926 bool get interchangeable => true; 931 bool get interchangeable => true;
927 UINode build() => new Paragraph(text: data); 932 UINode build() => new Paragraph(text: data);
928 } 933 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698