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

Side by Side Diff: sky/sdk/lib/framework/app.dart

Issue 1154403002: Rearrange AppView so that the constructor is first. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 'layout2.dart'; 5 import 'layout2.dart';
6 import 'dart:sky' as sky; 6 import 'dart:sky' as sky;
7 7
8 class AppView { 8 class AppView {
9
10 AppView(RenderBox root) {
11 sky.view.setEventCallback(_handleEvent);
12 sky.view.setBeginFrameCallback(_beginFrame);
13
14 _renderView = new RenderView(root: root);
15 _renderView.layout(newWidth: sky.view.width, newHeight: sky.view.height);
16
17 sky.view.scheduleFrame();
18 }
19
9 RenderView _renderView; 20 RenderView _renderView;
10 21
11 void _beginFrame(double timeStamp) { 22 void _beginFrame(double timeStamp) {
12 RenderNode.flushLayout(); 23 RenderNode.flushLayout();
13 _renderView.paintFrame(); 24 _renderView.paintFrame();
14 } 25 }
15 26
16 void _handleEvent(sky.Event event) { 27 void _handleEvent(sky.Event event) {
17 if (event is! sky.PointerEvent) 28 if (event is! sky.PointerEvent)
18 return; 29 return;
19 HitTestResult result = new HitTestResult(); 30 HitTestResult result = new HitTestResult();
20 _renderView.hitTest(result, x: event.x, y: event.y); 31 _renderView.hitTest(result, x: event.x, y: event.y);
21 result.path.reversed.forEach((RenderNode node) { 32 result.path.reversed.forEach((RenderNode node) {
22 node.handlePointer(event); 33 node.handlePointer(event);
23 }); 34 });
24 } 35 }
25 36
26 AppView(RenderBox root) {
27 sky.view.setEventCallback(_handleEvent);
28 sky.view.setBeginFrameCallback(_beginFrame);
29
30 _renderView = new RenderView(root: root);
31 _renderView.layout(newWidth: sky.view.width, newHeight: sky.view.height);
32
33 sky.view.scheduleFrame();
34 }
35 } 37 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698