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

Unified Diff: sky/sdk/lib/rendering/block.dart

Issue 1230833002: BlockViewport didn't implement the intrinsic dimension functions correctly. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/rendering/block.dart
diff --git a/sky/sdk/lib/rendering/block.dart b/sky/sdk/lib/rendering/block.dart
index 1573f3833744d54751c342fbe888ad69caf986a1..bc2b82e2042d8899f5985baab5ab9a2bf525880b 100644
--- a/sky/sdk/lib/rendering/block.dart
+++ b/sky/sdk/lib/rendering/block.dart
@@ -26,6 +26,50 @@ abstract class RenderBlockBase extends RenderBox with ContainerRenderObjectMixin
child.parentData = new BlockParentData();
}
+ double computeDistanceToActualBaseline(TextBaseline baseline) {
+ return defaultComputeDistanceToFirstActualBaseline(baseline);
+ }
+
+ double _childrenHeight;
+ double get childrenHeight => _childrenHeight;
+
+ void markNeedsLayout() {
+ _childrenHeight = null;
+ super.markNeedsLayout();
+ }
+
+ void performLayout() {
+ assert(constraints is BoxConstraints);
+ double width = constraints.constrainWidth(constraints.maxWidth);
+ BoxConstraints innerConstraints = _getInnerConstraintsForWidth(width);
+ double y = 0.0;
+ RenderBox child = firstChild;
+ while (child != null) {
+ child.layout(innerConstraints, parentUsesSize: true);
+ assert(child.parentData is BlockParentData);
+ child.parentData.position = new Point(0.0, y);
+ y += child.size.height;
+ child = child.parentData.nextSibling;
+ }
+ _childrenHeight = y;
+ }
+
+ void hitTestChildren(HitTestResult result, { Point position }) {
+ defaultHitTestChildren(result, position: position);
+ }
+
+ void paint(PaintingCanvas canvas, Offset offset) {
+ defaultPaint(canvas, offset);
+ }
+
+}
+
+class RenderBlock extends RenderBlockBase {
+
+ // sizes itself to the height of its child stack
+
+ RenderBlock({ List<RenderBox> children }) : super(children: children);
+
double getMinIntrinsicWidth(BoxConstraints constraints) {
double width = 0.0;
BoxConstraints innerConstraints = constraints.widthConstraints();
@@ -77,50 +121,6 @@ abstract class RenderBlockBase extends RenderBox with ContainerRenderObjectMixin
return _getIntrinsicHeight(constraints);
}
- double computeDistanceToActualBaseline(TextBaseline baseline) {
- return defaultComputeDistanceToFirstActualBaseline(baseline);
- }
-
- double _childrenHeight;
- double get childrenHeight => _childrenHeight;
-
- void markNeedsLayout() {
- _childrenHeight = null;
- super.markNeedsLayout();
- }
-
- void performLayout() {
- assert(constraints is BoxConstraints);
- double width = constraints.constrainWidth(constraints.maxWidth);
- BoxConstraints innerConstraints = _getInnerConstraintsForWidth(width);
- double y = 0.0;
- RenderBox child = firstChild;
- while (child != null) {
- child.layout(innerConstraints, parentUsesSize: true);
- assert(child.parentData is BlockParentData);
- child.parentData.position = new Point(0.0, y);
- y += child.size.height;
- child = child.parentData.nextSibling;
- }
- _childrenHeight = y;
- }
-
- void hitTestChildren(HitTestResult result, { Point position }) {
- defaultHitTestChildren(result, position: position);
- }
-
- void paint(PaintingCanvas canvas, Offset offset) {
- defaultPaint(canvas, offset);
- }
-
-}
-
-class RenderBlock extends RenderBlockBase {
-
- // sizes itself to the height of its child stack
-
- RenderBlock({ List<RenderBox> children }) : super(children: children);
-
bool _hasVisualOverflow = false;
void performLayout() {
@@ -182,6 +182,22 @@ class RenderBlockViewport extends RenderBlockBase {
markNeedsLayout();
}
+ double getMinIntrinsicWidth(BoxConstraints constraints) {
+ return constraints.constrainWidth();
+ }
+
+ double getMaxIntrinsicWidth(BoxConstraints constraints) {
+ return constraints.constrainWidth();
+ }
+
+ double getMinIntrinsicHeight(BoxConstraints constraints) {
+ return constraints.constrainHeight();
+ }
+
+ double getMaxIntrinsicHeight(BoxConstraints constraints) {
+ return constraints.constrainHeight();
+ }
+
bool get sizedByParent => true;
void performResize() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698