| 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 28 matching lines...) Expand all Loading... |
| 39 abstract class RenderObject extends AbstractNode { | 39 abstract class RenderObject extends AbstractNode { |
| 40 | 40 |
| 41 // LAYOUT | 41 // LAYOUT |
| 42 | 42 |
| 43 // parentData is only for use by the RenderObject that actually lays this | 43 // parentData is only for use by the RenderObject that actually lays this |
| 44 // node out, and any other nodes who happen to know exactly what | 44 // node out, and any other nodes who happen to know exactly what |
| 45 // kind of node that is. | 45 // kind of node that is. |
| 46 ParentData parentData; | 46 ParentData parentData; |
| 47 void setParentData(RenderObject child) { | 47 void setParentData(RenderObject child) { |
| 48 // override this to setup .parentData correctly for your class | 48 // override this to setup .parentData correctly for your class |
| 49 assert(!_debugDoingLayout); |
| 50 assert(!debugDoingPaint); |
| 49 if (child.parentData is! ParentData) | 51 if (child.parentData is! ParentData) |
| 50 child.parentData = new ParentData(); | 52 child.parentData = new ParentData(); |
| 51 } | 53 } |
| 52 | 54 |
| 53 void adoptChild(RenderObject child) { // only for use by subclasses | 55 void adoptChild(RenderObject child) { // only for use by subclasses |
| 54 // call this whenever you decide a node is a child | 56 // call this whenever you decide a node is a child |
| 57 assert(!_debugDoingLayout); |
| 58 assert(!debugDoingPaint); |
| 55 assert(child != null); | 59 assert(child != null); |
| 56 setParentData(child); | 60 setParentData(child); |
| 57 super.adoptChild(child); | 61 super.adoptChild(child); |
| 58 markNeedsLayout(); | 62 markNeedsLayout(); |
| 59 } | 63 } |
| 60 void dropChild(RenderObject child) { // only for use by subclasses | 64 void dropChild(RenderObject child) { // only for use by subclasses |
| 65 assert(!_debugDoingLayout); |
| 66 assert(!debugDoingPaint); |
| 61 assert(child != null); | 67 assert(child != null); |
| 62 assert(child.parentData != null); | 68 assert(child.parentData != null); |
| 63 child.parentData.detach(); | 69 child.parentData.detach(); |
| 64 if (child._relayoutSubtreeRoot != child) { | 70 if (child._relayoutSubtreeRoot != child) { |
| 65 child._relayoutSubtreeRoot = null; | 71 child._relayoutSubtreeRoot = null; |
| 66 child._needsLayout = true; | 72 child._needsLayout = true; |
| 67 } | 73 } |
| 68 super.dropChild(child); | 74 super.dropChild(child); |
| 69 markNeedsLayout(); | 75 markNeedsLayout(); |
| 70 } | 76 } |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 } | 395 } |
| 390 } | 396 } |
| 391 | 397 |
| 392 ChildType get firstChild => _firstChild; | 398 ChildType get firstChild => _firstChild; |
| 393 ChildType get lastChild => _lastChild; | 399 ChildType get lastChild => _lastChild; |
| 394 ChildType childAfter(ChildType child) { | 400 ChildType childAfter(ChildType child) { |
| 395 assert(child.parentData is ParentDataType); | 401 assert(child.parentData is ParentDataType); |
| 396 return child.parentData.nextSibling; | 402 return child.parentData.nextSibling; |
| 397 } | 403 } |
| 398 } | 404 } |
| OLD | NEW |