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

Unified Diff: sky/sdk/lib/widgets/widget.dart

Issue 1222393002: Trivial parts of https://codereview.chromium.org/1218183009/ so that that patch isn't confused by v… (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/widgets/widget.dart
diff --git a/sky/sdk/lib/widgets/widget.dart b/sky/sdk/lib/widgets/widget.dart
index 4d466c3bf16ece7eac8587bc9e03796f61731061..914b69922d12ab742943c598c13d585f4d6596f7 100644
--- a/sky/sdk/lib/widgets/widget.dart
+++ b/sky/sdk/lib/widgets/widget.dart
@@ -124,17 +124,19 @@ abstract class Widget {
void detachRoot();
// Returns the child which should be retained as the child of this node.
- Widget syncChild(Widget node, Widget oldNode, dynamic slot) {
+ Widget syncChild(Widget newNode, Widget oldNode, dynamic slot) {
- assert(oldNode is! Component || (oldNode is Component && !oldNode._disqualifiedFromEverAppearingAgain)); // TODO(ianh): Simplify this once the analyzer is cleverer
+ assert(oldNode is! Component ||
+ (oldNode is Component && !oldNode._disqualifiedFromEverAppearingAgain)); // TODO(ianh): Simplify this once the analyzer is cleverer
- if (node == oldNode) {
- assert(node == null || node.mounted);
- assert(node is! RenderObjectWrapper || (node is RenderObjectWrapper && node._ancestor != null)); // TODO(ianh): Simplify this once the analyzer is cleverer
- return node; // Nothing to do. Subtrees must be identical.
+ if (newNode == oldNode) {
+ assert(newNode == null || newNode.mounted);
+ assert(newNode is! RenderObjectWrapper ||
+ (newNode is RenderObjectWrapper && newNode._ancestor != null)); // TODO(ianh): Simplify this once the analyzer is cleverer
+ return newNode; // Nothing to do. Subtrees must be identical.
}
- if (node == null) {
+ if (newNode == null) {
// the child in this slot has gone away
assert(oldNode.mounted);
oldNode.detachRoot();
@@ -144,12 +146,12 @@ abstract class Widget {
}
if (oldNode != null) {
- if (oldNode.runtimeType == node.runtimeType && oldNode.key == node.key) {
- if (node._retainStatefulNodeIfPossible(oldNode)) {
+ if (oldNode.runtimeType == newNode.runtimeType && oldNode.key == newNode.key) {
+ if (newNode._retainStatefulNodeIfPossible(oldNode)) {
assert(oldNode.mounted);
- assert(!node.mounted);
+ assert(!newNode.mounted);
oldNode.setParent(this);
- oldNode._sync(node, slot);
+ oldNode._sync(newNode, slot);
assert(oldNode.root is RenderObject);
return oldNode;
}
@@ -161,11 +163,11 @@ abstract class Widget {
}
}
- assert(!node.mounted);
- node.setParent(this);
- node._sync(oldNode, slot);
- assert(node.root is RenderObject);
- return node;
+ assert(!newNode.mounted);
+ newNode.setParent(this);
+ newNode._sync(oldNode, slot);
+ assert(newNode.root is RenderObject);
+ return newNode;
}
String toString() {
@@ -436,20 +438,18 @@ abstract class Component extends Widget {
// assert(_built != null && old == null)
// 3) Syncing against an old version
// assert(_built == null && old != null)
- void _sync(Widget old, dynamic slot) {
+ void _sync(Component old, dynamic slot) {
assert(_built == null || old == null);
assert(!_disqualifiedFromEverAppearingAgain);
- Component oldComponent = old as Component;
-
_slot = slot;
var oldBuilt;
- if (oldComponent == null) {
+ if (old == null) {
oldBuilt = _built;
} else {
assert(_built == null);
- oldBuilt = oldComponent._built;
+ oldBuilt = old._built;
}
int lastOrder = _currentOrder;
« 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