| 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 'dart:math' as math; | 5 import 'dart:math' as math; |
| 6 import 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
| 7 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
| 8 import 'object.dart'; | 8 import 'object.dart'; |
| 9 import '../painting/shadows.dart'; | 9 import '../painting/shadows.dart'; |
| 10 import 'package:vector_math/vector_math.dart'; | 10 import 'package:vector_math/vector_math.dart'; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 value = 37 * value + minWidth.hashCode; | 152 value = 37 * value + minWidth.hashCode; |
| 153 value = 37 * value + maxWidth.hashCode; | 153 value = 37 * value + maxWidth.hashCode; |
| 154 value = 37 * value + minHeight.hashCode; | 154 value = 37 * value + minHeight.hashCode; |
| 155 value = 37 * value + maxHeight.hashCode; | 155 value = 37 * value + maxHeight.hashCode; |
| 156 return value; | 156 return value; |
| 157 } | 157 } |
| 158 String toString() => "BoxConstraints($minWidth<=w<$maxWidth, $minHeight<=h<$ma
xHeight)"; | 158 String toString() => "BoxConstraints($minWidth<=w<$maxWidth, $minHeight<=h<$ma
xHeight)"; |
| 159 } | 159 } |
| 160 | 160 |
| 161 class BoxParentData extends ParentData { | 161 class BoxParentData extends ParentData { |
| 162 Point position = Point.origin; | 162 Point _position = Point.origin; |
| 163 Point get position => _position; |
| 164 void set position(Point value) { |
| 165 assert(RenderObject.debugDoingLayout); |
| 166 _position = value; |
| 167 } |
| 163 String toString() => 'position=$position'; | 168 String toString() => 'position=$position'; |
| 164 } | 169 } |
| 165 | 170 |
| 166 abstract class RenderBox extends RenderObject { | 171 abstract class RenderBox extends RenderObject { |
| 167 | 172 |
| 168 void setParentData(RenderObject child) { | 173 void setParentData(RenderObject child) { |
| 169 if (child.parentData is! BoxParentData) | 174 if (child.parentData is! BoxParentData) |
| 170 child.parentData = new BoxParentData(); | 175 child.parentData = new BoxParentData(); |
| 171 } | 176 } |
| 172 | 177 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 assert(sizedByParent); | 216 assert(sizedByParent); |
| 212 } | 217 } |
| 213 | 218 |
| 214 bool hitTest(HitTestResult result, { Point position }) { | 219 bool hitTest(HitTestResult result, { Point position }) { |
| 215 hitTestChildren(result, position: position); | 220 hitTestChildren(result, position: position); |
| 216 result.add(this); | 221 result.add(this); |
| 217 return true; | 222 return true; |
| 218 } | 223 } |
| 219 void hitTestChildren(HitTestResult result, { Point position }) { } | 224 void hitTestChildren(HitTestResult result, { Point position }) { } |
| 220 | 225 |
| 221 Size size = Size.zero; | 226 Size _size = Size.zero; |
| 227 Size get size => _size; |
| 228 void set size(Size value) { |
| 229 assert(RenderObject.debugDoingLayout); |
| 230 _size = value; |
| 231 } |
| 222 | 232 |
| 223 String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(
prefix)}${prefix}size: ${size}\n'; | 233 String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(
prefix)}${prefix}size: ${size}\n'; |
| 224 } | 234 } |
| 225 | 235 |
| 226 abstract class RenderProxyBox extends RenderBox with RenderObjectWithChildMixin<
RenderBox> { | 236 abstract class RenderProxyBox extends RenderBox with RenderObjectWithChildMixin<
RenderBox> { |
| 227 RenderProxyBox(RenderBox child) { | 237 RenderProxyBox(RenderBox child) { |
| 228 this.child = child; | 238 this.child = child; |
| 229 } | 239 } |
| 230 | 240 |
| 231 double getMinIntrinsicWidth(BoxConstraints constraints) { | 241 double getMinIntrinsicWidth(BoxConstraints constraints) { |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1006 | 1016 |
| 1007 void defaultPaint(RenderObjectDisplayList canvas) { | 1017 void defaultPaint(RenderObjectDisplayList canvas) { |
| 1008 RenderBox child = firstChild; | 1018 RenderBox child = firstChild; |
| 1009 while (child != null) { | 1019 while (child != null) { |
| 1010 assert(child.parentData is ParentDataType); | 1020 assert(child.parentData is ParentDataType); |
| 1011 canvas.paintChild(child, child.parentData.position); | 1021 canvas.paintChild(child, child.parentData.position); |
| 1012 child = child.parentData.nextSibling; | 1022 child = child.parentData.nextSibling; |
| 1013 } | 1023 } |
| 1014 } | 1024 } |
| 1015 } | 1025 } |
| OLD | NEW |