Merge pull request #1995 from abarth/startup_assert

We throw an exception if you tap the screen during load
This commit is contained in:
Adam Barth
2015-11-06 14:52:03 -08:00
3 changed files with 10 additions and 4 deletions

View File

@@ -144,7 +144,7 @@ class FlutterBinding extends HitTestTarget {
_renderView = renderViewOverride;
}
assert(_renderView != null);
scheduler.addPersistentFrameCallback(beginFrame);
scheduler.addPersistentFrameCallback(_handlePersistentFrameCallback);
assert(_instance == this);
}
@@ -172,8 +172,12 @@ class FlutterBinding extends HitTestTarget {
listener(size);
}
void _handlePersistentFrameCallback(Duration timeStamp) {
beginFrame();
}
/// Pump the rendering pipeline to generate a frame for the given time stamp
void beginFrame(Duration timeStamp) {
void beginFrame() {
RenderObject.flushLayout();
_renderView.updateCompositingBits();
RenderObject.flushPaint();

View File

@@ -544,6 +544,7 @@ abstract class RenderBox extends RenderObject {
/// coordinate space of the callee. The callee is responsible for checking
/// whether the given position is within its bounds.
bool hitTest(HitTestResult result, { Point position }) {
assert(!needsLayout);
if (position.x >= 0.0 && position.x < _size.width &&
position.y >= 0.0 && position.y < _size.height) {
if (hitTestChildren(result, position: position) || hitTestSelf(position)) {

View File

@@ -22,9 +22,9 @@ class WidgetFlutterBinding extends FlutterBinding {
static WidgetFlutterBinding get instance => FlutterBinding.instance;
void beginFrame(Duration timeStamp) {
void beginFrame() {
buildDirtyElements();
super.beginFrame(timeStamp);
super.beginFrame();
Element.finalizeTree();
}
@@ -74,6 +74,7 @@ class WidgetFlutterBinding extends FlutterBinding {
container: renderView,
child: app
).attachToRenderTree(_renderViewElement);
beginFrame();
}
}