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 '../node.dart'; | 5 import '../node.dart'; |
6 import '../scheduler.dart' as scheduler; | 6 import '../scheduler.dart' as scheduler; |
7 import 'dart:math' as math; | 7 import 'dart:math' as math; |
8 import 'dart:sky' as sky; | 8 import 'dart:sky' as sky; |
9 | 9 |
10 class ParentData { | 10 class ParentData { |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 ChildType _child; | 222 ChildType _child; |
223 ChildType get child => _child; | 223 ChildType get child => _child; |
224 void set child (ChildType value) { | 224 void set child (ChildType value) { |
225 if (_child != null) | 225 if (_child != null) |
226 dropChild(_child); | 226 dropChild(_child); |
227 _child = value; | 227 _child = value; |
228 if (_child != null) | 228 if (_child != null) |
229 adoptChild(_child); | 229 adoptChild(_child); |
230 markNeedsLayout(); | 230 markNeedsLayout(); |
231 } | 231 } |
| 232 void attachChildren() { |
| 233 if (_child != null) |
| 234 _child.attach(); |
| 235 } |
| 236 void detachChildren() { |
| 237 if (_child != null) |
| 238 _child.detach(); |
| 239 } |
232 } | 240 } |
233 | 241 |
234 | 242 |
235 // GENERIC MIXIN FOR RENDER NODES WITH A LIST OF CHILDREN | 243 // GENERIC MIXIN FOR RENDER NODES WITH A LIST OF CHILDREN |
236 | 244 |
237 abstract class ContainerParentDataMixin<ChildType extends RenderNode> { | 245 abstract class ContainerParentDataMixin<ChildType extends RenderNode> { |
238 ChildType previousSibling; | 246 ChildType previousSibling; |
239 ChildType nextSibling; | 247 ChildType nextSibling; |
240 void detachSiblings() { | 248 void detachSiblings() { |
241 if (previousSibling != null) { | 249 if (previousSibling != null) { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 } | 382 } |
375 } | 383 } |
376 | 384 |
377 ChildType get firstChild => _firstChild; | 385 ChildType get firstChild => _firstChild; |
378 ChildType get lastChild => _lastChild; | 386 ChildType get lastChild => _lastChild; |
379 ChildType childAfter(ChildType child) { | 387 ChildType childAfter(ChildType child) { |
380 assert(child.parentData is ParentDataType); | 388 assert(child.parentData is ParentDataType); |
381 return child.parentData.nextSibling; | 389 return child.parentData.nextSibling; |
382 } | 390 } |
383 } | 391 } |
OLD | NEW |