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

Side by Side Diff: sky/sdk/lib/rendering/box.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 import 'dart:sky' as sky; 6 import 'dart:sky' as sky;
7 7
8 import 'package:vector_math/vector_math.dart'; 8 import 'package:vector_math/vector_math.dart';
9 9
10 import '../base/debug.dart'; 10 import '../base/debug.dart';
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 paint(canvas); 1126 paint(canvas);
1127 sky.view.picture = recorder.endRecording(); 1127 sky.view.picture = recorder.endRecording();
1128 } finally { 1128 } finally {
1129 RenderObject.debugDoingPaint = false; 1129 RenderObject.debugDoingPaint = false;
1130 sky.tracing.end('RenderView.paintFrame'); 1130 sky.tracing.end('RenderView.paintFrame');
1131 } 1131 }
1132 } 1132 }
1133 1133
1134 } 1134 }
1135 1135
1136 // DEFAULT BEHAVIORS FOR RENDERBOX CONTAINERS 1136 // HELPER METHODS FOR RENDERBOX CONTAINERS
1137 abstract class RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, Pare ntDataType extends ContainerParentDataMixin<ChildType>> implements ContainerRend erObjectMixin<ChildType, ParentDataType> { 1137 abstract class RenderBoxContainerDefaultsMixin<ChildType extends RenderBox, Pare ntDataType extends ContainerParentDataMixin<ChildType>> implements ContainerRend erObjectMixin<ChildType, ParentDataType> {
1138 1138
1139 // This class, by convention, doesn't override any members of the superclass.
1140 // It only provides helper functions that subclasses can call.
1141
1139 double defaultGetDistanceToFirstActualBaseline(TextBaseline baseline) { 1142 double defaultGetDistanceToFirstActualBaseline(TextBaseline baseline) {
1140 assert(!needsLayout); 1143 assert(!needsLayout);
1141 RenderBox child = firstChild; 1144 RenderBox child = firstChild;
1142 while (child != null) { 1145 while (child != null) {
1143 assert(child.parentData is ParentDataType); 1146 assert(child.parentData is ParentDataType);
1144 double result = child.getDistanceToActualBaseline(baseline); 1147 double result = child.getDistanceToActualBaseline(baseline);
1145 if (result != null) 1148 if (result != null)
1146 return result + child.parentData.position.y; 1149 return result + child.parentData.position.y;
1147 child = child.parentData.nextSibling; 1150 child = child.parentData.nextSibling;
1148 } 1151 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 1188
1186 void defaultPaint(RenderCanvas canvas) { 1189 void defaultPaint(RenderCanvas canvas) {
1187 RenderBox child = firstChild; 1190 RenderBox child = firstChild;
1188 while (child != null) { 1191 while (child != null) {
1189 assert(child.parentData is ParentDataType); 1192 assert(child.parentData is ParentDataType);
1190 canvas.paintChild(child, child.parentData.position); 1193 canvas.paintChild(child, child.parentData.position);
1191 child = child.parentData.nextSibling; 1194 child = child.parentData.nextSibling;
1192 } 1195 }
1193 } 1196 }
1194 } 1197 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698