| 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, Offset, Size, Rect, Color, Paint, Path; | 7 import 'dart:sky' show Point, Offset, 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, Offset, Size, Rect, Color, Paint, Path; | 13 export 'dart:sky' show Point, Offset, 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 class RenderCanvas extends sky.Canvas { | 29 class PaintingCanvas extends sky.Canvas { |
| 30 RenderCanvas(sky.PictureRecorder recorder, Size bounds) : super(recorder, boun
ds); | 30 PaintingCanvas(sky.PictureRecorder recorder, Size bounds) : super(recorder, bo
unds); |
| 31 | 31 |
| 32 void paintChild(RenderObject child, Point point) { | 32 void paintChild(RenderObject child, Point point) { |
| 33 child.paint(this, point.toOffset()); | 33 child.paint(this, point.toOffset()); |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 abstract class Constraints { | 37 abstract class Constraints { |
| 38 const Constraints(); | 38 const Constraints(); |
| 39 bool get isTight; | 39 bool get isTight; |
| 40 } | 40 } |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 }) { } | 236 }) { } |
| 237 | 237 |
| 238 | 238 |
| 239 // PAINTING | 239 // PAINTING |
| 240 | 240 |
| 241 static bool debugDoingPaint = false; | 241 static bool debugDoingPaint = false; |
| 242 void markNeedsPaint() { | 242 void markNeedsPaint() { |
| 243 assert(!debugDoingPaint); | 243 assert(!debugDoingPaint); |
| 244 scheduler.ensureVisualUpdate(); | 244 scheduler.ensureVisualUpdate(); |
| 245 } | 245 } |
| 246 void paint(RenderCanvas canvas, Offset offset) { } | 246 void paint(PaintingCanvas canvas, Offset offset) { } |
| 247 | 247 |
| 248 | 248 |
| 249 // EVENTS | 249 // EVENTS |
| 250 | 250 |
| 251 void handleEvent(sky.Event event, HitTestEntry entry) { | 251 void handleEvent(sky.Event event, HitTestEntry entry) { |
| 252 // override this if you have a client, to hand it to the client | 252 // override this if you have a client, to hand it to the client |
| 253 // override this if you want to do anything with the event | 253 // override this if you want to do anything with the event |
| 254 } | 254 } |
| 255 | 255 |
| 256 | 256 |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 int count = 1; | 529 int count = 1; |
| 530 ChildType child = _firstChild; | 530 ChildType child = _firstChild; |
| 531 while (child != null) { | 531 while (child != null) { |
| 532 result += '${prefix}child ${count}: ${child.toString(prefix)}'; | 532 result += '${prefix}child ${count}: ${child.toString(prefix)}'; |
| 533 count += 1; | 533 count += 1; |
| 534 child = child.parentData.nextSibling; | 534 child = child.parentData.nextSibling; |
| 535 } | 535 } |
| 536 return result; | 536 return result; |
| 537 } | 537 } |
| 538 } | 538 } |
| OLD | NEW |