Commit 7a4bdc7f authored by Ian Hickson's avatar Ian Hickson

Merge pull request #870 from Hixie/RenderBlockViewport

Generalise RenderBlockViewport so that it can be used by a Widget that knows its children's dimensions.
parents b1468cb2 04a8fe8e
This diff is collapsed.
......@@ -292,6 +292,7 @@ abstract class Constraints {
typedef void RenderObjectVisitor(RenderObject child);
typedef void LayoutCallback(Constraints constraints);
typedef double DimensionCallback(Constraints constraints);
abstract class RenderObject extends AbstractNode implements HitTestTarget {
......
......@@ -117,13 +117,29 @@ class MixedViewport extends RenderObjectWrapper {
assert(renderObject == this.renderObject); // TODO(ianh): Remove this once the analyzer is cleverer
}
double _noIntrinsicDimensions(BoxConstraints constraints) {
assert(() {
'MixedViewport does not support returning intrinsic dimensions. ' +
'Calculating the intrinsic dimensions would require walking the entire child list, ' +
'which defeats the entire point of having a lazily-built list of children.';
return false;
});
return null;
}
void didMount() {
renderObject.callback = layout;
renderObject.totalExtentCallback = _noIntrinsicDimensions;
renderObject.maxCrossAxisDimensionCallback = _noIntrinsicDimensions;
renderObject.minCrossAxisDimensionCallback = _noIntrinsicDimensions;
super.didMount();
}
void didUnmount() {
renderObject.callback = null;
renderObject.totalExtentCallback = null;
renderObject.maxCrossAxisDimensionCallback = null;
renderObject.minCrossAxisDimensionCallback = null;
super.didUnmount();
}
......
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