Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 import 'dart:sky' as sky; | |
| 6 import 'box.dart'; | |
| 7 import 'node.dart'; | |
| 8 | |
| 9 class StackParentData extends BoxParentData with ContainerParentDataMixin<Render Box> { } | |
| 10 | |
| 11 class RenderStack extends RenderBox with ContainerRenderNodeMixin<RenderBox, Sta ckParentData>, | |
| 12 RenderBoxContainerDefaultsMixin<RenderB ox, StackParentData> { | |
| 13 RenderStack({ | |
| 14 List<RenderBox> children | |
| 15 }) { | |
| 16 if (children != null) | |
| 17 children.forEach((child) { add(child); }); | |
| 18 } | |
| 19 | |
| 20 void setParentData(RenderBox child) { | |
| 21 if (child.parentData is! StackParentData) | |
| 22 child.parentData = new StackParentData(); | |
| 23 } | |
| 24 | |
| 25 sky.Size getIntrinsicDimensions(BoxConstraints constraints) { | |
| 26 return constraints.constrain(new sky.Size.infinite()); | |
| 27 } | |
| 28 | |
| 29 void performLayout() { | |
| 30 size = constraints.constrain(new sky.Size.infinite()); | |
| 31 assert(size.width < double.INFINITY); | |
| 32 assert(size.height < double.INFINITY); | |
| 33 BoxConstraints innerConstraints = new BoxConstraints.loose(size); | |
| 34 | |
| 35 sky.Point origin = new sky.Point(0.0, 0.0); | |
|
Hixie
2015/06/03 21:39:56
const
| |
| 36 RenderBox child = firstChild; | |
| 37 while (child != null) { | |
| 38 child.layout(innerConstraints); | |
| 39 assert(child.parentData is StackParentData); | |
| 40 child.parentData.position = origin; | |
| 41 child = child.parentData.nextSibling; | |
| 42 } | |
| 43 } | |
| 44 | |
| 45 void hitTestChildren(HitTestResult result, { sky.Point position }) { | |
| 46 defaultHitTestChildren(result, position: position); | |
| 47 } | |
| 48 | |
| 49 void paint(RenderNodeDisplayList canvas) { | |
| 50 defaultPaint(canvas); | |
| 51 } | |
| 52 } | |
| OLD | NEW |