| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 import 'box.dart'; | 5 import 'box.dart'; |
| 6 import 'object.dart'; | 6 import 'object.dart'; |
| 7 | 7 |
| 8 class FlexBoxParentData extends BoxParentData with ContainerParentDataMixin<Rend
erBox> { | 8 class FlexBoxParentData extends BoxParentData with ContainerParentDataMixin<Rend
erBox> { |
| 9 int flex; | 9 int flex; |
| 10 void merge(FlexBoxParentData other) { | 10 void merge(FlexBoxParentData other) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 _direction = value; | 32 _direction = value; |
| 33 markNeedsLayout(); | 33 markNeedsLayout(); |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 void setParentData(RenderBox child) { | 37 void setParentData(RenderBox child) { |
| 38 if (child.parentData is! FlexBoxParentData) | 38 if (child.parentData is! FlexBoxParentData) |
| 39 child.parentData = new FlexBoxParentData(); | 39 child.parentData = new FlexBoxParentData(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 // We don't currently support this for RenderFlex |
| 43 double getMinIntrinsicWidth(BoxConstraints constraints) { |
| 44 assert(false); |
| 45 return constraints.constrainWidth(0.0); |
| 46 } |
| 47 |
| 48 // We don't currently support this for RenderFlex |
| 49 double getMaxIntrinsicWidth(BoxConstraints constraints) { |
| 50 assert(false); |
| 51 return constraints.constrainWidth(0.0); |
| 52 } |
| 53 |
| 54 // We don't currently support this for RenderFlex |
| 55 double getMinIntrinsicHeight(BoxConstraints constraints) { |
| 56 assert(false); |
| 57 return constraints.constrainHeight(0.0); |
| 58 } |
| 59 |
| 60 // We don't currently support this for RenderFlex |
| 61 double getMaxIntrinsicHeight(BoxConstraints constraints) { |
| 62 assert(false); |
| 63 return constraints.constrainHeight(0.0); |
| 64 } |
| 65 |
| 42 bool get sizedByParent => true; | 66 bool get sizedByParent => true; |
| 43 void performResize() { | 67 void performResize() { |
| 44 size = constraints.constrain(new Size(constraints.maxWidth, constraints.maxH
eight)); | 68 size = constraints.constrain(new Size(constraints.maxWidth, constraints.maxH
eight)); |
| 45 assert(size.height < double.INFINITY); | 69 assert(size.height < double.INFINITY); |
| 46 assert(size.width < double.INFINITY); | 70 assert(size.width < double.INFINITY); |
| 47 } | 71 } |
| 48 | 72 |
| 49 int _getFlex(RenderBox child) { | 73 int _getFlex(RenderBox child) { |
| 50 assert(child.parentData is FlexBoxParentData); | 74 assert(child.parentData is FlexBoxParentData); |
| 51 return child.parentData.flex != null ? child.parentData.flex : 0; | 75 return child.parentData.flex != null ? child.parentData.flex : 0; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } | 135 } |
| 112 | 136 |
| 113 void hitTestChildren(HitTestResult result, { Point position }) { | 137 void hitTestChildren(HitTestResult result, { Point position }) { |
| 114 defaultHitTestChildren(result, position: position); | 138 defaultHitTestChildren(result, position: position); |
| 115 } | 139 } |
| 116 | 140 |
| 117 void paint(RenderObjectDisplayList canvas) { | 141 void paint(RenderObjectDisplayList canvas) { |
| 118 defaultPaint(canvas); | 142 defaultPaint(canvas); |
| 119 } | 143 } |
| 120 } | 144 } |
| OLD | NEW |