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 import 'dart:sky' show Point, Size, Rect, Color, Paint, Path; | 9 import 'dart:sky' show Point, Size, Rect, Color, Paint, Path; |
10 export 'dart:sky' show Point, Size, Rect, Color, Paint, Path; | 10 export 'dart:sky' show Point, Size, Rect, Color, Paint, Path; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 if (_relayoutSubtreeRoot != this) { | 112 if (_relayoutSubtreeRoot != this) { |
113 final parent = this.parent; // TODO(ianh): Remove this once the analyzer i
s cleverer | 113 final parent = this.parent; // TODO(ianh): Remove this once the analyzer i
s cleverer |
114 assert(parent is RenderObject); | 114 assert(parent is RenderObject); |
115 parent.markNeedsLayout(); | 115 parent.markNeedsLayout(); |
116 assert(parent == this.parent); // TODO(ianh): Remove this once the analyze
r is cleverer | 116 assert(parent == this.parent); // TODO(ianh): Remove this once the analyze
r is cleverer |
117 } else { | 117 } else { |
118 _nodesNeedingLayout.add(this); | 118 _nodesNeedingLayout.add(this); |
119 scheduler.ensureVisualUpdate(); | 119 scheduler.ensureVisualUpdate(); |
120 } | 120 } |
121 } | 121 } |
| 122 void scheduleInitialLayout() { |
| 123 assert(attached); |
| 124 assert(parent == null); |
| 125 assert(_relayoutSubtreeRoot == null); |
| 126 _relayoutSubtreeRoot = this; |
| 127 _nodesNeedingLayout.add(this); |
| 128 scheduler.ensureVisualUpdate(); |
| 129 } |
122 static void flushLayout() { | 130 static void flushLayout() { |
123 _debugDoingLayout = true; | 131 _debugDoingLayout = true; |
124 List<RenderObject> dirtyNodes = _nodesNeedingLayout; | 132 List<RenderObject> dirtyNodes = _nodesNeedingLayout; |
125 _nodesNeedingLayout = new List<RenderObject>(); | 133 _nodesNeedingLayout = new List<RenderObject>(); |
126 dirtyNodes..sort((a, b) => a.depth - b.depth)..forEach((node) { | 134 dirtyNodes..sort((a, b) => a.depth - b.depth)..forEach((node) { |
127 if (node._needsLayout && node.attached) | 135 if (node._needsLayout && node.attached) |
128 node._doLayout(); | 136 node._doLayout(); |
129 }); | 137 }); |
130 _debugDoingLayout = false; | 138 _debugDoingLayout = false; |
131 } | 139 } |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 int count = 1; | 451 int count = 1; |
444 ChildType child = _firstChild; | 452 ChildType child = _firstChild; |
445 while (child != null) { | 453 while (child != null) { |
446 result += '${prefix}child ${count}: ${child.toString(prefix)}'; | 454 result += '${prefix}child ${count}: ${child.toString(prefix)}'; |
447 count += 1; | 455 count += 1; |
448 child = child.parentData.nextSibling; | 456 child = child.parentData.nextSibling; |
449 } | 457 } |
450 return result; | 458 return result; |
451 } | 459 } |
452 } | 460 } |
OLD | NEW |