| 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 'dart:math' as math; | 5 import 'dart:math' as math; |
| 6 import 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
| 7 import 'dart:sky' show Point, Size, Rect, Color, Paint, Path; | 7 import 'dart:sky' show Point, Size, Rect, Color, Paint, Path; |
| 8 | 8 |
| 9 import '../base/hit_test.dart'; | 9 import '../base/hit_test.dart'; |
| 10 import '../base/node.dart'; | 10 import '../base/node.dart'; |
| 11 import '../base/scheduler.dart' as scheduler; | 11 import '../base/scheduler.dart' as scheduler; |
| 12 | 12 |
| 13 export 'dart:sky' show Point, Size, Rect, Color, Paint, Path; | 13 export 'dart:sky' show Point, Size, Rect, Color, Paint, Path; |
| 14 export '../base/hit_test.dart' show HitTestTarget, HitTestEntry, HitTestResult; | 14 export '../base/hit_test.dart' show HitTestTarget, HitTestEntry, HitTestResult; |
| 15 | 15 |
| 16 | 16 |
| 17 class ParentData { | 17 class ParentData { |
| 18 void detach() { | 18 void detach() { |
| 19 detachSiblings(); | 19 detachSiblings(); |
| 20 } | 20 } |
| 21 void detachSiblings() { } // workaround for lack of inter-class mixins in Dart | 21 void detachSiblings() { } // workaround for lack of inter-class mixins in Dart |
| 22 void merge(ParentData other) { | 22 void merge(ParentData other) { |
| 23 // override this in subclasses to merge in data from other into this | 23 // override this in subclasses to merge in data from other into this |
| 24 assert(other.runtimeType == this.runtimeType); | 24 assert(other.runtimeType == this.runtimeType); |
| 25 } | 25 } |
| 26 String toString() => '<none>'; | 26 String toString() => '<none>'; |
| 27 } | 27 } |
| 28 | 28 |
| 29 const kLayoutDirections = 4; | 29 class RenderCanvas extends sky.Canvas { |
| 30 RenderCanvas(sky.PictureRecorder recorder, double width, double height) : supe
r(recorder, width, height); |
| 30 | 31 |
| 31 class RenderObjectDisplayList extends sky.PictureRecorder { | |
| 32 RenderObjectDisplayList(double width, double height) : super(width, height); | |
| 33 void paintChild(RenderObject child, Point position) { | 32 void paintChild(RenderObject child, Point position) { |
| 34 translate(position.x, position.y); | 33 translate(position.x, position.y); |
| 35 child.paint(this); | 34 child.paint(this); |
| 36 translate(-position.x, -position.y); | 35 translate(-position.x, -position.y); |
| 37 } | 36 } |
| 38 } | 37 } |
| 39 | 38 |
| 40 abstract class Constraints { | 39 abstract class Constraints { |
| 41 const Constraints(); | 40 const Constraints(); |
| 42 bool get isTight; | 41 bool get isTight; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 }) { } | 211 }) { } |
| 213 | 212 |
| 214 | 213 |
| 215 // PAINTING | 214 // PAINTING |
| 216 | 215 |
| 217 static bool debugDoingPaint = false; | 216 static bool debugDoingPaint = false; |
| 218 void markNeedsPaint() { | 217 void markNeedsPaint() { |
| 219 assert(!debugDoingPaint); | 218 assert(!debugDoingPaint); |
| 220 scheduler.ensureVisualUpdate(); | 219 scheduler.ensureVisualUpdate(); |
| 221 } | 220 } |
| 222 void paint(RenderObjectDisplayList canvas) { } | 221 void paint(RenderCanvas canvas) { } |
| 223 | 222 |
| 224 | 223 |
| 225 // EVENTS | 224 // EVENTS |
| 226 | 225 |
| 227 void handleEvent(sky.Event event, HitTestEntry entry) { | 226 void handleEvent(sky.Event event, HitTestEntry entry) { |
| 228 // override this if you have a client, to hand it to the client | 227 // override this if you have a client, to hand it to the client |
| 229 // override this if you want to do anything with the event | 228 // override this if you want to do anything with the event |
| 230 } | 229 } |
| 231 | 230 |
| 232 | 231 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 int count = 1; | 489 int count = 1; |
| 491 ChildType child = _firstChild; | 490 ChildType child = _firstChild; |
| 492 while (child != null) { | 491 while (child != null) { |
| 493 result += '${prefix}child ${count}: ${child.toString(prefix)}'; | 492 result += '${prefix}child ${count}: ${child.toString(prefix)}'; |
| 494 count += 1; | 493 count += 1; |
| 495 child = child.parentData.nextSibling; | 494 child = child.parentData.nextSibling; |
| 496 } | 495 } |
| 497 return result; | 496 return result; |
| 498 } | 497 } |
| 499 } | 498 } |
| OLD | NEW |