OLD | NEW |
1 library layout; | 1 library layout; |
2 | 2 |
| 3 // This version of layout.dart is a shim version of layout2.dart that is backed
using CSS and <div>s. |
| 4 |
3 import 'node.dart'; | 5 import 'node.dart'; |
4 import 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
5 import 'dart:collection'; | 7 import 'dart:collection'; |
6 | 8 |
7 // UTILS | 9 // UTILS |
8 | 10 |
9 // Bridge to legacy CSS-like style specification | 11 // Bridge to legacy CSS-like style specification |
10 // Eventually we'll replace this with something else | 12 // Eventually we'll replace this with something else |
11 class Style { | 13 class Style { |
12 final String _className; | 14 final String _className; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 void detach() { | 59 void detach() { |
58 detachSiblings(); | 60 detachSiblings(); |
59 } | 61 } |
60 void detachSiblings() { } // workaround for lack of inter-class mixins in Dart | 62 void detachSiblings() { } // workaround for lack of inter-class mixins in Dart |
61 void merge(ParentData other) { | 63 void merge(ParentData other) { |
62 // override this in subclasses to merge in data from other into this | 64 // override this in subclasses to merge in data from other into this |
63 assert(other.runtimeType == this.runtimeType); | 65 assert(other.runtimeType == this.runtimeType); |
64 } | 66 } |
65 } | 67 } |
66 | 68 |
67 abstract class RenderNode extends Node { | 69 abstract class RenderNode extends AbstractNode { |
68 | 70 |
69 // LAYOUT | 71 // LAYOUT |
70 | 72 |
71 // parentData is only for use by the RenderNode that actually lays this | 73 // parentData is only for use by the RenderNode that actually lays this |
72 // node out, and any other nodes who happen to know exactly what | 74 // node out, and any other nodes who happen to know exactly what |
73 // kind of node that is. | 75 // kind of node that is. |
74 ParentData parentData; | 76 ParentData parentData; |
75 void setupPos(RenderNode child) { | 77 void setupPos(RenderNode child) { |
76 // override this to setup .parentData correctly for your class | 78 // override this to setup .parentData correctly for your class |
77 if (child.parentData is! ParentData) | 79 if (child.parentData is! ParentData) |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 print(prefix + node.toString() + _attributes(node)); | 553 print(prefix + node.toString() + _attributes(node)); |
552 var children = node.getChildNodes(); | 554 var children = node.getChildNodes(); |
553 prefix = prefix + ' '; | 555 prefix = prefix + ' '; |
554 for (var child in children) | 556 for (var child in children) |
555 _serialiseDOM(child, prefix); | 557 _serialiseDOM(child, prefix); |
556 } | 558 } |
557 | 559 |
558 void dumpState() { | 560 void dumpState() { |
559 _serialiseDOM(sky.document); | 561 _serialiseDOM(sky.document); |
560 } | 562 } |
OLD | NEW |