Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(737)

Unified Diff: sky/examples/fn/lib/fakesky.dart

Issue 1030423002: Move fakesky.dart from examples to benchmark/resources (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/benchmarks/resources/fakesky.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/fn/lib/fakesky.dart
diff --git a/sky/examples/fn/lib/fakesky.dart b/sky/examples/fn/lib/fakesky.dart
deleted file mode 100644
index b927f1452f9642a209bb31b0bc3ca2b8d91414db..0000000000000000000000000000000000000000
--- a/sky/examples/fn/lib/fakesky.dart
+++ /dev/null
@@ -1,160 +0,0 @@
-import 'dart:async';
-
-void assertHasParentNode(Node n) { assert(n.parentNode != null); }
-void assertHasParentNodes(List<Node> list) {
- for (var n in list) {
- assertHasParentNode(n);
- }
-}
-
-class Node {
-
- ParentNode parentNode;
- Node nextSibling;
- Node previousSibling;
- Node();
-
- void insertBefore(List<Node> nodes) {
- int count = nodes.length;
- while (count-- > 0) {
- parentNode._insertBefore(nodes[count], this);
- }
-
- assertHasParentNodes(nodes);
- }
-
- remove() {
- if (parentNode == null) {
- return;
- }
-
- if (nextSibling != null) {
- nextSibling.previousSibling = previousSibling;
- } else {
- parentNode.lastChild = previousSibling;
- }
-
- if (previousSibling != null) {
- previousSibling.nextSibling = nextSibling;
- } else {
- parentNode.firstChild = nextSibling;
- }
-
- parentNode = null;
- nextSibling = null;
- previousSibling = null;
- }
-}
-
-class Text extends Node {
- String data;
- Text(this.data) : super();
-}
-
-class ParentNode extends Node {
- Node firstChild;
- Node lastChild;
-
- ParentNode() : super();
-
- Node setChild(Node node) {
- firstChild = node;
- lastChild = node;
- node.parentNode = this;
- assertHasParentNode(node);
- return node;
- }
-
- Node _insertBefore(Node node, Node ref) {
- assert(ref == null || ref.parentNode == this);
-
- if (node.parentNode != null) {
- node.remove();
- }
-
- node.parentNode = this;
-
- if (firstChild == null && lastChild == null) {
- firstChild = node;
- lastChild = node;
- } else if (ref == null) {
- node.previousSibling = lastChild;
- lastChild.nextSibling = node;
- lastChild = node;
- } else {
- if (ref == firstChild) {
- assert(ref.previousSibling == null);
- firstChild = node;
- }
- node.previousSibling = ref.previousSibling;
- ref.previousSibling = node;
- node.nextSibling = ref;
- }
-
- assertHasParentNode(node);
- return node;
- }
-
- Node appendChild(Node node) {
- return _insertBefore(node, null);
- }
-}
-
-class Element extends ParentNode {
- void addEventListener(String type, EventListener listener, [bool useCapture = false]) {}
- void removeEventListener(String type, EventListener listener) {}
- void setAttribute(String name, [String value]) {}
-}
-
-class Document extends ParentNode {
- Document();
- Element createElement(String tagName) {
- switch (tagName) {
- case 'img' : return new HTMLImageElement();
- default : return new Element();
- }
- }
-}
-
-class HTMLImageElement extends Element {
- HTMLImageElement();
- String src;
- Object style = {};
-}
-
-class Event {}
-
-class PointerEvent extends Event {}
-class GestureEvent extends Event {}
-class WheelEvent extends Event {}
-
-typedef EventListener(Event event);
-
-void _callRAF(Function fn) {
- fn(new DateTime.now().millisecondsSinceEpoch.toDouble());
-}
-
-class Window {
- int requestAnimationFrame(Function fn) {
- new Timer(const Duration(milliseconds: 16), () {
- _callRAF(fn);
- });
- return 1;
- }
-
- void cancelAnimationFrame(int id) {
- }
-}
-
-Document document = new Document();
-
-Window window = new Window();
-
-class ClientRect {
- double top;
- double right;
- double bottomr;
- double left;
- double width;
- double height;
-}
« no previous file with comments | « sky/benchmarks/resources/fakesky.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698