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

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

Issue 1219113003: Make popup menus line up to their baseline per the Material spec. (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
Index: sky/sdk/lib/rendering/object.dart
diff --git a/sky/sdk/lib/rendering/object.dart b/sky/sdk/lib/rendering/object.dart
index 9624dc32ee022ec8246404ddd7c45fd39cbd9254..4898c79136fccc737662d1ae328194ed841162d9 100644
--- a/sky/sdk/lib/rendering/object.dart
+++ b/sky/sdk/lib/rendering/object.dart
@@ -70,7 +70,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
assert(child != null);
assert(child.parentData != null);
child.parentData.detach();
- child._cleanRelayoutSubtreeRoot();
+ child._maybeCleanParentDependencies();
super.dropChild(child);
markNeedsLayout();
}
@@ -122,17 +122,27 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
assert(parent == this.parent); // TODO(ianh): Remove this once the analyzer is cleverer
} else {
_nodesNeedingLayout.add(this);
- scheduler.ensureVisualUpdate();
}
}
- void _cleanRelayoutSubtreeRoot() {
- if (_relayoutSubtreeRoot != this) {
- _relayoutSubtreeRoot = null;
- _needsLayout = true;
- _cleanRelayoutSubtreeRootChildren();
- }
+ static bool _debugCleaningParentDependencies = false;
+ bool _debugSetCleaningParentDependencies(bool value) {
+ _debugCleaningParentDependencies = value;
+ return true;
+ }
+ void _maybeCleanParentDependencies() {
+ assert(_debugSetCleaningParentDependencies(true));
+ if (_relayoutSubtreeRoot != this)
+ cleanParentDependencies();
+ assert(_debugSetCleaningParentDependencies(false));
}
- void _cleanRelayoutSubtreeRootChildren() { } // workaround for lack of inter-class mixins in Dart
+ void cleanParentDependencies() {
+ assert(_debugCleaningParentDependencies);
+ assert(_relayoutSubtreeRoot != this);
+ _relayoutSubtreeRoot = null;
+ _needsLayout = true;
+ _cleanParentDependenciesChildren();
+ }
+ void _cleanParentDependenciesChildren() { } // workaround for lack of inter-class mixins in Dart
void scheduleInitialLayout() {
assert(attached);
assert(parent == null);
@@ -168,11 +178,12 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
_debugDoingThisLayout = false;
_debugCanParentUseSize = null;
} catch (e, stack) {
- print('Exception raised during layout of ${this}: ${e}');
+ print('Exception "${e}" raised during layout of:\n${this}');
print(stack);
return;
}
_needsLayout = false;
+ markNeedsPaint();
}
void layout(Constraints constraints, { bool parentUsesSize: false }) {
final parent = this.parent; // TODO(ianh): Remove this once the analyzer is cleverer
@@ -217,7 +228,7 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
//
// When calling layout() on your children, pass in
// "parentUsesSize: true" if your size or layout is dependent on
- // your child's size.
+ // your child's size or intrinsic dimensions.
// when the parent has rotated (e.g. when the screen has been turned
// 90 degrees), immediately prior to layout() being called for the
@@ -329,9 +340,9 @@ abstract class RenderObjectWithChildMixin<ChildType extends RenderObject> implem
if (_child != null)
_child.detach();
}
- void _cleanRelayoutSubtreeRootChildren() {
+ void _cleanParentDependenciesChildren() {
if (_child != null)
- _child._cleanRelayoutSubtreeRoot();
+ _child._maybeCleanParentDependencies();
}
String debugDescribeChildren(String prefix) {
if (child != null)
@@ -508,10 +519,10 @@ abstract class ContainerRenderObjectMixin<ChildType extends RenderObject, Parent
child = child.parentData.nextSibling;
}
}
- void _cleanRelayoutSubtreeRootChildren() {
+ void _cleanParentDependenciesChildren() {
ChildType child = _firstChild;
while (child != null) {
- child._cleanRelayoutSubtreeRoot();
+ child._maybeCleanParentDependencies();
assert(child.parentData is ParentDataType);
child = child.parentData.nextSibling;
}

Powered by Google App Engine
This is Rietveld 408576698