OLD | NEW |
1 import 'dart:async'; | 1 import 'dart:async'; |
2 | 2 |
3 void assertHasParentNode(Node n) { assert(n.parentNode != null); } | 3 void assertHasParentNode(Node n) { assert(n.parentNode != null); } |
4 void assertHasParentNodes(List<Node> list) { | 4 void assertHasParentNodes(List<Node> list) { |
5 for (var n in list) { | 5 for (var n in list) { |
6 assertHasParentNode(n); | 6 assertHasParentNode(n); |
7 } | 7 } |
8 } | 8 } |
9 | 9 |
10 class Node { | 10 class Node { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 Document(); | 110 Document(); |
111 Element createElement(String tagName) { | 111 Element createElement(String tagName) { |
112 switch (tagName) { | 112 switch (tagName) { |
113 case 'img' : return new HTMLImageElement(); | 113 case 'img' : return new HTMLImageElement(); |
114 default : return new Element(); | 114 default : return new Element(); |
115 } | 115 } |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 class HTMLImageElement extends Element { | 119 class HTMLImageElement extends Element { |
120 Image(); | 120 HTMLImageElement(); |
121 String src; | 121 String src; |
122 Object style = {}; | 122 Object style = {}; |
123 } | 123 } |
124 | 124 |
125 class Event {} | 125 class Event {} |
126 | 126 |
127 class PointerEvent extends Event {} | 127 class PointerEvent extends Event {} |
128 class GestureEvent extends Event {} | 128 class GestureEvent extends Event {} |
129 class WheelEvent extends Event {} | 129 class WheelEvent extends Event {} |
130 | 130 |
131 typedef EventListener(Event event); | 131 typedef EventListener(Event event); |
132 | 132 |
133 void _callRAF(Function fn) { | 133 void _callRAF(Function fn) { |
134 fn(new DateTime.now().millisecondsSinceEpoch.toDouble()); | 134 fn(new DateTime.now().millisecondsSinceEpoch.toDouble()); |
135 } | 135 } |
136 | 136 |
137 class Window { | 137 class Window { |
138 int requestAnimationFrame(Function fn) { | 138 int requestAnimationFrame(Function fn) { |
139 new Timer(const Duration(milliseconds: 16), () { | 139 new Timer(const Duration(milliseconds: 16), () { |
140 _callRAF(fn); | 140 _callRAF(fn); |
141 }); | 141 }); |
| 142 return 1; |
142 } | 143 } |
143 | 144 |
144 void cancelAnimationFrame(int id) { | 145 void cancelAnimationFrame(int id) { |
145 } | 146 } |
146 } | 147 } |
147 | 148 |
148 Document document = new Document(); | 149 Document document = new Document(); |
149 | 150 |
150 Window window = new Window(); | 151 Window window = new Window(); |
151 | 152 |
152 class ClientRect { | 153 class ClientRect { |
153 double top | 154 double top; |
154 double right; | 155 double right; |
155 double bottomr; | 156 double bottomr; |
156 double left; | 157 double left; |
157 double width; | 158 double width; |
158 double height; | 159 double height; |
159 } | 160 } |
OLD | NEW |