Hixie 12aa568fc4 Export Point, Size, Rect, Color, Paint, Path, BoxDecoration, Border, BorderSide, EdgeDims, and FlexDirection from fn2.dart
That way most of our libraries don't have to use sky.Foo all over the place, and we can reduce the number of imports in most Dart components.

R=abarth@chromium.org

Review URL: https://codereview.chromium.org/1161323004
2015-06-05 10:18:50 -07:00

52 lines
1.6 KiB
Dart

// 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 'box.dart';
import 'object.dart';
class StackParentData extends BoxParentData with ContainerParentDataMixin<RenderBox> { }
class RenderStack extends RenderBox with ContainerRenderObjectMixin<RenderBox, StackParentData>,
RenderBoxContainerDefaultsMixin<RenderBox, StackParentData> {
RenderStack({
List<RenderBox> children
}) {
if (children != null)
children.forEach((child) { add(child); });
}
void setParentData(RenderBox child) {
if (child.parentData is! StackParentData)
child.parentData = new StackParentData();
}
Size getIntrinsicDimensions(BoxConstraints constraints) {
return constraints.constrain(Size.infinite);
}
void performLayout() {
size = constraints.constrain(Size.infinite);
assert(size.width < double.INFINITY);
assert(size.height < double.INFINITY);
BoxConstraints innerConstraints = new BoxConstraints.loose(size);
Point origin = new Point(0.0, 0.0);
RenderBox child = firstChild;
while (child != null) {
child.layout(innerConstraints);
assert(child.parentData is StackParentData);
child.parentData.position = origin;
child = child.parentData.nextSibling;
}
}
void hitTestChildren(HitTestResult result, { Point position }) {
defaultHitTestChildren(result, position: position);
}
void paint(RenderObjectDisplayList canvas) {
defaultPaint(canvas);
}
}