Unverified Commit ce40de69 authored by Mehmet Fidanboylu's avatar Mehmet Fidanboylu Committed by GitHub

Revert "(insert|move|remove)ChildRenderObject Deprecation: Step 1 (#64189)" (#64249)

This reverts commit 21cfed34.
parent d9188c19
......@@ -448,13 +448,13 @@ class _CupertinoAlertRenderElement extends RenderObjectElement {
}
@override
void insertRenderObjectChild(RenderObject child, _AlertSections slot) {
void insertChildRenderObject(RenderObject child, _AlertSections slot) {
_placeChildInSlot(child, slot);
}
@override
void moveRenderObjectChild(RenderObject child, _AlertSections oldSlot, _AlertSections newSlot) {
_placeChildInSlot(child, newSlot);
void moveChildRenderObject(RenderObject child, _AlertSections slot) {
_placeChildInSlot(child, slot);
}
@override
......@@ -478,7 +478,7 @@ class _CupertinoAlertRenderElement extends RenderObjectElement {
}
@override
void removeRenderObjectChild(RenderObject child, _AlertSections slot) {
void removeChildRenderObject(RenderObject child) {
assert(child == renderObject.contentSection || child == renderObject.actionsSection);
if (renderObject.contentSection == child) {
renderObject.contentSection = null;
......
......@@ -433,7 +433,7 @@ class _CupertinoDialogRenderElement extends RenderObjectElement {
}
@override
void insertRenderObjectChild(RenderObject child, _AlertDialogSections slot) {
void insertChildRenderObject(RenderObject child, _AlertDialogSections slot) {
assert(slot != null);
switch (slot) {
case _AlertDialogSections.contentSection:
......@@ -446,7 +446,7 @@ class _CupertinoDialogRenderElement extends RenderObjectElement {
}
@override
void moveRenderObjectChild(RenderObject child, _AlertDialogSections oldSlot, _AlertDialogSections newSlot) {
void moveChildRenderObject(RenderObject child, _AlertDialogSections slot) {
assert(false);
}
......@@ -470,7 +470,7 @@ class _CupertinoDialogRenderElement extends RenderObjectElement {
}
@override
void removeRenderObjectChild(RenderObject child, _AlertDialogSections slot) {
void removeChildRenderObject(RenderObject child) {
assert(child == renderObject.contentSection || child == renderObject.actionsSection);
if (renderObject.contentSection == child) {
renderObject.contentSection = null;
......
......@@ -775,9 +775,10 @@ class _CupertinoTextSelectionToolbarItemsElement extends RenderObjectElement {
}
@override
void insertRenderObjectChild(RenderObject child, dynamic slot) {
void insertChildRenderObject(RenderObject child, dynamic slot) {
if (slot is _CupertinoTextSelectionToolbarItemsSlot) {
assert(child is RenderBox);
assert(slot is _CupertinoTextSelectionToolbarItemsSlot);
_updateRenderObject(child as RenderBox, slot);
assert(renderObject.childToSlot.containsKey(child));
assert(renderObject.slotToChild.containsKey(slot));
......@@ -793,9 +794,9 @@ class _CupertinoTextSelectionToolbarItemsElement extends RenderObjectElement {
// This is not reachable for children that don't have an IndexedSlot.
@override
void moveRenderObjectChild(RenderObject child, IndexedSlot<Element> oldSlot, IndexedSlot<Element> newSlot) {
void moveChildRenderObject(RenderObject child, IndexedSlot<Element> slot) {
assert(child.parent == renderObject);
renderObject.move(child as RenderBox, after: newSlot?.value?.renderObject as RenderBox);
renderObject.move(child as RenderBox, after: slot?.value?.renderObject as RenderBox);
}
static bool _shouldPaint(Element child) {
......@@ -803,20 +804,18 @@ class _CupertinoTextSelectionToolbarItemsElement extends RenderObjectElement {
}
@override
void removeRenderObjectChild(RenderObject child, dynamic slot) {
void removeChildRenderObject(RenderObject child) {
// Check if the child is in a slot.
if (slot is _CupertinoTextSelectionToolbarItemsSlot) {
if (renderObject.childToSlot.containsKey(child)) {
assert(child is RenderBox);
assert(renderObject.slotToChild.containsKey(slot));
assert(renderObject.childToSlot.containsKey(child));
_updateRenderObject(null, slot);
_updateRenderObject(null, renderObject.childToSlot[child]);
assert(!renderObject.childToSlot.containsKey(child));
assert(!renderObject.slotToChild.containsKey(slot));
return;
}
// Otherwise look for it in the list of children.
assert(slot is IndexedSlot);
assert(child.parent == renderObject);
renderObject.remove(child as RenderBox);
}
......
......@@ -2148,25 +2148,26 @@ class _RenderChipElement extends RenderObjectElement {
}
@override
void insertRenderObjectChild(RenderObject child, _ChipSlot slot) {
void insertChildRenderObject(RenderObject child, dynamic slotValue) {
assert(child is RenderBox);
assert(slotValue is _ChipSlot);
final _ChipSlot slot = slotValue as _ChipSlot;
_updateRenderObject(child, slot);
assert(renderObject.childToSlot.keys.contains(child));
assert(renderObject.slotToChild.keys.contains(slot));
}
@override
void removeRenderObjectChild(RenderObject child, _ChipSlot slot) {
void removeChildRenderObject(RenderObject child) {
assert(child is RenderBox);
assert(renderObject.childToSlot[child] == slot);
assert(renderObject.slotToChild[slot] == child);
_updateRenderObject(null, slot);
assert(renderObject.childToSlot.keys.contains(child));
_updateRenderObject(null, renderObject.childToSlot[child]);
assert(!renderObject.childToSlot.keys.contains(child));
assert(!renderObject.slotToChild.keys.contains(slot));
}
@override
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
void moveChildRenderObject(RenderObject child, dynamic slotValue) {
assert(false, 'not reachable');
}
}
......
......@@ -1654,25 +1654,26 @@ class _RenderDecorationElement extends RenderObjectElement {
}
@override
void insertRenderObjectChild(RenderObject child, _DecorationSlot slot) {
void insertChildRenderObject(RenderObject child, dynamic slotValue) {
assert(child is RenderBox);
assert(slotValue is _DecorationSlot);
final _DecorationSlot slot = slotValue as _DecorationSlot;
_updateRenderObject(child as RenderBox, slot);
assert(renderObject.childToSlot.keys.contains(child));
assert(renderObject.slotToChild.keys.contains(slot));
}
@override
void removeRenderObjectChild(RenderObject child, _DecorationSlot slot) {
void removeChildRenderObject(RenderObject child) {
assert(child is RenderBox);
assert(renderObject.childToSlot[child] == slot);
assert(renderObject.slotToChild[slot] == child);
_updateRenderObject(null, slot);
assert(renderObject.childToSlot.keys.contains(child));
_updateRenderObject(null, renderObject.childToSlot[child]);
assert(!renderObject.childToSlot.keys.contains(child));
assert(!renderObject.slotToChild.keys.contains(slot));
}
@override
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
void moveChildRenderObject(RenderObject child, dynamic slotValue) {
assert(false, 'not reachable');
}
}
......
......@@ -1250,25 +1250,26 @@ class _ListTileElement extends RenderObjectElement {
}
@override
void insertRenderObjectChild(RenderObject child, _ListTileSlot slot) {
void insertChildRenderObject(RenderObject child, dynamic slotValue) {
assert(child is RenderBox);
assert(slotValue is _ListTileSlot);
final _ListTileSlot slot = slotValue as _ListTileSlot;
_updateRenderObject(child as RenderBox, slot);
assert(renderObject.childToSlot.keys.contains(child));
assert(renderObject.slotToChild.keys.contains(slot));
}
@override
void removeRenderObjectChild(RenderObject child, _ListTileSlot slot) {
void removeChildRenderObject(RenderObject child) {
assert(child is RenderBox);
assert(renderObject.childToSlot[child] == slot);
assert(renderObject.slotToChild[slot] == child);
_updateRenderObject(null, slot);
assert(renderObject.childToSlot.keys.contains(child));
_updateRenderObject(null, renderObject.childToSlot[child]);
assert(!renderObject.childToSlot.keys.contains(child));
assert(!renderObject.slotToChild.keys.contains(slot));
}
@override
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
void moveChildRenderObject(RenderObject child, dynamic slotValue) {
assert(false, 'not reachable');
}
}
......
......@@ -1268,19 +1268,19 @@ class RenderObjectToWidgetElement<T extends RenderObject> extends RootRenderObje
RenderObjectWithChildMixin<T> get renderObject => super.renderObject as RenderObjectWithChildMixin<T>;
@override
void insertRenderObjectChild(RenderObject child, dynamic slot) {
void insertChildRenderObject(RenderObject child, dynamic slot) {
assert(slot == _rootChildSlot);
assert(renderObject.debugValidateChild(child));
renderObject.child = child as T;
}
@override
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
void moveChildRenderObject(RenderObject child, dynamic slot) {
assert(false);
}
@override
void removeRenderObjectChild(RenderObject child, dynamic slot) {
void removeChildRenderObject(RenderObject child) {
assert(renderObject.child == child);
renderObject.child = null;
}
......
......@@ -156,7 +156,7 @@ class _LayoutBuilderElement<ConstraintType extends Constraints> extends RenderOb
}
@override
void insertRenderObjectChild(RenderObject child, dynamic slot) {
void insertChildRenderObject(RenderObject child, dynamic slot) {
final RenderObjectWithChildMixin<RenderObject> renderObject = this.renderObject;
assert(slot == null);
assert(renderObject.debugValidateChild(child));
......@@ -165,12 +165,12 @@ class _LayoutBuilderElement<ConstraintType extends Constraints> extends RenderOb
}
@override
void moveRenderObjectChild(RenderObject child, dynamic oldSlot, dynamic newSlot) {
void moveChildRenderObject(RenderObject child, dynamic slot) {
assert(false);
}
@override
void removeRenderObjectChild(RenderObject child, dynamic slot) {
void removeChildRenderObject(RenderObject child) {
final RenderConstrainedLayoutBuilder<ConstraintType, RenderObject> renderObject = this.renderObject;
assert(renderObject.child == child);
renderObject.child = null;
......
......@@ -907,7 +907,7 @@ class ListWheelElement extends RenderObjectElement implements ListWheelChildMana
}
@override
void insertRenderObjectChild(RenderObject child, int slot) {
void insertChildRenderObject(RenderObject child, int slot) {
final RenderListWheelViewport renderObject = this.renderObject;
assert(renderObject.debugValidateChild(child));
renderObject.insert(child as RenderBox, after: _childElements[slot - 1]?.renderObject as RenderBox);
......@@ -915,7 +915,7 @@ class ListWheelElement extends RenderObjectElement implements ListWheelChildMana
}
@override
void moveRenderObjectChild(RenderObject child, int oldSlot, int newSlot) {
void moveChildRenderObject(RenderObject child, dynamic slot) {
const String moveChildRenderObjectErrorMessage =
'Currently we maintain the list in contiguous increasing order, so '
'moving children around is not allowed.';
......@@ -923,7 +923,7 @@ class ListWheelElement extends RenderObjectElement implements ListWheelChildMana
}
@override
void removeRenderObjectChild(RenderObject child, int slot) {
void removeChildRenderObject(RenderObject child) {
assert(child.parent == renderObject);
renderObject.remove(child as RenderBox);
}
......
......@@ -1273,7 +1273,7 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
}
@override
void insertRenderObjectChild(covariant RenderObject child, int slot) {
void insertChildRenderObject(covariant RenderObject child, int slot) {
assert(slot != null);
assert(_currentlyUpdatingChildIndex == slot);
assert(renderObject.debugValidateChild(child));
......@@ -1286,14 +1286,14 @@ class SliverMultiBoxAdaptorElement extends RenderObjectElement implements Render
}
@override
void moveRenderObjectChild(covariant RenderObject child, int oldSlot, int newSlot) {
assert(newSlot != null);
assert(_currentlyUpdatingChildIndex == newSlot);
void moveChildRenderObject(covariant RenderObject child, int slot) {
assert(slot != null);
assert(_currentlyUpdatingChildIndex == slot);
renderObject.move(child as RenderBox, after: _currentBeforeChild);
}
@override
void removeRenderObjectChild(covariant RenderObject child, int slot) {
void removeChildRenderObject(covariant RenderObject child) {
assert(_currentlyUpdatingChildIndex != null);
renderObject.remove(child as RenderBox);
}
......
......@@ -236,18 +236,18 @@ class _SliverPersistentHeaderElement extends RenderObjectElement {
}
@override
void insertRenderObjectChild(covariant RenderBox child, dynamic slot) {
void insertChildRenderObject(covariant RenderBox child, dynamic slot) {
assert(renderObject.debugValidateChild(child));
renderObject.child = child;
}
@override
void moveRenderObjectChild(covariant RenderObject child, dynamic oldSlot, dynamic newSlot) {
void moveChildRenderObject(covariant RenderObject child, dynamic slot) {
assert(false);
}
@override
void removeRenderObjectChild(covariant RenderObject child, dynamic slot) {
void removeChildRenderObject(covariant RenderObject child) {
renderObject.child = null;
}
......
......@@ -75,12 +75,12 @@ class _SliverPrototypeExtentListElement extends SliverMultiBoxAdaptorElement {
static final Object _prototypeSlot = Object();
@override
void insertRenderObjectChild(covariant RenderObject child, covariant dynamic slot) {
void insertChildRenderObject(covariant RenderObject child, covariant dynamic slot) {
if (slot == _prototypeSlot) {
assert(child is RenderBox);
renderObject.child = child as RenderBox;
} else {
super.insertRenderObjectChild(child, slot as int);
super.insertChildRenderObject(child, slot as int);
}
}
......@@ -91,19 +91,19 @@ class _SliverPrototypeExtentListElement extends SliverMultiBoxAdaptorElement {
}
@override
void moveRenderObjectChild(RenderBox child, dynamic oldSlot, dynamic newSlot) {
if (newSlot == _prototypeSlot)
void moveChildRenderObject(RenderBox child, dynamic slot) {
if (slot == _prototypeSlot)
assert(false); // There's only one prototype child so it cannot be moved.
else
super.moveRenderObjectChild(child, oldSlot as int, newSlot as int);
super.moveChildRenderObject(child, slot as int);
}
@override
void removeRenderObjectChild(RenderBox child, dynamic slot) {
void removeChildRenderObject(RenderBox child) {
if (renderObject.child == child)
renderObject.child = null;
else
super.removeRenderObjectChild(child, slot as int);
super.removeChildRenderObject(child);
}
@override
......
......@@ -303,16 +303,16 @@ class _TableElement extends RenderObjectElement {
}
@override
void insertRenderObjectChild(RenderObject child, IndexedSlot<Element> slot) {
void insertChildRenderObject(RenderObject child, IndexedSlot<Element> slot) {
renderObject.setupParentData(child);
}
@override
void moveRenderObjectChild(RenderObject child, IndexedSlot<Element> oldSlot, IndexedSlot<Element> newSlot) {
void moveChildRenderObject(RenderObject child, dynamic slot) {
}
@override
void removeRenderObjectChild(RenderObject child, IndexedSlot<Element> slot) {
void removeChildRenderObject(RenderObject child) {
final TableCellParentData childParentData = child.parentData as TableCellParentData;
renderObject.setChild(childParentData.x, childParentData.y, null);
}
......
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