Commit 5ee721fe authored by Adam Barth's avatar Adam Barth

Merge pull request #1995 from abarth/startup_assert

We throw an exception if you tap the screen during load
parents 5cf258c4 060b34f7
...@@ -144,7 +144,7 @@ class FlutterBinding extends HitTestTarget { ...@@ -144,7 +144,7 @@ class FlutterBinding extends HitTestTarget {
_renderView = renderViewOverride; _renderView = renderViewOverride;
} }
assert(_renderView != null); assert(_renderView != null);
scheduler.addPersistentFrameCallback(beginFrame); scheduler.addPersistentFrameCallback(_handlePersistentFrameCallback);
assert(_instance == this); assert(_instance == this);
} }
...@@ -172,8 +172,12 @@ class FlutterBinding extends HitTestTarget { ...@@ -172,8 +172,12 @@ class FlutterBinding extends HitTestTarget {
listener(size); listener(size);
} }
void _handlePersistentFrameCallback(Duration timeStamp) {
beginFrame();
}
/// Pump the rendering pipeline to generate a frame for the given time stamp /// Pump the rendering pipeline to generate a frame for the given time stamp
void beginFrame(Duration timeStamp) { void beginFrame() {
RenderObject.flushLayout(); RenderObject.flushLayout();
_renderView.updateCompositingBits(); _renderView.updateCompositingBits();
RenderObject.flushPaint(); RenderObject.flushPaint();
......
...@@ -544,6 +544,7 @@ abstract class RenderBox extends RenderObject { ...@@ -544,6 +544,7 @@ abstract class RenderBox extends RenderObject {
/// coordinate space of the callee. The callee is responsible for checking /// coordinate space of the callee. The callee is responsible for checking
/// whether the given position is within its bounds. /// whether the given position is within its bounds.
bool hitTest(HitTestResult result, { Point position }) { bool hitTest(HitTestResult result, { Point position }) {
assert(!needsLayout);
if (position.x >= 0.0 && position.x < _size.width && if (position.x >= 0.0 && position.x < _size.width &&
position.y >= 0.0 && position.y < _size.height) { position.y >= 0.0 && position.y < _size.height) {
if (hitTestChildren(result, position: position) || hitTestSelf(position)) { if (hitTestChildren(result, position: position) || hitTestSelf(position)) {
......
...@@ -22,9 +22,9 @@ class WidgetFlutterBinding extends FlutterBinding { ...@@ -22,9 +22,9 @@ class WidgetFlutterBinding extends FlutterBinding {
static WidgetFlutterBinding get instance => FlutterBinding.instance; static WidgetFlutterBinding get instance => FlutterBinding.instance;
void beginFrame(Duration timeStamp) { void beginFrame() {
buildDirtyElements(); buildDirtyElements();
super.beginFrame(timeStamp); super.beginFrame();
Element.finalizeTree(); Element.finalizeTree();
} }
...@@ -74,6 +74,7 @@ class WidgetFlutterBinding extends FlutterBinding { ...@@ -74,6 +74,7 @@ class WidgetFlutterBinding extends FlutterBinding {
container: renderView, container: renderView,
child: app child: app
).attachToRenderTree(_renderViewElement); ).attachToRenderTree(_renderViewElement);
beginFrame();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment