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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 // // converted to the child's coordinate origin, and stop at the first chil
d | 217 // // converted to the child's coordinate origin, and stop at the first chil
d |
218 // // that returns true. | 218 // // that returns true. |
219 // // Then, add yourself to /result/, and return true. | 219 // // Then, add yourself to /result/, and return true. |
220 // } | 220 // } |
221 // You must not add yourself to /result/ if you return false. | 221 // You must not add yourself to /result/ if you return false. |
222 | 222 |
223 | 223 |
224 String toString([String prefix = '']) { | 224 String toString([String prefix = '']) { |
225 String header = '${runtimeType}\n'; | 225 String header = '${runtimeType}\n'; |
226 prefix += ' '; | 226 prefix += ' '; |
227 String settings = '${debugDescribeSettings(prefix)}'; | 227 return '${header}${debugDescribeSettings(prefix)}${debugDescribeChildren(pre
fix)}'; |
228 if (settings != '') | |
229 settings += '\n'; | |
230 return '${header}${settings}${debugDescribeChildren(prefix)}'; | |
231 } | 228 } |
232 String debugDescribeSettings(String prefix) => '${prefix}parentData: ${parentD
ata}'; | 229 String debugDescribeSettings(String prefix) => '${prefix}parentData: ${parentD
ata}\n'; |
233 String debugDescribeChildren(String prefix) => ''; | 230 String debugDescribeChildren(String prefix) => ''; |
234 | 231 |
235 } | 232 } |
236 | 233 |
237 class HitTestResult { | 234 class HitTestResult { |
238 final List<RenderObject> path = new List<RenderObject>(); | 235 final List<RenderObject> path = new List<RenderObject>(); |
239 | 236 |
240 RenderObject get result => path.first; | 237 RenderObject get result => path.first; |
241 | 238 |
242 void add(RenderObject node) { | 239 void add(RenderObject node) { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 ChildType childAfter(ChildType child) { | 415 ChildType childAfter(ChildType child) { |
419 assert(child.parentData is ParentDataType); | 416 assert(child.parentData is ParentDataType); |
420 return child.parentData.nextSibling; | 417 return child.parentData.nextSibling; |
421 } | 418 } |
422 | 419 |
423 String debugDescribeChildren(String prefix) { | 420 String debugDescribeChildren(String prefix) { |
424 String result = ''; | 421 String result = ''; |
425 int count = 1; | 422 int count = 1; |
426 ChildType child = _firstChild; | 423 ChildType child = _firstChild; |
427 while (child != null) { | 424 while (child != null) { |
428 if (result != '') | |
429 result += '\n'; | |
430 result += '${prefix}child ${count}: ${child.toString(prefix)}'; | 425 result += '${prefix}child ${count}: ${child.toString(prefix)}'; |
431 count += 1; | 426 count += 1; |
432 child = child.parentData.nextSibling; | 427 child = child.parentData.nextSibling; |
433 } | 428 } |
434 return result; | 429 return result; |
435 } | 430 } |
436 } | 431 } |
OLD | NEW |