Clean up how we remove nodes from the render tree, and make sure we reinsert them in the right place.
Fixes weird behaviours when the old and new children of TagNodes can't be synced. R=abarth@chromium.org Review URL: https://codereview.chromium.org/1182463006.
This commit is contained in:
108
engine/src/flutter/tests/widgets/syncs1-expected.txt
Normal file
108
engine/src/flutter/tests/widgets/syncs1-expected.txt
Normal file
@@ -0,0 +1,108 @@
|
||||
CONSOLE: TestRenderView enabled
|
||||
CONSOLE:
|
||||
PAINT FOR FRAME #1 ----------------------------------------------
|
||||
1 | TestDisplayList() constructor: 800.0 x 600.0
|
||||
------------------------------------------------------------------------
|
||||
CONSOLE:
|
||||
PAINT FOR FRAME #2 ----------------------------------------------
|
||||
2 | TestDisplayList() constructor: 800.0 x 600.0
|
||||
2 | paintChild RenderBlock at Point(0.0, 0.0)
|
||||
2 | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
2 | | paintChild RenderConstrainedBox at Point(0.0, 0.0)
|
||||
2 | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
2 | | | paintChild RenderDecoratedBox at Point(0.0, 0.0)
|
||||
2 | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
2 | | | | drawRect(Rect.fromLTRB(0.0, 0.0, 425.0, 250.0), Paint(Color(0xff00ffff)))
|
||||
2 | | | paintChild RenderPadding at Point(425.0, 99.0)
|
||||
2 | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
2 | | | | paintChild RenderConstrainedBox at Point(8.0, 8.0)
|
||||
2 | | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
2 | | | | | drawRRect(Instance of 'RRect', Paint(Color(0xffe0e0e0)))
|
||||
2 | | | | | paintChild RenderPositionedBox at Point(8.0, 0.0)
|
||||
2 | | | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
2 | | | | | | paintChild RenderParagraph at Point(0.0, 10.0)
|
||||
2 | | | | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
2 | | paintChild RenderConstrainedBox at Point(0.0, 250.0)
|
||||
2 | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
2 | | | paintChild RenderDecoratedBox at Point(0.0, 0.0)
|
||||
2 | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
2 | | | | drawRect(Rect.fromLTRB(0.0, 0.0, 800.0, 250.0), Paint(Color(0xff00ffff)))
|
||||
2 | | | paintChild RenderPadding at Point(0.0, 0.0)
|
||||
2 | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
2 | | | | paintChild RenderConstrainedBox at Point(8.0, 8.0)
|
||||
2 | | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
2 | | | | | drawRRect(Instance of 'RRect', Paint(Color(0xffe0e0e0)))
|
||||
2 | | | | | paintChild RenderPositionedBox at Point(8.0, 0.0)
|
||||
2 | | | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
2 | | | | | | paintChild RenderParagraph at Point(212.5, 109.0)
|
||||
2 | | | | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
------------------------------------------------------------------------
|
||||
CONSOLE:
|
||||
PAINT FOR FRAME #3 ----------------------------------------------
|
||||
3 | TestDisplayList() constructor: 800.0 x 600.0
|
||||
3 | paintChild RenderBlock at Point(0.0, 0.0)
|
||||
3 | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
3 | | paintChild RenderConstrainedBox at Point(0.0, 0.0)
|
||||
3 | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
3 | | | paintChild RenderDecoratedBox at Point(0.0, 0.0)
|
||||
3 | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
3 | | | | drawRect(Rect.fromLTRB(0.0, 0.0, 549.0, 250.0), Paint(Color(0xefff9f00)))
|
||||
3 | | | paintChild RenderPadding at Point(549.0, 99.0)
|
||||
3 | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
3 | | | | paintChild RenderConstrainedBox at Point(8.0, 8.0)
|
||||
3 | | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
3 | | | | | drawRRect(Instance of 'RRect', Paint(Color(0xffe0e0e0)))
|
||||
3 | | | | | paintChild RenderPositionedBox at Point(8.0, 0.0)
|
||||
3 | | | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
3 | | | | | | paintChild RenderParagraph at Point(0.0, 10.0)
|
||||
3 | | | | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
3 | | paintChild RenderConstrainedBox at Point(0.0, 250.0)
|
||||
3 | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
3 | | | paintChild RenderDecoratedBox at Point(0.0, 0.0)
|
||||
3 | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
3 | | | | drawRect(Rect.fromLTRB(0.0, 0.0, 800.0, 250.0), Paint(Color(0xefff9f00)))
|
||||
3 | | | paintChild RenderPadding at Point(0.0, 0.0)
|
||||
3 | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
3 | | | | paintChild RenderConstrainedBox at Point(8.0, 8.0)
|
||||
3 | | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
3 | | | | | drawRRect(Instance of 'RRect', Paint(Color(0xffe0e0e0)))
|
||||
3 | | | | | paintChild RenderPositionedBox at Point(8.0, 0.0)
|
||||
3 | | | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
3 | | | | | | paintChild RenderParagraph at Point(274.5, 109.0)
|
||||
3 | | | | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
------------------------------------------------------------------------
|
||||
CONSOLE:
|
||||
PAINT FOR FRAME #4 ----------------------------------------------
|
||||
4 | TestDisplayList() constructor: 800.0 x 600.0
|
||||
4 | paintChild RenderBlock at Point(0.0, 0.0)
|
||||
4 | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
4 | | paintChild RenderConstrainedBox at Point(0.0, 0.0)
|
||||
4 | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
4 | | | paintChild RenderDecoratedBox at Point(0.0, 0.0)
|
||||
4 | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
4 | | | | drawRect(Rect.fromLTRB(0.0, 0.0, 425.0, 250.0), Paint(Color(0xff00ffff)))
|
||||
4 | | | paintChild RenderPadding at Point(425.0, 99.0)
|
||||
4 | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
4 | | | | paintChild RenderConstrainedBox at Point(8.0, 8.0)
|
||||
4 | | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
4 | | | | | drawRRect(Instance of 'RRect', Paint(Color(0xffe0e0e0)))
|
||||
4 | | | | | paintChild RenderPositionedBox at Point(8.0, 0.0)
|
||||
4 | | | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
4 | | | | | | paintChild RenderParagraph at Point(0.0, 10.0)
|
||||
4 | | | | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
4 | | paintChild RenderConstrainedBox at Point(0.0, 250.0)
|
||||
4 | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
4 | | | paintChild RenderDecoratedBox at Point(0.0, 0.0)
|
||||
4 | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
4 | | | | drawRect(Rect.fromLTRB(0.0, 0.0, 800.0, 250.0), Paint(Color(0xff00ffff)))
|
||||
4 | | | paintChild RenderPadding at Point(0.0, 0.0)
|
||||
4 | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
4 | | | | paintChild RenderConstrainedBox at Point(8.0, 8.0)
|
||||
4 | | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
4 | | | | | drawRRect(Instance of 'RRect', Paint(Color(0xffe0e0e0)))
|
||||
4 | | | | | paintChild RenderPositionedBox at Point(8.0, 0.0)
|
||||
4 | | | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
4 | | | | | | paintChild RenderParagraph at Point(212.5, 109.0)
|
||||
4 | | | | | | | TestDisplayList() constructor: 800.0 x 600.0
|
||||
------------------------------------------------------------------------
|
||||
PAINTED 4 FRAMES
|
||||
100
engine/src/flutter/tests/widgets/syncs1.dart
Normal file
100
engine/src/flutter/tests/widgets/syncs1.dart
Normal file
@@ -0,0 +1,100 @@
|
||||
// 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 'dart:async';
|
||||
|
||||
import 'package:sky/widgets/basic.dart';
|
||||
import 'package:sky/widgets/raised_button.dart';
|
||||
|
||||
import '../resources/display_list.dart';
|
||||
|
||||
class FiddleApp extends App {
|
||||
|
||||
bool arbitrarySetting = true;
|
||||
|
||||
void toggle() {
|
||||
setState(() {
|
||||
arbitrarySetting = !arbitrarySetting;
|
||||
});
|
||||
}
|
||||
|
||||
Widget buildFlex1() {
|
||||
return new Flex([
|
||||
new Flexible(child: new Container(
|
||||
decoration: new BoxDecoration(
|
||||
backgroundColor: const Color(0xFF00FFFF)
|
||||
)
|
||||
)),
|
||||
new RaisedButton(child: new Text('TAP ME TO CHANGE THE BACKGROUND COLOUR'), onPressed: toggle)
|
||||
]);
|
||||
}
|
||||
|
||||
Widget buildFlex2() {
|
||||
return new Flex([
|
||||
new Flexible(child: new Container(
|
||||
key: 'something-else',
|
||||
decoration: new BoxDecoration(
|
||||
backgroundColor: const Color(0xEFFF9F00)
|
||||
)
|
||||
)),
|
||||
new RaisedButton(child: new Text('PRESS ME TO CHANGE IT BACK'), onPressed: toggle)
|
||||
]);
|
||||
}
|
||||
|
||||
Widget buildStack1() {
|
||||
return new Stack([
|
||||
new Positioned(child: new Container(
|
||||
decoration: new BoxDecoration(
|
||||
backgroundColor: const Color(0xFF00FFFF)
|
||||
)
|
||||
)),
|
||||
new RaisedButton(child: new Text('TAP ME TO CHANGE THE BACKGROUND COLOUR'), onPressed: toggle)
|
||||
]);
|
||||
}
|
||||
|
||||
Widget buildStack2() {
|
||||
return new Stack([
|
||||
new Positioned(child: new Container(
|
||||
key: 'something-else',
|
||||
decoration: new BoxDecoration(
|
||||
backgroundColor: const Color(0xEFFF9F00)
|
||||
)
|
||||
)),
|
||||
new RaisedButton(child: new Text('PRESS ME TO CHANGE IT BACK'), onPressed: toggle)
|
||||
]);
|
||||
}
|
||||
|
||||
Widget build() {
|
||||
return new Block([
|
||||
new SizedBox(
|
||||
key: 'flex-example',
|
||||
height: 250.0,
|
||||
child: arbitrarySetting ? buildFlex1() : buildFlex2()
|
||||
),
|
||||
new SizedBox(
|
||||
key: 'stack-example',
|
||||
height: 250.0,
|
||||
child: arbitrarySetting ? buildStack1() : buildStack2()
|
||||
)
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
TestRenderView renderViewOverride = new TestRenderView();
|
||||
FiddleApp app = new FiddleApp();
|
||||
runApp(app, renderViewOverride: renderViewOverride);
|
||||
new Future.microtask(() {
|
||||
renderViewOverride.checkFrame();
|
||||
app.toggle();
|
||||
new Future.microtask(() {
|
||||
renderViewOverride.checkFrame();
|
||||
app.toggle();
|
||||
new Future.microtask(() {
|
||||
renderViewOverride.checkFrame();
|
||||
renderViewOverride.endTest();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user