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

Side by Side Diff: sky/examples/raw/simple_render_tree.dart

Issue 1152603002: Address Ian's comments on layout2.dart (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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 | « no previous file | sky/sdk/lib/framework/layout2.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 'dart:math'; 5 import 'dart:math';
6 import 'dart:sky'; 6 import 'dart:sky';
7 import 'package:sky/framework/layout2.dart'; 7 import 'package:sky/framework/layout2.dart';
8 8
9 class RenderSolidColor extends RenderDecoratedBox { 9 class RenderSolidColor extends RenderDecoratedBox {
10 final int backgroundColor; 10 final int backgroundColor;
11 11
12 RenderSolidColor(int backgroundColor) 12 RenderSolidColor(int backgroundColor)
13 : super(new BoxDecoration(backgroundColor: backgroundColor)), 13 : super(new BoxDecoration(backgroundColor: backgroundColor)),
14 backgroundColor = backgroundColor; 14 backgroundColor = backgroundColor;
15 15
16 BoxDimensions getIntrinsicDimensions(BoxConstraints constraints) { 16 BoxDimensions getIntrinsicDimensions(BoxConstraints constraints) {
17 return new BoxDimensions.withConstraints(constraints, height: 200.0); 17 return new BoxDimensions.withConstraints(constraints, height: 200.0);
18 } 18 }
19 19
20 void layout(BoxConstraints constraints, { RenderNode relayoutSubtreeRoot }) { 20 void layout(BoxConstraints constraints, { RenderNode relayoutSubtreeRoot }) {
21 setWidth(constraints, constraints.maxWidth); 21 width = constraints.constrainWidth(constraints.maxWidth);
22 setHeight(constraints, 200.0); 22 height = constraints.constrainHeight(200.0);
23 layoutDone(); 23 layoutDone();
24 } 24 }
25 25
26 bool handlePointer(PointerEvent event, { double x: 0.0, double y: 0.0 }) { 26 bool handlePointer(PointerEvent event, { double x: 0.0, double y: 0.0 }) {
27 if (event.type == 'pointerdown') { 27 if (event.type == 'pointerdown') {
28 setBoxDecoration(new BoxDecoration(backgroundColor: 0xFFFF0000)); 28 setBoxDecoration(new BoxDecoration(backgroundColor: 0xFFFF0000));
29 return true; 29 return true;
30 } 30 }
31 31
32 if (event.type == 'pointerup') { 32 if (event.type == 'pointerup') {
(...skipping 27 matching lines...) Expand all
60 decoration: new BoxDecoration(backgroundColor: 0xFF00FFFF)); 60 decoration: new BoxDecoration(backgroundColor: 0xFF00FFFF));
61 61
62 root.add(new RenderSolidColor(0xFF00FF00)); 62 root.add(new RenderSolidColor(0xFF00FF00));
63 root.add(new RenderSolidColor(0xFF0000FF)); 63 root.add(new RenderSolidColor(0xFF0000FF));
64 64
65 renderView = new RenderView(root: root); 65 renderView = new RenderView(root: root);
66 renderView.layout(newWidth: view.width, newHeight: view.height); 66 renderView.layout(newWidth: view.width, newHeight: view.height);
67 67
68 view.scheduleFrame(); 68 view.scheduleFrame();
69 } 69 }
OLDNEW
« no previous file with comments | « no previous file | sky/sdk/lib/framework/layout2.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698