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

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

Issue 1196553004: Short-circuit the relayoutSubtreeRoot when the child couldn't change dimensions anyway because the … (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 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 | « sky/sdk/lib/rendering/box.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/rendering/object.dart
diff --git a/sky/sdk/lib/rendering/object.dart b/sky/sdk/lib/rendering/object.dart
index 75edf32f4e3cf35634087c08f7a112f0563eeeff..998bea32935f69fb34b7c1e0011c86776099e2b0 100644
--- a/sky/sdk/lib/rendering/object.dart
+++ b/sky/sdk/lib/rendering/object.dart
@@ -37,6 +37,11 @@ class RenderObjectDisplayList extends sky.PictureRecorder {
}
}
+abstract class Constraints {
+ const Constraints();
+ bool get isTight;
+}
+
abstract class RenderObject extends AbstractNode implements HitTestTarget {
// LAYOUT
@@ -79,8 +84,8 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
bool _needsLayout = true;
bool get needsLayout => _needsLayout;
RenderObject _relayoutSubtreeRoot;
- dynamic _constraints;
- dynamic get constraints => _constraints;
+ Constraints _constraints;
+ Constraints get constraints => _constraints;
bool debugAncestorsAlreadyMarkedNeedsLayout() {
if (_relayoutSubtreeRoot == null)
return true; // we haven't yet done layout even once, so there's nothing for us to do
@@ -156,10 +161,10 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
}
_needsLayout = false;
}
- void layout(dynamic constraints, { bool parentUsesSize: false }) {
+ void layout(Constraints constraints, { bool parentUsesSize: false }) {
final parent = this.parent; // TODO(ianh): Remove this once the analyzer is cleverer
RenderObject relayoutSubtreeRoot;
- if (!parentUsesSize || sizedByParent || parent is! RenderObject)
+ if (!parentUsesSize || sizedByParent || constraints.isTight || parent is! RenderObject)
relayoutSubtreeRoot = this;
else
relayoutSubtreeRoot = parent._relayoutSubtreeRoot;
« no previous file with comments | « sky/sdk/lib/rendering/box.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698