| OLD | NEW |
| 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; | 9 import 'dart:sky' show Point, Size, Rect, Color, Paint, Path; |
| 10 export 'dart:sky' show Point, Size, Rect, Color, Paint, Path; | 10 export 'dart:sky' show Point, Size, Rect, Color, Paint, Path; |
| 11 | 11 |
| 12 class ParentData { | 12 class ParentData { |
| 13 void detach() { | 13 void detach() { |
| 14 detachSiblings(); | 14 detachSiblings(); |
| 15 } | 15 } |
| 16 void detachSiblings() { } // workaround for lack of inter-class mixins in Dart | 16 void detachSiblings() { } // workaround for lack of inter-class mixins in Dart |
| 17 void merge(ParentData other) { | 17 void merge(ParentData other) { |
| 18 // 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 |
| 19 assert(other.runtimeType == this.runtimeType); | 19 assert(other.runtimeType == this.runtimeType); |
| 20 } | 20 } |
| 21 String toString() => '<none>'; | 21 String toString() => '<none>'; |
| 22 } | 22 } |
| 23 | 23 |
| 24 const kLayoutDirections = 4; | 24 const kLayoutDirections = 4; |
| 25 | 25 |
| 26 double clamp({double min: 0.0, double value: 0.0, double max: double.INFINITY})
{ | |
| 27 assert(min != null); | |
| 28 assert(value != null); | |
| 29 assert(max != null); | |
| 30 return math.max(min, math.min(max, value)); | |
| 31 } | |
| 32 | |
| 33 class RenderObjectDisplayList extends sky.PictureRecorder { | 26 class RenderObjectDisplayList extends sky.PictureRecorder { |
| 34 RenderObjectDisplayList(double width, double height) : super(width, height); | 27 RenderObjectDisplayList(double width, double height) : super(width, height); |
| 35 void paintChild(RenderObject child, Point position) { | 28 void paintChild(RenderObject child, Point position) { |
| 36 translate(position.x, position.y); | 29 translate(position.x, position.y); |
| 37 child.paint(this); | 30 child.paint(this); |
| 38 translate(-position.x, -position.y); | 31 translate(-position.x, -position.y); |
| 39 } | 32 } |
| 40 } | 33 } |
| 41 | 34 |
| 42 abstract class RenderObject extends AbstractNode { | 35 abstract class RenderObject extends AbstractNode { |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 int count = 1; | 444 int count = 1; |
| 452 ChildType child = _firstChild; | 445 ChildType child = _firstChild; |
| 453 while (child != null) { | 446 while (child != null) { |
| 454 result += '${prefix}child ${count}: ${child.toString(prefix)}'; | 447 result += '${prefix}child ${count}: ${child.toString(prefix)}'; |
| 455 count += 1; | 448 count += 1; |
| 456 child = child.parentData.nextSibling; | 449 child = child.parentData.nextSibling; |
| 457 } | 450 } |
| 458 return result; | 451 return result; |
| 459 } | 452 } |
| 460 } | 453 } |
| OLD | NEW |