Chromium Code Reviews| Index: sky/sdk/lib/framework/rendering/stack.dart |
| diff --git a/sky/sdk/lib/framework/rendering/stack.dart b/sky/sdk/lib/framework/rendering/stack.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..adad8ce6b90b3f2e6c877d91f65d2d3e2c59879c |
| --- /dev/null |
| +++ b/sky/sdk/lib/framework/rendering/stack.dart |
| @@ -0,0 +1,52 @@ |
| +// 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:sky' as sky; |
| +import 'box.dart'; |
| +import 'node.dart'; |
| + |
| +class StackParentData extends BoxParentData with ContainerParentDataMixin<RenderBox> { } |
| + |
| +class RenderStack extends RenderBox with ContainerRenderNodeMixin<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(); |
| + } |
| + |
| + sky.Size getIntrinsicDimensions(BoxConstraints constraints) { |
| + return constraints.constrain(new sky.Size.infinite()); |
| + } |
| + |
| + void performLayout() { |
| + size = constraints.constrain(new sky.Size.infinite()); |
| + assert(size.width < double.INFINITY); |
| + assert(size.height < double.INFINITY); |
| + BoxConstraints innerConstraints = new BoxConstraints.loose(size); |
| + |
| + sky.Point origin = new sky.Point(0.0, 0.0); |
|
Hixie
2015/06/03 21:39:56
const
|
| + 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, { sky.Point position }) { |
| + defaultHitTestChildren(result, position: position); |
| + } |
| + |
| + void paint(RenderNodeDisplayList canvas) { |
| + defaultPaint(canvas); |
| + } |
| +} |