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 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
7 | 7 |
8 // ABSTRACT LAYOUT | 8 // ABSTRACT LAYOUT |
9 | 9 |
10 class ParentData { | 10 class ParentData { |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 assert(child.parentData is BlockParentData); | 818 assert(child.parentData is BlockParentData); |
819 child = child.parentData.nextSibling; | 819 child = child.parentData.nextSibling; |
820 } | 820 } |
821 | 821 |
822 return new BoxDimensions(width: outerWidth, | 822 return new BoxDimensions(width: outerWidth, |
823 height: constraints.constrainHeight(outerHeight)); | 823 height: constraints.constrainHeight(outerHeight)); |
824 } | 824 } |
825 | 825 |
826 void performLayout() { | 826 void performLayout() { |
827 assert(constraints is BoxConstraints); | 827 assert(constraints is BoxConstraints); |
828 size.width = constraints.constrainWidth(constraints.maxWidth); | 828 double width = constraints.constrainWidth(constraints.maxWidth); |
829 assert(size.width < double.INFINITY); | |
830 double y = 0.0; | 829 double y = 0.0; |
831 double innerWidth = size.width; | |
832 RenderBox child = firstChild; | 830 RenderBox child = firstChild; |
833 while (child != null) { | 831 while (child != null) { |
834 child.layout(new BoxConstraints(minWidth: innerWidth, maxWidth: innerWidth
), parentUsesSize: true); | 832 child.layout(new BoxConstraints(minWidth: width, maxWidth: width), parentU
sesSize: true); |
835 assert(child.parentData is BlockParentData); | 833 assert(child.parentData is BlockParentData); |
836 child.parentData.position = new sky.Point(0.0, y); | 834 child.parentData.position = new sky.Point(0.0, y); |
837 y += child.size.height; | 835 y += child.size.height; |
838 child = child.parentData.nextSibling; | 836 child = child.parentData.nextSibling; |
839 } | 837 } |
840 size.height = constraints.constrainHeight(y); | 838 size = new sky.Size(width, constraints.constrainHeight(y)); |
| 839 assert(size.width < double.INFINITY); |
| 840 assert(size.height < double.INFINITY); |
841 } | 841 } |
842 | 842 |
843 void hitTestChildren(HitTestResult result, { sky.Point position }) { | 843 void hitTestChildren(HitTestResult result, { sky.Point position }) { |
844 defaultHitTestChildren(result, position: position); | 844 defaultHitTestChildren(result, position: position); |
845 } | 845 } |
846 | 846 |
847 void paint(RenderNodeDisplayList canvas) { | 847 void paint(RenderNodeDisplayList canvas) { |
848 super.paint(canvas); | 848 super.paint(canvas); |
849 defaultPaint(canvas); | 849 defaultPaint(canvas); |
850 } | 850 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 | 990 |
991 void hitTestChildren(HitTestResult result, { double x, double y }) { | 991 void hitTestChildren(HitTestResult result, { double x, double y }) { |
992 // defaultHitTestChildren(result, x: x, y: y); | 992 // defaultHitTestChildren(result, x: x, y: y); |
993 } | 993 } |
994 | 994 |
995 void paint(RenderNodeDisplayList canvas) { | 995 void paint(RenderNodeDisplayList canvas) { |
996 super.paint(canvas); | 996 super.paint(canvas); |
997 _layoutRoot.paint(canvas); | 997 _layoutRoot.paint(canvas); |
998 } | 998 } |
999 } | 999 } |
OLD | NEW |