| 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 'package:cassowary/cassowary.dart' as al; | 5 import 'package:cassowary/cassowary.dart' as al; |
| 6 import 'package:sky/rendering/box.dart'; | 6 import 'package:sky/rendering/box.dart'; |
| 7 import 'package:sky/rendering/object.dart'; | 7 import 'package:sky/rendering/object.dart'; |
| 8 | 8 |
| 9 /// Hosts the edge parameters and vends useful methods to construct expressions | 9 /// Hosts the edge parameters and vends useful methods to construct expressions |
| 10 /// for constraints. Also sets up and manages implicit constraints and edit | 10 /// for constraints. Also sets up and manages implicit constraints and edit |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 AutoLayoutParentData(this._renderBox) { | 95 AutoLayoutParentData(this._renderBox) { |
| 96 _setupLayoutParameters(this); | 96 _setupLayoutParameters(this); |
| 97 } | 97 } |
| 98 | 98 |
| 99 final RenderBox _renderBox; | 99 final RenderBox _renderBox; |
| 100 | 100 |
| 101 void _applyAutolayoutParameterUpdates() { | 101 void _applyAutolayoutParameterUpdates() { |
| 102 // This is called by the parent's layout function | 102 // This is called by the parent's layout function |
| 103 // to lay our box out. | 103 // to lay our box out. |
| 104 assert(_renderBox.parentData == this); | 104 assert(_renderBox.parentData == this); |
| 105 assert(_renderBox.parent.debugDoingThisLayout); | 105 assert(_renderBox.parent is RenderAutoLayout); |
| 106 assert((_renderBox.parent as RenderAutoLayout).debugDoingThisLayout); // TOD
O(ianh): Remove cast once the analyzer is cleverer |
| 106 BoxConstraints size = new BoxConstraints.tightFor( | 107 BoxConstraints size = new BoxConstraints.tightFor( |
| 107 width: _rightEdge.value - _leftEdge.value, | 108 width: _rightEdge.value - _leftEdge.value, |
| 108 height: _bottomEdge.value - _topEdge.value | 109 height: _bottomEdge.value - _topEdge.value |
| 109 ); | 110 ); |
| 110 _renderBox.layout(size); | 111 _renderBox.layout(size); |
| 111 position = new Point(_leftEdge.value, _topEdge.value); | 112 position = new Point(_leftEdge.value, _topEdge.value); |
| 112 } | 113 } |
| 113 | 114 |
| 114 List<al.Constraint> _constructImplicitConstraints() { | 115 List<al.Constraint> _constructImplicitConstraints() { |
| 115 return [ | 116 return [ |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 defaultPaint(canvas, offset); | 220 defaultPaint(canvas, offset); |
| 220 } | 221 } |
| 221 | 222 |
| 222 List<al.Constraint> _constructImplicitConstraints() { | 223 List<al.Constraint> _constructImplicitConstraints() { |
| 223 // Only edits variables are present on layout containers. If, in the future, | 224 // Only edits variables are present on layout containers. If, in the future, |
| 224 // implicit constraints (for say margins, padding, etc.) need to be added, | 225 // implicit constraints (for say margins, padding, etc.) need to be added, |
| 225 // they must be returned from here. | 226 // they must be returned from here. |
| 226 return null; | 227 return null; |
| 227 } | 228 } |
| 228 } | 229 } |
| OLD | NEW |