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