Index: sky/sdk/lib/framework/app.dart |
diff --git a/sky/sdk/lib/framework/app.dart b/sky/sdk/lib/framework/app.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a10eeac5892d2b4dbd6ee1769d287a48fb165f55 |
--- /dev/null |
+++ b/sky/sdk/lib/framework/app.dart |
@@ -0,0 +1,35 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+import 'layout2.dart'; |
+import 'dart:sky' as sky; |
+ |
+class AppView { |
+ RenderView _renderView; |
+ |
+ void _beginFrame(double timeStamp) { |
+ RenderNode.flushLayout(); |
+ _renderView.paintFrame(); |
+ } |
+ |
+ void _handleEvent(sky.Event event) { |
+ if (event is! sky.PointerEvent) |
+ return; |
+ HitTestResult result = new HitTestResult(); |
+ _renderView.hitTest(result, x: event.x, y: event.y); |
+ result.path.reversed.forEach((RenderNode node) { |
+ node.handlePointer(event); |
+ }); |
+ } |
+ |
+ AppView(RenderBox root) { |
+ sky.view.setEventCallback(_handleEvent); |
+ sky.view.setBeginFrameCallback(_beginFrame); |
+ |
+ _renderView = new RenderView(root: root); |
+ _renderView.layout(newWidth: sky.view.width, newHeight: sky.view.height); |
+ |
+ sky.view.scheduleFrame(); |
+ } |
+} |