Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: sky/sdk/lib/rendering/block.dart

Issue 1211573003: Fill out some more documentation about building RenderBox subclasses. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 'dart:math' as math; 5 import 'dart:math' as math;
6 6
7 import 'box.dart'; 7 import 'box.dart';
8 import 'object.dart'; 8 import 'object.dart';
9 9
10 class BlockParentData extends BoxParentData with ContainerParentDataMixin<Render Box> { } 10 class BlockParentData extends BoxParentData with ContainerParentDataMixin<Render Box> { }
11 11
12 class RenderBlock extends RenderBox with ContainerRenderObjectMixin<RenderBox, B lockParentData>, 12 class RenderBlock extends RenderBox with ContainerRenderObjectMixin<RenderBox, B lockParentData>,
13 RenderBoxContainerDefaultsMixin<RenderB ox, BlockParentData> { 13 RenderBoxContainerDefaultsMixin<RenderB ox, BlockParentData> {
14 // lays out RenderBox children in a vertical stack 14 // lays out RenderBox children in a vertical stack
15 // uses the maximum width provided by the parent 15 // uses the maximum width provided by the parent
16 // sizes itself to the height of its child stack 16 // sizes itself to the height of its child stack
17 17
18 RenderBlock({ 18 RenderBlock({
19 List<RenderBox> children 19 List<RenderBox> children
20 }) { 20 }) {
21 if (children != null) 21 addAll(children);
22 children.forEach((child) { add(child); });
23 } 22 }
24 23
25 void setParentData(RenderBox child) { 24 void setParentData(RenderBox child) {
26 if (child.parentData is! BlockParentData) 25 if (child.parentData is! BlockParentData)
27 child.parentData = new BlockParentData(); 26 child.parentData = new BlockParentData();
28 } 27 }
29 28
30 double getMinIntrinsicWidth(BoxConstraints constraints) { 29 double getMinIntrinsicWidth(BoxConstraints constraints) {
31 double width = 0.0; 30 double width = 0.0;
32 BoxConstraints innerConstraints = new BoxConstraints( 31 BoxConstraints innerConstraints = new BoxConstraints(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 void hitTestChildren(HitTestResult result, { Point position }) { 102 void hitTestChildren(HitTestResult result, { Point position }) {
104 defaultHitTestChildren(result, position: position); 103 defaultHitTestChildren(result, position: position);
105 } 104 }
106 105
107 void paint(RenderCanvas canvas) { 106 void paint(RenderCanvas canvas) {
108 defaultPaint(canvas); 107 defaultPaint(canvas);
109 } 108 }
110 109
111 } 110 }
112 111
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698