Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: sky/sdk/lib/rendering/auto_layout.dart

Issue 1231903003: Update cassowary dependency to 0.1.7 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/sdk/example/rendering/simple_autolayout.dart ('k') | sky/sdk/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import 'package:cassowary/cassowary.dart' as al; 7 import 'package:cassowary/cassowary.dart' as al;
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 10 matching lines...) Expand all
21 List<al.Constraint> _implicitConstraints; 21 List<al.Constraint> _implicitConstraints;
22 22
23 al.Param get leftEdge => _leftEdge; 23 al.Param get leftEdge => _leftEdge;
24 al.Param get rightEdge => _rightEdge; 24 al.Param get rightEdge => _rightEdge;
25 al.Param get topEdge => _topEdge; 25 al.Param get topEdge => _topEdge;
26 al.Param get bottomEdge => _bottomEdge; 26 al.Param get bottomEdge => _bottomEdge;
27 27
28 al.Expression get width => _rightEdge - _leftEdge; 28 al.Expression get width => _rightEdge - _leftEdge;
29 al.Expression get height => _bottomEdge - _topEdge; 29 al.Expression get height => _bottomEdge - _topEdge;
30 30
31 al.Expression get horizontalCenter => (_leftEdge + _rightEdge) / al.CM(2.0); 31 al.Expression get horizontalCenter => (_leftEdge + _rightEdge) / al.cm(2.0);
32 al.Expression get verticalCenter => (_topEdge + _bottomEdge) / al.CM(2.0); 32 al.Expression get verticalCenter => (_topEdge + _bottomEdge) / al.cm(2.0);
33 33
34 void _setupLayoutParameters(dynamic context) { 34 void _setupLayoutParameters(dynamic context) {
35 _leftEdge = new al.Param.withContext(context); 35 _leftEdge = new al.Param.withContext(context);
36 _rightEdge = new al.Param.withContext(context); 36 _rightEdge = new al.Param.withContext(context);
37 _topEdge = new al.Param.withContext(context); 37 _topEdge = new al.Param.withContext(context);
38 _bottomEdge = new al.Param.withContext(context); 38 _bottomEdge = new al.Param.withContext(context);
39 } 39 }
40 40
41 void _setupEditVariablesInSolver(al.Solver solver, double priority) { 41 void _setupEditVariablesInSolver(al.Solver solver, double priority) {
42 solver.addEditVariables([ 42 solver.addEditVariables([
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 height: _bottomEdge.value - _topEdge.value); 97 height: _bottomEdge.value - _topEdge.value);
98 98
99 _renderBox.layout(box, parentUsesSize: false); 99 _renderBox.layout(box, parentUsesSize: false);
100 position = new Point(_leftEdge.value, _topEdge.value); 100 position = new Point(_leftEdge.value, _topEdge.value);
101 } 101 }
102 102
103 @override 103 @override
104 List<al.Constraint> _constructImplicitConstraints() { 104 List<al.Constraint> _constructImplicitConstraints() {
105 return [ 105 return [
106 // The left edge must be positive 106 // The left edge must be positive
107 _leftEdge >= al.CM(0.0), 107 _leftEdge >= al.cm(0.0),
108 108
109 // Width must be positive 109 // Width must be positive
110 _rightEdge >= _leftEdge, 110 _rightEdge >= _leftEdge,
111 ]; 111 ];
112 } 112 }
113 } 113 }
114 114
115 class RenderAutoLayout extends RenderBox 115 class RenderAutoLayout extends RenderBox
116 with ContainerRenderObjectMixin<RenderBox, AutoLayoutParentData>, 116 with ContainerRenderObjectMixin<RenderBox, AutoLayoutParentData>,
117 RenderBoxContainerDefaultsMixin<RenderBox, AutoLayoutParentData>, 117 RenderBoxContainerDefaultsMixin<RenderBox, AutoLayoutParentData>,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 // Call super last as this collects parent data 216 // Call super last as this collects parent data
217 super.dropChild(child); 217 super.dropChild(child);
218 } 218 }
219 219
220 @override 220 @override
221 List<al.Constraint> _constructImplicitConstraints() { 221 List<al.Constraint> _constructImplicitConstraints() {
222 // Only edits are present on layout containers 222 // Only edits are present on layout containers
223 return null; 223 return null;
224 } 224 }
225 } 225 }
OLDNEW
« no previous file with comments | « sky/sdk/example/rendering/simple_autolayout.dart ('k') | sky/sdk/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698