Commit 9e7e2778 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Rename "detachChild" to "forgetChild" (#6845)

...to avoid confusion with "detachRenderObject" which is basically
unrelated.
parent 856fef87
......@@ -495,7 +495,7 @@ class RenderObjectToWidgetElement<T extends RenderObject> extends RootRenderObje
}
@override
void detachChild(Element child) {
void forgetChild(Element child) {
assert(child == _child);
_child = null;
}
......
......@@ -70,7 +70,7 @@ class _LayoutBuilderElement extends RenderObjectElement {
}
@override
void detachChild(Element child) {
void forgetChild(Element child) {
assert(child == _child);
_child = null;
}
......
......@@ -514,9 +514,9 @@ class _LazyBlockElement extends RenderObjectElement {
}
@override
void detachChild(Element child) {
void forgetChild(Element child) {
assert(() {
// TODO(ianh): implement detachChild for LazyBlock
// TODO(ianh): implement forgetChild for LazyBlock
throw new FlutterError(
'LazyBlock does not yet support GlobalKey reparenting of its children.\n'
'As a temporary workaround, wrap the child with the GlobalKey in a '
......
......@@ -418,7 +418,7 @@ class _TheatreElement extends RenderObjectElement {
static final Object _onstageSlot = new Object();
List<Element> _offstage;
final Set<Element> _detachedOffstageChildren = new HashSet<Element>();
final Set<Element> _forgottenOffstageChildren = new HashSet<Element>();
@override
void insertChildRenderObject(RenderBox child, dynamic slot) {
......@@ -462,7 +462,7 @@ class _TheatreElement extends RenderObjectElement {
if (_onstage != null)
visitor(_onstage);
for (Element child in _offstage) {
if (!_detachedOffstageChildren.contains(child))
if (!_forgottenOffstageChildren.contains(child))
visitor(child);
}
}
......@@ -474,13 +474,13 @@ class _TheatreElement extends RenderObjectElement {
}
@override
bool detachChild(Element child) {
bool forgetChild(Element child) {
if (child == _onstage) {
_onstage = null;
} else {
assert(_offstage.contains(child));
assert(!_detachedOffstageChildren.contains(child));
_detachedOffstageChildren.add(child);
assert(!_forgottenOffstageChildren.contains(child));
_forgottenOffstageChildren.add(child);
}
return true;
}
......@@ -503,8 +503,8 @@ class _TheatreElement extends RenderObjectElement {
super.update(newWidget);
assert(widget == newWidget);
_onstage = updateChild(_onstage, widget.onstage, _onstageSlot);
_offstage = updateChildren(_offstage, widget.offstage, detachedChildren: _detachedOffstageChildren);
_detachedOffstageChildren.clear();
_offstage = updateChildren(_offstage, widget.offstage, forgottenChildren: _forgottenOffstageChildren);
_forgottenOffstageChildren.clear();
}
}
......
......@@ -274,7 +274,7 @@ class _TableElement extends RenderObjectElement {
renderObject.setChild(childParentData.x, childParentData.y, null);
}
final Set<Element> _detachedChildren = new HashSet<Element>();
final Set<Element> _forgottenChildren = new HashSet<Element>();
@override
void update(Table newWidget) {
......@@ -300,17 +300,17 @@ class _TableElement extends RenderObjectElement {
}
newChildren.add(new _TableElementRow(
key: row.key,
children: updateChildren(oldChildren, row.children, detachedChildren: _detachedChildren)
children: updateChildren(oldChildren, row.children, forgottenChildren: _forgottenChildren)
));
}
while (oldUnkeyedRows.moveNext())
updateChildren(oldUnkeyedRows.current.children, const <Widget>[], detachedChildren: _detachedChildren);
updateChildren(oldUnkeyedRows.current.children, const <Widget>[], forgottenChildren: _forgottenChildren);
for (List<Element> oldChildren in oldKeyedRows.values.where((List<Element> list) => !taken.contains(list)))
updateChildren(oldChildren, const <Widget>[], detachedChildren: _detachedChildren);
updateChildren(oldChildren, const <Widget>[], forgottenChildren: _forgottenChildren);
assert(() { _debugWillReattachChildren = false; return true; });
_children = newChildren;
_updateRenderObjectChildren();
_detachedChildren.clear();
_forgottenChildren.clear();
super.update(newWidget);
assert(widget == newWidget);
}
......@@ -326,14 +326,14 @@ class _TableElement extends RenderObjectElement {
@override
void visitChildren(ElementVisitor visitor) {
for (Element child in _children.expand((_TableElementRow row) => row.children)) {
if (!_detachedChildren.contains(child))
if (!_forgottenChildren.contains(child))
visitor(child);
}
}
@override
bool detachChild(Element child) {
_detachedChildren.add(child);
bool forgetChild(Element child) {
_forgottenChildren.add(child);
return true;
}
}
......
......@@ -104,9 +104,9 @@ abstract class VirtualViewportElement extends RenderObjectElement {
}
@override
void detachChild(Element child) {
void forgetChild(Element child) {
assert(() {
// TODO(ianh): implement detachChild for VirtualViewport
// TODO(ianh): implement forgetChild for VirtualViewport
throw new FlutterError(
'$runtimeType does not yet support GlobalKey reparenting of its children.\n'
'As a temporary workaround, wrap the child with the GlobalKey in a '
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment