Fix logic in RenderPadding.

Previously, we were not adjusting the minimum width, so we ended up
offsetting the child but not shrinking it, when the parent expected
the child to be exactly fit to its dimensions.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1155303005
This commit is contained in:
Hixie 2015-06-03 10:25:05 -07:00
parent 557b3e1ca4
commit d8c996994d
2 changed files with 43 additions and 0 deletions

View File

@ -0,0 +1,19 @@
CONSOLE: unittest-suite-wait-for-done
CONSOLE: TestView enabled
CONSOLE:
PAINT FOR FRAME #1 ----------------------------------------------
1 | TestDisplayList() constructor: 800.0 x 600.0
1 | paintChild at 0.0,0.0
1 | | TestDisplayList() constructor: 800.0 x 600.0
1 | | drawRect(0.0:0.0:600.0:800.0, Paint(0xff0000ff))
1 | | paintChild at 0.0,0.0
1 | | | TestDisplayList() constructor: 800.0 x 600.0
1 | | | paintChild at 50.0,50.0
1 | | | | TestDisplayList() constructor: 800.0 x 600.0
1 | | | | drawRect(0.0:0.0:100.0:700.0, Paint(0xff00ff00))
------------------------------------------------------------------------
CONSOLE: PASS: padding
CONSOLE:
CONSOLE: All 1 tests passed.
CONSOLE: unittest-suite-success
DONE

View File

@ -0,0 +1,24 @@
import '../resources/third_party/unittest/unittest.dart';
import '../resources/unit.dart';
import '../resources/display_list.dart';
import 'dart:math' as math;
import 'dart:sky' as sky;
import 'package:sky/framework/app.dart';
import 'package:sky/framework/rendering/box.dart';
import 'package:sky/framework/rendering/block.dart';
import 'package:sky/framework/rendering/node.dart';
TestApp app;
void main() {
initUnit();
test("padding", () {
var size = new RenderSizedBox(desiredSize: new sky.Size(double.INFINITY, 100.0));
var inner = new RenderDecoratedBox(decoration: new BoxDecoration(backgroundColor: 0xFF00FF00), child: size);
var padding = new RenderPadding(padding: new EdgeDims.all(50.0), child: inner);
var block = new RenderBlock(children: [padding]);
var outer = new RenderDecoratedBox(decoration: new BoxDecoration(backgroundColor: 0xFF0000FF), child: block);
app = new TestApp(outer);
});
}