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

Side by Side Diff: sky/sdk/lib/framework/rendering/object.dart

Issue 1161323004: Export Point, Size, Rect, Color, Paint, Path, BoxDecoration, Border, BorderSide, EdgeDims, and Flex… (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: without analyser changes 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 import '../node.dart'; 5 import '../node.dart';
6 import '../scheduler.dart' as scheduler; 6 import '../scheduler.dart' as scheduler;
7 import 'dart:math' as math; 7 import 'dart:math' as math;
8 import 'dart:sky' as sky; 8 import 'dart:sky' as sky;
9 import 'dart:sky' show Point, Size, Rect, Color, Paint, Path;
10 export 'dart:sky' show Point, Size, Rect, Color, Paint, Path;
9 11
10 class ParentData { 12 class ParentData {
11 void detach() { 13 void detach() {
12 detachSiblings(); 14 detachSiblings();
13 } 15 }
14 void detachSiblings() { } // workaround for lack of inter-class mixins in Dart 16 void detachSiblings() { } // workaround for lack of inter-class mixins in Dart
15 void merge(ParentData other) { 17 void merge(ParentData other) {
16 // override this in subclasses to merge in data from other into this 18 // override this in subclasses to merge in data from other into this
17 assert(other.runtimeType == this.runtimeType); 19 assert(other.runtimeType == this.runtimeType);
18 } 20 }
19 String toString() => '<none>'; 21 String toString() => '<none>';
20 } 22 }
21 23
22 const kLayoutDirections = 4; 24 const kLayoutDirections = 4;
23 25
24 double clamp({double min: 0.0, double value: 0.0, double max: double.INFINITY}) { 26 double clamp({double min: 0.0, double value: 0.0, double max: double.INFINITY}) {
25 assert(min != null); 27 assert(min != null);
26 assert(value != null); 28 assert(value != null);
27 assert(max != null); 29 assert(max != null);
28 return math.max(min, math.min(max, value)); 30 return math.max(min, math.min(max, value));
29 } 31 }
30 32
31 class RenderObjectDisplayList extends sky.PictureRecorder { 33 class RenderObjectDisplayList extends sky.PictureRecorder {
32 RenderObjectDisplayList(double width, double height) : super(width, height); 34 RenderObjectDisplayList(double width, double height) : super(width, height);
33 void paintChild(RenderObject child, sky.Point position) { 35 void paintChild(RenderObject child, Point position) {
34 translate(position.x, position.y); 36 translate(position.x, position.y);
35 child.paint(this); 37 child.paint(this);
36 translate(-position.x, -position.y); 38 translate(-position.x, -position.y);
37 } 39 }
38 } 40 }
39 41
40 abstract class RenderObject extends AbstractNode { 42 abstract class RenderObject extends AbstractNode {
41 43
42 // LAYOUT 44 // LAYOUT
43 45
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // override this if you have a client, to hand it to the client 206 // override this if you have a client, to hand it to the client
205 // override this if you want to do anything with the event 207 // override this if you want to do anything with the event
206 } 208 }
207 209
208 210
209 // HIT TESTING 211 // HIT TESTING
210 212
211 // RenderObject subclasses are expected to have a method like the 213 // RenderObject subclasses are expected to have a method like the
212 // following (with the signature being whatever passes for coordinates 214 // following (with the signature being whatever passes for coordinates
213 // for this particular class): 215 // for this particular class):
214 // bool hitTest(HitTestResult result, { sky.Point position }) { 216 // bool hitTest(HitTestResult result, { Point position }) {
215 // // If (x,y) is not inside this node, then return false. (You 217 // // If (x,y) is not inside this node, then return false. (You
216 // // can assume that the given coordinate is inside your 218 // // can assume that the given coordinate is inside your
217 // // dimensions. You only need to check this if you're an 219 // // dimensions. You only need to check this if you're an
218 // // irregular shape, e.g. if you have a hole.) 220 // // irregular shape, e.g. if you have a hole.)
219 // // Otherwise: 221 // // Otherwise:
220 // // For each child that intersects x,y, in z-order starting from the top, 222 // // For each child that intersects x,y, in z-order starting from the top,
221 // // call hitTest() for that child, passing it /result/, and the coordinate s 223 // // call hitTest() for that child, passing it /result/, and the coordinate s
222 // // converted to the child's coordinate origin, and stop at the first chil d 224 // // converted to the child's coordinate origin, and stop at the first chil d
223 // // that returns true. 225 // // that returns true.
224 // // Then, add yourself to /result/, and return true. 226 // // Then, add yourself to /result/, and return true.
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 int count = 1; 442 int count = 1;
441 ChildType child = _firstChild; 443 ChildType child = _firstChild;
442 while (child != null) { 444 while (child != null) {
443 result += '${prefix}child ${count}: ${child.toString(prefix)}'; 445 result += '${prefix}child ${count}: ${child.toString(prefix)}';
444 count += 1; 446 count += 1;
445 child = child.parentData.nextSibling; 447 child = child.parentData.nextSibling;
446 } 448 }
447 return result; 449 return result;
448 } 450 }
449 } 451 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/framework/rendering/flex.dart ('k') | sky/sdk/lib/framework/rendering/paragraph.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698