Revert "[framework] inline AbstractNode into RenderObject" (#104257)
This commit is contained in:
parent
52e19ef7ec
commit
da105b2b24
@ -1566,7 +1566,9 @@ class _ActionButtonParentDataWidget
|
|||||||
parentData.isPressed = isPressed;
|
parentData.isPressed = isPressed;
|
||||||
|
|
||||||
// Force a repaint.
|
// Force a repaint.
|
||||||
renderObject.parent?.markNeedsPaint();
|
final AbstractNode? targetParent = renderObject.parent;
|
||||||
|
if (targetParent is RenderObject)
|
||||||
|
targetParent.markNeedsPaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
import 'dart:math' as math;
|
import 'dart:math' as math;
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/rendering.dart';
|
import 'package:flutter/rendering.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
@ -1085,9 +1086,9 @@ class TableRowInkWell extends InkResponse {
|
|||||||
RectCallback getRectCallback(RenderBox referenceBox) {
|
RectCallback getRectCallback(RenderBox referenceBox) {
|
||||||
return () {
|
return () {
|
||||||
RenderObject cell = referenceBox;
|
RenderObject cell = referenceBox;
|
||||||
RenderObject? table = cell.parent;
|
AbstractNode? table = cell.parent;
|
||||||
final Matrix4 transform = Matrix4.identity();
|
final Matrix4 transform = Matrix4.identity();
|
||||||
while (table != null && table is! RenderTable) {
|
while (table is RenderObject && table is! RenderTable) {
|
||||||
table.applyPaintTransform(cell, transform);
|
table.applyPaintTransform(cell, transform);
|
||||||
assert(table == cell.parent);
|
assert(table == cell.parent);
|
||||||
cell = table;
|
cell = table;
|
||||||
|
@ -683,7 +683,7 @@ abstract class InkFeature {
|
|||||||
RenderObject node = referenceBox;
|
RenderObject node = referenceBox;
|
||||||
while (node != _controller) {
|
while (node != _controller) {
|
||||||
final RenderObject childNode = node;
|
final RenderObject childNode = node;
|
||||||
node = node.parent!;
|
node = node.parent! as RenderObject;
|
||||||
if (!node.paintsChild(childNode)) {
|
if (!node.paintsChild(childNode)) {
|
||||||
// Some node between the reference box and this would skip painting on
|
// Some node between the reference box and this would skip painting on
|
||||||
// the reference box, so bail out early and avoid unnecessary painting.
|
// the reference box, so bail out early and avoid unnecessary painting.
|
||||||
|
@ -2145,7 +2145,7 @@ abstract class RenderBox extends RenderObject {
|
|||||||
assert(!_debugDoingBaseline, 'Please see the documentation for computeDistanceToActualBaseline for the required calling conventions of this method.');
|
assert(!_debugDoingBaseline, 'Please see the documentation for computeDistanceToActualBaseline for the required calling conventions of this method.');
|
||||||
assert(!debugNeedsLayout);
|
assert(!debugNeedsLayout);
|
||||||
assert(() {
|
assert(() {
|
||||||
final RenderObject? parent = this.parent;
|
final RenderObject? parent = this.parent as RenderObject?;
|
||||||
if (owner!.debugDoingLayout)
|
if (owner!.debugDoingLayout)
|
||||||
return (RenderObject.debugActiveLayout == parent) && parent!.debugDoingThisLayout;
|
return (RenderObject.debugActiveLayout == parent) && parent!.debugDoingThisLayout;
|
||||||
if (owner!.debugDoingPaint)
|
if (owner!.debugDoingPaint)
|
||||||
@ -2367,7 +2367,7 @@ abstract class RenderBox extends RenderObject {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void markNeedsLayout() {
|
void markNeedsLayout() {
|
||||||
if (_clearCachedData() && parent != null) {
|
if (_clearCachedData() && parent is RenderObject) {
|
||||||
markParentNeedsLayout();
|
markParentNeedsLayout();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1039,7 +1039,7 @@ class RenderListWheelViewport
|
|||||||
// `child` will be the last RenderObject before the viewport when walking up from `target`.
|
// `child` will be the last RenderObject before the viewport when walking up from `target`.
|
||||||
RenderObject child = target;
|
RenderObject child = target;
|
||||||
while (child.parent != this)
|
while (child.parent != this)
|
||||||
child = child.parent!;
|
child = child.parent! as RenderObject;
|
||||||
|
|
||||||
final ListWheelParentData parentData = child.parentData! as ListWheelParentData;
|
final ListWheelParentData parentData = child.parentData! as ListWheelParentData;
|
||||||
final double targetOffset = parentData.offset.dy; // the so-called "centerPosition"
|
final double targetOffset = parentData.offset.dy; // the so-called "centerPosition"
|
||||||
|
@ -909,10 +909,12 @@ class PipelineOwner {
|
|||||||
onNeedVisualUpdate?.call();
|
onNeedVisualUpdate?.call();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The unique [RenderObject] managed by this pipeline that has no parent.
|
/// The unique object managed by this pipeline that has no parent.
|
||||||
RenderObject? get rootNode => _rootNode;
|
///
|
||||||
RenderObject? _rootNode;
|
/// This object does not have to be a [RenderObject].
|
||||||
set rootNode(RenderObject? value) {
|
AbstractNode? get rootNode => _rootNode;
|
||||||
|
AbstractNode? _rootNode;
|
||||||
|
set rootNode(AbstractNode? value) {
|
||||||
if (_rootNode == value)
|
if (_rootNode == value)
|
||||||
return;
|
return;
|
||||||
_rootNode?.detach();
|
_rootNode?.detach();
|
||||||
@ -1320,174 +1322,13 @@ class PipelineOwner {
|
|||||||
/// [RenderObject.markNeedsLayout] so that if a parent has queried the intrinsic
|
/// [RenderObject.markNeedsLayout] so that if a parent has queried the intrinsic
|
||||||
/// or baseline information, it gets marked dirty whenever the child's geometry
|
/// or baseline information, it gets marked dirty whenever the child's geometry
|
||||||
/// changes.
|
/// changes.
|
||||||
abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarget {
|
abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin implements HitTestTarget {
|
||||||
/// Initializes internal fields for subclasses.
|
/// Initializes internal fields for subclasses.
|
||||||
RenderObject() {
|
RenderObject() {
|
||||||
_needsCompositing = isRepaintBoundary || alwaysNeedsCompositing;
|
_needsCompositing = isRepaintBoundary || alwaysNeedsCompositing;
|
||||||
_wasRepaintBoundary = isRepaintBoundary;
|
_wasRepaintBoundary = isRepaintBoundary;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The depth of this node in the tree.
|
|
||||||
///
|
|
||||||
/// The depth of nodes in a tree monotonically increases as you traverse down
|
|
||||||
/// the tree.
|
|
||||||
int get depth => _depth;
|
|
||||||
int _depth = 0;
|
|
||||||
|
|
||||||
/// Adjust the [depth] of the given [child] to be greater than this node's own
|
|
||||||
/// [depth].
|
|
||||||
///
|
|
||||||
/// Only call this method from overrides of [redepthChildren].
|
|
||||||
@protected
|
|
||||||
void redepthChild(RenderObject child) {
|
|
||||||
assert(child.owner == owner);
|
|
||||||
if (child._depth <= _depth) {
|
|
||||||
child._depth = _depth + 1;
|
|
||||||
child.redepthChildren();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Adjust the [depth] of this node's children, if any.
|
|
||||||
///
|
|
||||||
/// Override this method in subclasses with child nodes to call [redepthChild]
|
|
||||||
/// for each child. Do not call this method directly.
|
|
||||||
void redepthChildren() { }
|
|
||||||
|
|
||||||
/// The owner for this node (null if unattached).
|
|
||||||
///
|
|
||||||
/// The entire subtree that this node belongs to will have the same owner.
|
|
||||||
PipelineOwner? get owner => _owner;
|
|
||||||
PipelineOwner? _owner;
|
|
||||||
|
|
||||||
/// Whether this node is in a tree whose root is attached to something.
|
|
||||||
///
|
|
||||||
/// This becomes true during the call to [attach].
|
|
||||||
///
|
|
||||||
/// This becomes false during the call to [detach].
|
|
||||||
bool get attached => _owner != null;
|
|
||||||
|
|
||||||
/// Mark this node as attached to the given owner.
|
|
||||||
///
|
|
||||||
/// Typically called only from the [parent]'s [attach] method, and by the
|
|
||||||
/// [owner] to mark the root of a tree as attached.
|
|
||||||
///
|
|
||||||
/// Subclasses with children should override this method to first call their
|
|
||||||
/// inherited [attach] method, and then [attach] all their children to the
|
|
||||||
/// same [owner].
|
|
||||||
///
|
|
||||||
/// Implementations of this method should start with a call to the inherited
|
|
||||||
/// method, as in `super.attach(owner)`.
|
|
||||||
@mustCallSuper
|
|
||||||
void attach(PipelineOwner owner) {
|
|
||||||
assert(!_debugDisposed);
|
|
||||||
assert(owner != null);
|
|
||||||
assert(_owner == null);
|
|
||||||
_owner = owner;
|
|
||||||
|
|
||||||
// If the node was dirtied in some way while unattached, make sure to add
|
|
||||||
// it to the appropriate dirty list now that an owner is available
|
|
||||||
if (_needsLayout && _relayoutBoundary != null) {
|
|
||||||
// Don't enter this block if we've never laid out at all;
|
|
||||||
// scheduleInitialLayout() will handle it
|
|
||||||
_needsLayout = false;
|
|
||||||
markNeedsLayout();
|
|
||||||
}
|
|
||||||
if (_needsCompositingBitsUpdate) {
|
|
||||||
_needsCompositingBitsUpdate = false;
|
|
||||||
markNeedsCompositingBitsUpdate();
|
|
||||||
}
|
|
||||||
if (_needsPaint && _layerHandle.layer != null) {
|
|
||||||
// Don't enter this block if we've never painted at all;
|
|
||||||
// scheduleInitialPaint() will handle it
|
|
||||||
_needsPaint = false;
|
|
||||||
markNeedsPaint();
|
|
||||||
}
|
|
||||||
if (_needsSemanticsUpdate && _semanticsConfiguration.isSemanticBoundary) {
|
|
||||||
// Don't enter this block if we've never updated semantics at all;
|
|
||||||
// scheduleInitialSemantics() will handle it
|
|
||||||
_needsSemanticsUpdate = false;
|
|
||||||
markNeedsSemanticsUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Mark this node as detached.
|
|
||||||
///
|
|
||||||
/// Typically called only from the [parent]'s [detach], and by the [owner] to
|
|
||||||
/// mark the root of a tree as detached.
|
|
||||||
///
|
|
||||||
/// Subclasses with children should override this method to first call their
|
|
||||||
/// inherited [detach] method, and then [detach] all their children.
|
|
||||||
///
|
|
||||||
/// Implementations of this method should end with a call to the inherited
|
|
||||||
/// method, as in `super.detach()`.
|
|
||||||
@mustCallSuper
|
|
||||||
void detach() {
|
|
||||||
assert(_owner != null);
|
|
||||||
_owner = null;
|
|
||||||
assert(parent == null || attached == parent!.attached);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The parent of this node in the tree.
|
|
||||||
RenderObject? get parent => _parent;
|
|
||||||
RenderObject? _parent;
|
|
||||||
|
|
||||||
/// Called by subclasses when they decide a render object is a child.
|
|
||||||
///
|
|
||||||
/// Only for use by subclasses when changing their child lists. Calling this
|
|
||||||
/// in other cases will lead to an inconsistent tree and probably cause crashes.
|
|
||||||
@protected
|
|
||||||
@mustCallSuper
|
|
||||||
void adoptChild(RenderObject child) {
|
|
||||||
assert(_debugCanPerformMutations);
|
|
||||||
assert(child != null);
|
|
||||||
|
|
||||||
setupParentData(child);
|
|
||||||
markNeedsLayout();
|
|
||||||
markNeedsCompositingBitsUpdate();
|
|
||||||
markNeedsSemanticsUpdate();
|
|
||||||
|
|
||||||
assert(child != null);
|
|
||||||
assert(child._parent == null);
|
|
||||||
assert(() {
|
|
||||||
RenderObject node = this;
|
|
||||||
while (node.parent != null)
|
|
||||||
node = node.parent!;
|
|
||||||
assert(node != child); // indicates we are about to create a cycle
|
|
||||||
return true;
|
|
||||||
}());
|
|
||||||
child._parent = this;
|
|
||||||
if (attached)
|
|
||||||
child.attach(_owner!);
|
|
||||||
redepthChild(child);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Called by subclasses when they decide a render object is no longer a child.
|
|
||||||
///
|
|
||||||
/// Only for use by subclasses when changing their child lists. Calling this
|
|
||||||
/// in other cases will lead to an inconsistent tree and probably cause crashes.
|
|
||||||
@protected
|
|
||||||
@mustCallSuper
|
|
||||||
void dropChild(RenderObject child) {
|
|
||||||
assert(_debugCanPerformMutations);
|
|
||||||
assert(child != null);
|
|
||||||
assert(child.parentData != null);
|
|
||||||
|
|
||||||
child._cleanRelayoutBoundary();
|
|
||||||
child.parentData!.detach();
|
|
||||||
child.parentData = null;
|
|
||||||
|
|
||||||
assert(child != null);
|
|
||||||
assert(child._parent == this);
|
|
||||||
assert(child.attached == attached);
|
|
||||||
child._parent = null;
|
|
||||||
if (attached)
|
|
||||||
child.detach();
|
|
||||||
|
|
||||||
markNeedsLayout();
|
|
||||||
markNeedsCompositingBitsUpdate();
|
|
||||||
markNeedsSemanticsUpdate();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Cause the entire subtree rooted at the given [RenderObject] to be marked
|
/// Cause the entire subtree rooted at the given [RenderObject] to be marked
|
||||||
/// dirty for layout, paint, etc, so that the effects of a hot reload can be
|
/// dirty for layout, paint, etc, so that the effects of a hot reload can be
|
||||||
/// seen, or so that the effect of changing a global debug flag (such as
|
/// seen, or so that the effect of changing a global debug flag (such as
|
||||||
@ -1588,6 +1429,39 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
child.parentData = ParentData();
|
child.parentData = ParentData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Called by subclasses when they decide a render object is a child.
|
||||||
|
///
|
||||||
|
/// Only for use by subclasses when changing their child lists. Calling this
|
||||||
|
/// in other cases will lead to an inconsistent tree and probably cause crashes.
|
||||||
|
@override
|
||||||
|
void adoptChild(RenderObject child) {
|
||||||
|
assert(_debugCanPerformMutations);
|
||||||
|
assert(child != null);
|
||||||
|
setupParentData(child);
|
||||||
|
markNeedsLayout();
|
||||||
|
markNeedsCompositingBitsUpdate();
|
||||||
|
markNeedsSemanticsUpdate();
|
||||||
|
super.adoptChild(child);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Called by subclasses when they decide a render object is no longer a child.
|
||||||
|
///
|
||||||
|
/// Only for use by subclasses when changing their child lists. Calling this
|
||||||
|
/// in other cases will lead to an inconsistent tree and probably cause crashes.
|
||||||
|
@override
|
||||||
|
void dropChild(RenderObject child) {
|
||||||
|
assert(_debugCanPerformMutations);
|
||||||
|
assert(child != null);
|
||||||
|
assert(child.parentData != null);
|
||||||
|
child._cleanRelayoutBoundary();
|
||||||
|
child.parentData!.detach();
|
||||||
|
child.parentData = null;
|
||||||
|
super.dropChild(child);
|
||||||
|
markNeedsLayout();
|
||||||
|
markNeedsCompositingBitsUpdate();
|
||||||
|
markNeedsSemanticsUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
/// Calls visitor for each immediate child of this render object.
|
/// Calls visitor for each immediate child of this render object.
|
||||||
///
|
///
|
||||||
/// Override in subclasses with children and call the visitor for each child.
|
/// Override in subclasses with children and call the visitor for each child.
|
||||||
@ -1687,17 +1561,50 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
result = false;
|
result = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (node.parent == null) {
|
if (node.parent is! RenderObject) {
|
||||||
result = true;
|
result = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
node = node.parent!;
|
node = node.parent! as RenderObject;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}());
|
}());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
PipelineOwner? get owner => super.owner as PipelineOwner?;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void attach(PipelineOwner owner) {
|
||||||
|
assert(!_debugDisposed);
|
||||||
|
super.attach(owner);
|
||||||
|
// If the node was dirtied in some way while unattached, make sure to add
|
||||||
|
// it to the appropriate dirty list now that an owner is available
|
||||||
|
if (_needsLayout && _relayoutBoundary != null) {
|
||||||
|
// Don't enter this block if we've never laid out at all;
|
||||||
|
// scheduleInitialLayout() will handle it
|
||||||
|
_needsLayout = false;
|
||||||
|
markNeedsLayout();
|
||||||
|
}
|
||||||
|
if (_needsCompositingBitsUpdate) {
|
||||||
|
_needsCompositingBitsUpdate = false;
|
||||||
|
markNeedsCompositingBitsUpdate();
|
||||||
|
}
|
||||||
|
if (_needsPaint && _layerHandle.layer != null) {
|
||||||
|
// Don't enter this block if we've never painted at all;
|
||||||
|
// scheduleInitialPaint() will handle it
|
||||||
|
_needsPaint = false;
|
||||||
|
markNeedsPaint();
|
||||||
|
}
|
||||||
|
if (_needsSemanticsUpdate && _semanticsConfiguration.isSemanticBoundary) {
|
||||||
|
// Don't enter this block if we've never updated semantics at all;
|
||||||
|
// scheduleInitialSemantics() will handle it
|
||||||
|
_needsSemanticsUpdate = false;
|
||||||
|
markNeedsSemanticsUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Whether this render object's layout information is dirty.
|
/// Whether this render object's layout information is dirty.
|
||||||
///
|
///
|
||||||
/// This is only set in debug mode. In general, render objects should not need
|
/// This is only set in debug mode. In general, render objects should not need
|
||||||
@ -1759,7 +1666,7 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
while (node != _relayoutBoundary) {
|
while (node != _relayoutBoundary) {
|
||||||
assert(node._relayoutBoundary == _relayoutBoundary);
|
assert(node._relayoutBoundary == _relayoutBoundary);
|
||||||
assert(node.parent != null);
|
assert(node.parent != null);
|
||||||
node = node.parent!;
|
node = node.parent! as RenderObject;
|
||||||
if ((!node._needsLayout) && (!node._debugDoingThisLayout))
|
if ((!node._needsLayout) && (!node._debugDoingThisLayout))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1850,7 +1757,7 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
void markParentNeedsLayout() {
|
void markParentNeedsLayout() {
|
||||||
_needsLayout = true;
|
_needsLayout = true;
|
||||||
assert(this.parent != null);
|
assert(this.parent != null);
|
||||||
final RenderObject parent = this.parent!;
|
final RenderObject parent = this.parent! as RenderObject;
|
||||||
if (!_doingThisLayoutWithCallback) {
|
if (!_doingThisLayoutWithCallback) {
|
||||||
parent.markNeedsLayout();
|
parent.markNeedsLayout();
|
||||||
} else {
|
} else {
|
||||||
@ -1882,7 +1789,7 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
if (_relayoutBoundary == this) {
|
if (_relayoutBoundary == this) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final RenderObject? parentRelayoutBoundary = parent?._relayoutBoundary;
|
final RenderObject? parentRelayoutBoundary = (parent as RenderObject?)?._relayoutBoundary;
|
||||||
assert(parentRelayoutBoundary != null);
|
assert(parentRelayoutBoundary != null);
|
||||||
if (parentRelayoutBoundary != _relayoutBoundary) {
|
if (parentRelayoutBoundary != _relayoutBoundary) {
|
||||||
_relayoutBoundary = parentRelayoutBoundary;
|
_relayoutBoundary = parentRelayoutBoundary;
|
||||||
@ -1908,7 +1815,7 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
void scheduleInitialLayout() {
|
void scheduleInitialLayout() {
|
||||||
assert(!_debugDisposed);
|
assert(!_debugDisposed);
|
||||||
assert(attached);
|
assert(attached);
|
||||||
assert(parent == null);
|
assert(parent is! RenderObject);
|
||||||
assert(!owner!._debugDoingLayout);
|
assert(!owner!._debugDoingLayout);
|
||||||
assert(_relayoutBoundary == null);
|
assert(_relayoutBoundary == null);
|
||||||
_relayoutBoundary = this;
|
_relayoutBoundary = this;
|
||||||
@ -2022,8 +1929,8 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
));
|
));
|
||||||
assert(!_debugDoingThisResize);
|
assert(!_debugDoingThisResize);
|
||||||
assert(!_debugDoingThisLayout);
|
assert(!_debugDoingThisLayout);
|
||||||
final bool isRelayoutBoundary = !parentUsesSize || sizedByParent || constraints.isTight || parent == null;
|
final bool isRelayoutBoundary = !parentUsesSize || sizedByParent || constraints.isTight || parent is! RenderObject;
|
||||||
final RenderObject relayoutBoundary = isRelayoutBoundary ? this : parent!._relayoutBoundary!;
|
final RenderObject relayoutBoundary = isRelayoutBoundary ? this : (parent! as RenderObject)._relayoutBoundary!;
|
||||||
assert(() {
|
assert(() {
|
||||||
_debugCanParentUseSize = parentUsesSize;
|
_debugCanParentUseSize = parentUsesSize;
|
||||||
return true;
|
return true;
|
||||||
@ -2393,8 +2300,8 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
if (_needsCompositingBitsUpdate)
|
if (_needsCompositingBitsUpdate)
|
||||||
return;
|
return;
|
||||||
_needsCompositingBitsUpdate = true;
|
_needsCompositingBitsUpdate = true;
|
||||||
if (parent != null) {
|
if (parent is RenderObject) {
|
||||||
final RenderObject parent = this.parent!;
|
final RenderObject parent = this.parent! as RenderObject;
|
||||||
if (parent._needsCompositingBitsUpdate)
|
if (parent._needsCompositingBitsUpdate)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2535,8 +2442,8 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
owner!._nodesNeedingPaint.add(this);
|
owner!._nodesNeedingPaint.add(this);
|
||||||
owner!.requestVisualUpdate();
|
owner!.requestVisualUpdate();
|
||||||
}
|
}
|
||||||
} else if (parent != null) {
|
} else if (parent is RenderObject) {
|
||||||
final RenderObject parent = this.parent!;
|
final RenderObject parent = this.parent! as RenderObject;
|
||||||
parent.markNeedsPaint();
|
parent.markNeedsPaint();
|
||||||
assert(parent == this.parent);
|
assert(parent == this.parent);
|
||||||
} else {
|
} else {
|
||||||
@ -2604,8 +2511,8 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
assert(_needsPaint || _needsCompositedLayerUpdate);
|
assert(_needsPaint || _needsCompositedLayerUpdate);
|
||||||
assert(_layerHandle.layer != null);
|
assert(_layerHandle.layer != null);
|
||||||
assert(!_layerHandle.layer!.attached);
|
assert(!_layerHandle.layer!.attached);
|
||||||
RenderObject? node = parent;
|
AbstractNode? node = parent;
|
||||||
while (node != null) {
|
while (node is RenderObject) {
|
||||||
if (node.isRepaintBoundary) {
|
if (node.isRepaintBoundary) {
|
||||||
if (node._layerHandle.layer == null)
|
if (node._layerHandle.layer == null)
|
||||||
break; // looks like the subtree here has never been painted. let it handle itself.
|
break; // looks like the subtree here has never been painted. let it handle itself.
|
||||||
@ -2626,7 +2533,7 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
void scheduleInitialPaint(ContainerLayer rootLayer) {
|
void scheduleInitialPaint(ContainerLayer rootLayer) {
|
||||||
assert(rootLayer.attached);
|
assert(rootLayer.attached);
|
||||||
assert(attached);
|
assert(attached);
|
||||||
assert(parent == null);
|
assert(parent is! RenderObject);
|
||||||
assert(!owner!._debugDoingPaint);
|
assert(!owner!._debugDoingPaint);
|
||||||
assert(isRepaintBoundary);
|
assert(isRepaintBoundary);
|
||||||
assert(_layerHandle.layer == null);
|
assert(_layerHandle.layer == null);
|
||||||
@ -2644,7 +2551,7 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
assert(!_debugDisposed);
|
assert(!_debugDisposed);
|
||||||
assert(rootLayer.attached);
|
assert(rootLayer.attached);
|
||||||
assert(attached);
|
assert(attached);
|
||||||
assert(parent == null);
|
assert(parent is! RenderObject);
|
||||||
assert(!owner!._debugDoingPaint);
|
assert(!owner!._debugDoingPaint);
|
||||||
assert(isRepaintBoundary);
|
assert(isRepaintBoundary);
|
||||||
assert(_layerHandle.layer != null); // use scheduleInitialPaint the first time
|
assert(_layerHandle.layer != null); // use scheduleInitialPaint the first time
|
||||||
@ -2695,8 +2602,8 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
}
|
}
|
||||||
assert(() {
|
assert(() {
|
||||||
if (_needsCompositingBitsUpdate) {
|
if (_needsCompositingBitsUpdate) {
|
||||||
if (parent != null) {
|
if (parent is RenderObject) {
|
||||||
final RenderObject parent = this.parent!;
|
final RenderObject parent = this.parent! as RenderObject;
|
||||||
bool visitedByParent = false;
|
bool visitedByParent = false;
|
||||||
parent.visitChildren((RenderObject child) {
|
parent.visitChildren((RenderObject child) {
|
||||||
if (child == this) {
|
if (child == this) {
|
||||||
@ -2854,12 +2761,12 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
final bool ancestorSpecified = ancestor != null;
|
final bool ancestorSpecified = ancestor != null;
|
||||||
assert(attached);
|
assert(attached);
|
||||||
if (ancestor == null) {
|
if (ancestor == null) {
|
||||||
final RenderObject? rootNode = owner!.rootNode;
|
final AbstractNode? rootNode = owner!.rootNode;
|
||||||
if (rootNode != null)
|
if (rootNode is RenderObject)
|
||||||
ancestor = rootNode;
|
ancestor = rootNode;
|
||||||
}
|
}
|
||||||
final List<RenderObject> renderers = <RenderObject>[];
|
final List<RenderObject> renderers = <RenderObject>[];
|
||||||
for (RenderObject renderer = this; renderer != ancestor; renderer = renderer.parent!) {
|
for (RenderObject renderer = this; renderer != ancestor; renderer = renderer.parent! as RenderObject) {
|
||||||
renderers.add(renderer);
|
renderers.add(renderer);
|
||||||
assert(renderer.parent != null); // Failed to find ancestor in parent chain.
|
assert(renderer.parent != null); // Failed to find ancestor in parent chain.
|
||||||
}
|
}
|
||||||
@ -2927,7 +2834,7 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
void scheduleInitialSemantics() {
|
void scheduleInitialSemantics() {
|
||||||
assert(!_debugDisposed);
|
assert(!_debugDisposed);
|
||||||
assert(attached);
|
assert(attached);
|
||||||
assert(parent == null);
|
assert(parent is! RenderObject);
|
||||||
assert(!owner!._debugDoingSemantics);
|
assert(!owner!._debugDoingSemantics);
|
||||||
assert(_semantics == null);
|
assert(_semantics == null);
|
||||||
assert(_needsSemanticsUpdate);
|
assert(_needsSemanticsUpdate);
|
||||||
@ -2989,7 +2896,7 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
if (_semantics != null && !_semantics!.isMergedIntoParent) {
|
if (_semantics != null && !_semantics!.isMergedIntoParent) {
|
||||||
_semantics!.sendEvent(semanticsEvent);
|
_semantics!.sendEvent(semanticsEvent);
|
||||||
} else if (parent != null) {
|
} else if (parent != null) {
|
||||||
final RenderObject renderParent = parent!;
|
final RenderObject renderParent = parent! as RenderObject;
|
||||||
renderParent.sendSemanticsEvent(semanticsEvent);
|
renderParent.sendSemanticsEvent(semanticsEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3065,12 +2972,12 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
bool isEffectiveSemanticsBoundary = _semanticsConfiguration.isSemanticBoundary && wasSemanticsBoundary;
|
bool isEffectiveSemanticsBoundary = _semanticsConfiguration.isSemanticBoundary && wasSemanticsBoundary;
|
||||||
RenderObject node = this;
|
RenderObject node = this;
|
||||||
|
|
||||||
while (!isEffectiveSemanticsBoundary && node.parent != null) {
|
while (!isEffectiveSemanticsBoundary && node.parent is RenderObject) {
|
||||||
if (node != this && node._needsSemanticsUpdate)
|
if (node != this && node._needsSemanticsUpdate)
|
||||||
break;
|
break;
|
||||||
node._needsSemanticsUpdate = true;
|
node._needsSemanticsUpdate = true;
|
||||||
|
|
||||||
node = node.parent!;
|
node = node.parent! as RenderObject;
|
||||||
isEffectiveSemanticsBoundary = node._semanticsConfiguration.isSemanticBoundary;
|
isEffectiveSemanticsBoundary = node._semanticsConfiguration.isSemanticBoundary;
|
||||||
if (isEffectiveSemanticsBoundary && node._semantics == null) {
|
if (isEffectiveSemanticsBoundary && node._semantics == null) {
|
||||||
// We have reached a semantics boundary that doesn't own a semantics node.
|
// We have reached a semantics boundary that doesn't own a semantics node.
|
||||||
@ -3092,7 +2999,7 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
if (!node._needsSemanticsUpdate) {
|
if (!node._needsSemanticsUpdate) {
|
||||||
node._needsSemanticsUpdate = true;
|
node._needsSemanticsUpdate = true;
|
||||||
if (owner != null) {
|
if (owner != null) {
|
||||||
assert(node._semanticsConfiguration.isSemanticBoundary || node.parent == null);
|
assert(node._semanticsConfiguration.isSemanticBoundary || node.parent is! RenderObject);
|
||||||
owner!._nodesNeedingSemantics.add(node);
|
owner!._nodesNeedingSemantics.add(node);
|
||||||
owner!.requestVisualUpdate();
|
owner!.requestVisualUpdate();
|
||||||
}
|
}
|
||||||
@ -3101,7 +3008,7 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
|
|
||||||
/// Updates the semantic information of the render object.
|
/// Updates the semantic information of the render object.
|
||||||
void _updateSemantics() {
|
void _updateSemantics() {
|
||||||
assert(_semanticsConfiguration.isSemanticBoundary || parent == null);
|
assert(_semanticsConfiguration.isSemanticBoundary || parent is! RenderObject);
|
||||||
if (_needsLayout) {
|
if (_needsLayout) {
|
||||||
// There's not enough information in this subtree to compute semantics.
|
// There's not enough information in this subtree to compute semantics.
|
||||||
// The subtree is probably being kept alive by a viewport but not laid out.
|
// The subtree is probably being kept alive by a viewport but not laid out.
|
||||||
@ -3155,7 +3062,7 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
fragments.add(fragment);
|
fragments.add(fragment);
|
||||||
fragment.addAncestor(this);
|
fragment.addAncestor(this);
|
||||||
fragment.addTags(config.tagsForChildren);
|
fragment.addTags(config.tagsForChildren);
|
||||||
if (config.explicitChildNodes || parent == null) {
|
if (config.explicitChildNodes || parent is! RenderObject) {
|
||||||
fragment.markAsExplicit();
|
fragment.markAsExplicit();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -3180,7 +3087,7 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
_needsSemanticsUpdate = false;
|
_needsSemanticsUpdate = false;
|
||||||
|
|
||||||
_SemanticsFragment result;
|
_SemanticsFragment result;
|
||||||
if (parent == null) {
|
if (parent is! RenderObject) {
|
||||||
assert(!config.hasBeenAnnotated);
|
assert(!config.hasBeenAnnotated);
|
||||||
assert(!mergeIntoParent);
|
assert(!mergeIntoParent);
|
||||||
result = _RootSemanticsFragment(
|
result = _RootSemanticsFragment(
|
||||||
@ -3283,9 +3190,9 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
}
|
}
|
||||||
if (_relayoutBoundary != null && _relayoutBoundary != this) {
|
if (_relayoutBoundary != null && _relayoutBoundary != this) {
|
||||||
int count = 1;
|
int count = 1;
|
||||||
RenderObject? target = parent ;
|
RenderObject? target = parent as RenderObject?;
|
||||||
while (target != null && target != _relayoutBoundary) {
|
while (target != null && target != _relayoutBoundary) {
|
||||||
target = target.parent;
|
target = target.parent as RenderObject?;
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
header += ' relayoutBoundary=up$count';
|
header += ' relayoutBoundary=up$count';
|
||||||
@ -3404,8 +3311,8 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
Duration duration = Duration.zero,
|
Duration duration = Duration.zero,
|
||||||
Curve curve = Curves.ease,
|
Curve curve = Curves.ease,
|
||||||
}) {
|
}) {
|
||||||
if (parent != null) {
|
if (parent is RenderObject) {
|
||||||
final RenderObject renderParent = parent!;
|
final RenderObject renderParent = parent! as RenderObject;
|
||||||
renderParent.showOnScreen(
|
renderParent.showOnScreen(
|
||||||
descendant: descendant ?? this,
|
descendant: descendant ?? this,
|
||||||
rect: rect,
|
rect: rect,
|
||||||
@ -4329,12 +4236,12 @@ class _SemanticsGeometry {
|
|||||||
assert(transform != null);
|
assert(transform != null);
|
||||||
assert(clipRectTransform != null);
|
assert(clipRectTransform != null);
|
||||||
assert(clipRectTransform.isIdentity());
|
assert(clipRectTransform.isIdentity());
|
||||||
RenderObject intermediateParent = child.parent!;
|
RenderObject intermediateParent = child.parent! as RenderObject;
|
||||||
assert(intermediateParent != null);
|
assert(intermediateParent != null);
|
||||||
while (intermediateParent != ancestor) {
|
while (intermediateParent != ancestor) {
|
||||||
intermediateParent.applyPaintTransform(child, transform);
|
intermediateParent.applyPaintTransform(child, transform);
|
||||||
intermediateParent = intermediateParent.parent!;
|
intermediateParent = intermediateParent.parent! as RenderObject;
|
||||||
child = child.parent!;
|
child = child.parent! as RenderObject;
|
||||||
assert(intermediateParent != null);
|
assert(intermediateParent != null);
|
||||||
}
|
}
|
||||||
ancestor.applyPaintTransform(child, transform);
|
ancestor.applyPaintTransform(child, transform);
|
||||||
|
@ -43,7 +43,7 @@ abstract class RenderAbstractViewport extends RenderObject {
|
|||||||
while (object != null) {
|
while (object != null) {
|
||||||
if (object is RenderAbstractViewport)
|
if (object is RenderAbstractViewport)
|
||||||
return object;
|
return object;
|
||||||
object = object.parent;
|
object = object.parent as RenderObject?;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@ -764,7 +764,7 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
|
|||||||
RenderBox? pivot;
|
RenderBox? pivot;
|
||||||
bool onlySlivers = target is RenderSliver; // ... between viewport and `target` (`target` included).
|
bool onlySlivers = target is RenderSliver; // ... between viewport and `target` (`target` included).
|
||||||
while (child.parent != this) {
|
while (child.parent != this) {
|
||||||
final RenderObject parent = child.parent!;
|
final RenderObject parent = child.parent! as RenderObject;
|
||||||
assert(parent != null, '$target must be a descendant of $this');
|
assert(parent != null, '$target must be a descendant of $this');
|
||||||
if (child is RenderBox) {
|
if (child is RenderBox) {
|
||||||
pivot = child;
|
pivot = child;
|
||||||
@ -1214,7 +1214,7 @@ abstract class RenderViewportBase<ParentDataClass extends ContainerParentDataMix
|
|||||||
} else {
|
} else {
|
||||||
// `descendant` is between leading and trailing edge and hence already
|
// `descendant` is between leading and trailing edge and hence already
|
||||||
// fully shown on screen. No action necessary.
|
// fully shown on screen. No action necessary.
|
||||||
final Matrix4 transform = descendant.getTransformTo(viewport.parent);
|
final Matrix4 transform = descendant.getTransformTo(viewport.parent! as RenderObject);
|
||||||
return MatrixUtils.transformRect(transform, rect ?? descendant.paintBounds);
|
return MatrixUtils.transformRect(transform, rect ?? descendant.paintBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2169,8 +2169,8 @@ class LayoutId extends ParentDataWidget<MultiChildLayoutParentData> {
|
|||||||
final MultiChildLayoutParentData parentData = renderObject.parentData! as MultiChildLayoutParentData;
|
final MultiChildLayoutParentData parentData = renderObject.parentData! as MultiChildLayoutParentData;
|
||||||
if (parentData.id != id) {
|
if (parentData.id != id) {
|
||||||
parentData.id = id;
|
parentData.id = id;
|
||||||
final RenderObject? targetParent = renderObject.parent;
|
final AbstractNode? targetParent = renderObject.parent;
|
||||||
if (targetParent != null)
|
if (targetParent is RenderObject)
|
||||||
targetParent.markNeedsLayout();
|
targetParent.markNeedsLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4132,8 +4132,8 @@ class Positioned extends ParentDataWidget<StackParentData> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (needsLayout) {
|
if (needsLayout) {
|
||||||
final RenderObject? targetParent = renderObject.parent;
|
final AbstractNode? targetParent = renderObject.parent;
|
||||||
if (targetParent != null)
|
if (targetParent is RenderObject)
|
||||||
targetParent.markNeedsLayout();
|
targetParent.markNeedsLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4992,8 +4992,8 @@ class Flexible extends ParentDataWidget<FlexParentData> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (needsLayout) {
|
if (needsLayout) {
|
||||||
final RenderObject? targetParent = renderObject.parent;
|
final AbstractNode? targetParent = renderObject.parent;
|
||||||
if (targetParent != null)
|
if (targetParent is RenderObject)
|
||||||
targetParent.markNeedsLayout();
|
targetParent.markNeedsLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1747,8 +1747,8 @@ class KeepAlive extends ParentDataWidget<KeepAliveParentDataMixin> {
|
|||||||
final KeepAliveParentDataMixin parentData = renderObject.parentData! as KeepAliveParentDataMixin;
|
final KeepAliveParentDataMixin parentData = renderObject.parentData! as KeepAliveParentDataMixin;
|
||||||
if (parentData.keepAlive != keepAlive) {
|
if (parentData.keepAlive != keepAlive) {
|
||||||
parentData.keepAlive = keepAlive;
|
parentData.keepAlive = keepAlive;
|
||||||
final RenderObject? targetParent = renderObject.parent;
|
final AbstractNode? targetParent = renderObject.parent;
|
||||||
if (targetParent != null && !keepAlive)
|
if (targetParent is RenderObject && !keepAlive)
|
||||||
targetParent.markNeedsLayout(); // No need to redo layout if it became true.
|
targetParent.markNeedsLayout(); // No need to redo layout if it became true.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -433,8 +433,8 @@ class TableCell extends ParentDataWidget<TableCellParentData> {
|
|||||||
final TableCellParentData parentData = renderObject.parentData! as TableCellParentData;
|
final TableCellParentData parentData = renderObject.parentData! as TableCellParentData;
|
||||||
if (parentData.verticalAlignment != verticalAlignment) {
|
if (parentData.verticalAlignment != verticalAlignment) {
|
||||||
parentData.verticalAlignment = verticalAlignment;
|
parentData.verticalAlignment = verticalAlignment;
|
||||||
final RenderObject? targetParent = renderObject.parent;
|
final AbstractNode? targetParent = renderObject.parent;
|
||||||
if (targetParent != null)
|
if (targetParent is RenderObject)
|
||||||
targetParent.markNeedsLayout();
|
targetParent.markNeedsLayout();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -552,7 +552,7 @@ class _ScreenshotPaintingContext extends PaintingContext {
|
|||||||
}) {
|
}) {
|
||||||
RenderObject repaintBoundary = renderObject;
|
RenderObject repaintBoundary = renderObject;
|
||||||
while (repaintBoundary != null && !repaintBoundary.isRepaintBoundary) {
|
while (repaintBoundary != null && !repaintBoundary.isRepaintBoundary) {
|
||||||
repaintBoundary = repaintBoundary.parent!;
|
repaintBoundary = repaintBoundary.parent! as RenderObject;
|
||||||
}
|
}
|
||||||
assert(repaintBoundary != null);
|
assert(repaintBoundary != null);
|
||||||
final _ScreenshotData data = _ScreenshotData(target: renderObject);
|
final _ScreenshotData data = _ScreenshotData(target: renderObject);
|
||||||
@ -1510,7 +1510,7 @@ mixin WidgetInspectorService {
|
|||||||
final List<RenderObject> chain = <RenderObject>[];
|
final List<RenderObject> chain = <RenderObject>[];
|
||||||
while (renderObject != null) {
|
while (renderObject != null) {
|
||||||
chain.add(renderObject);
|
chain.add(renderObject);
|
||||||
renderObject = renderObject.parent;
|
renderObject = renderObject.parent as RenderObject?;
|
||||||
}
|
}
|
||||||
return _followDiagnosticableChain(chain.reversed.toList());
|
return _followDiagnosticableChain(chain.reversed.toList());
|
||||||
}
|
}
|
||||||
@ -2565,7 +2565,7 @@ class _RenderInspectorOverlay extends RenderBox {
|
|||||||
context.addLayer(_InspectorOverlayLayer(
|
context.addLayer(_InspectorOverlayLayer(
|
||||||
overlayRect: Rect.fromLTWH(offset.dx, offset.dy, size.width, size.height),
|
overlayRect: Rect.fromLTWH(offset.dx, offset.dy, size.width, size.height),
|
||||||
selection: selection,
|
selection: selection,
|
||||||
rootRenderObject: parent != null ? parent! : null,
|
rootRenderObject: parent is RenderObject ? parent! as RenderObject : null,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2841,14 +2841,14 @@ class _InspectorOverlayLayer extends Layer {
|
|||||||
/// overlays in the same app (i.e. an storyboard), a selected or candidate
|
/// overlays in the same app (i.e. an storyboard), a selected or candidate
|
||||||
/// render object may not belong to this tree.
|
/// render object may not belong to this tree.
|
||||||
bool _isInInspectorRenderObjectTree(RenderObject child) {
|
bool _isInInspectorRenderObjectTree(RenderObject child) {
|
||||||
RenderObject? current = child.parent;
|
RenderObject? current = child.parent as RenderObject?;
|
||||||
while (current != null) {
|
while (current != null) {
|
||||||
// We found the widget inspector render object.
|
// We found the widget inspector render object.
|
||||||
if (current is RenderStack
|
if (current is RenderStack
|
||||||
&& current.lastChild is _RenderInspectorOverlay) {
|
&& current.lastChild is _RenderInspectorOverlay) {
|
||||||
return rootRenderObject == current;
|
return rootRenderObject == current;
|
||||||
}
|
}
|
||||||
current = current.parent;
|
current = current.parent as RenderObject?;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1941,5 +1941,5 @@ Future<void> testGestureTap(WidgetTester tester, Finder tooltip) async {
|
|||||||
SemanticsNode findDebugSemantics(RenderObject object) {
|
SemanticsNode findDebugSemantics(RenderObject object) {
|
||||||
if (object.debugSemantics != null)
|
if (object.debugSemantics != null)
|
||||||
return object.debugSemantics!;
|
return object.debugSemantics!;
|
||||||
return findDebugSemantics(object.parent!);
|
return findDebugSemantics(object.parent! as RenderObject);
|
||||||
}
|
}
|
||||||
|
@ -1357,5 +1357,5 @@ void main() {
|
|||||||
SemanticsNode findDebugSemantics(RenderObject object) {
|
SemanticsNode findDebugSemantics(RenderObject object) {
|
||||||
if (object.debugSemantics != null)
|
if (object.debugSemantics != null)
|
||||||
return object.debugSemantics!;
|
return object.debugSemantics!;
|
||||||
return findDebugSemantics(object.parent!);
|
return findDebugSemantics(object.parent! as RenderObject);
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ void main() {
|
|||||||
expect(parentData!.offset.dy, -(viewHeight / 2.0));
|
expect(parentData!.offset.dy, -(viewHeight / 2.0));
|
||||||
expect(test.calls, 2); // The layout constraints change will clear the cached data.
|
expect(test.calls, 2); // The layout constraints change will clear the cached data.
|
||||||
|
|
||||||
final RenderObject parent = test.parent!;
|
final RenderObject parent = test.parent! as RenderObject;
|
||||||
expect(parent.debugNeedsLayout, false);
|
expect(parent.debugNeedsLayout, false);
|
||||||
|
|
||||||
// Do not forget notify parent dirty after the cached data be cleared by `layout()`
|
// Do not forget notify parent dirty after the cached data be cleared by `layout()`
|
||||||
|
@ -935,7 +935,7 @@ void main() {
|
|||||||
editable.painter = null;
|
editable.painter = null;
|
||||||
editable.paintCount = 0;
|
editable.paintCount = 0;
|
||||||
|
|
||||||
final RenderObject? parent = editable.parent;
|
final AbstractNode? parent = editable.parent;
|
||||||
if (parent is RenderConstrainedBox)
|
if (parent is RenderConstrainedBox)
|
||||||
parent.child = null;
|
parent.child = null;
|
||||||
});
|
});
|
||||||
|
@ -0,0 +1,61 @@
|
|||||||
|
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||||
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:flutter/rendering.dart';
|
||||||
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
|
import 'rendering_tester.dart';
|
||||||
|
|
||||||
|
class RealRoot extends AbstractNode {
|
||||||
|
RealRoot(this.child) {
|
||||||
|
adoptChild(child);
|
||||||
|
}
|
||||||
|
|
||||||
|
final RenderObject child;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void redepthChildren() {
|
||||||
|
redepthChild(child);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void attach(Object owner) {
|
||||||
|
super.attach(owner);
|
||||||
|
child.attach(owner as PipelineOwner);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void detach() {
|
||||||
|
super.detach();
|
||||||
|
child.detach();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
PipelineOwner? get owner => super.owner as PipelineOwner?;
|
||||||
|
|
||||||
|
void layout() {
|
||||||
|
child.layout(BoxConstraints.tight(const Size(500.0, 500.0)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
TestRenderingFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
|
test('non-RenderObject roots', () {
|
||||||
|
RenderPositionedBox child;
|
||||||
|
final RealRoot root = RealRoot(
|
||||||
|
child = RenderPositionedBox(
|
||||||
|
child: RenderSizedBox(const Size(100.0, 100.0)),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
root.attach(PipelineOwner());
|
||||||
|
|
||||||
|
child.scheduleInitialLayout();
|
||||||
|
root.layout();
|
||||||
|
|
||||||
|
child.markNeedsLayout();
|
||||||
|
root.layout();
|
||||||
|
});
|
||||||
|
}
|
@ -689,9 +689,9 @@ void main() {
|
|||||||
|
|
||||||
test('Offstage implements paintsChild correctly', () {
|
test('Offstage implements paintsChild correctly', () {
|
||||||
final RenderBox box = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 20));
|
final RenderBox box = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 20));
|
||||||
final RenderProxyBox parent = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 20));
|
final RenderBox parent = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 20));
|
||||||
final RenderOffstage offstage = RenderOffstage(offstage: false, child: box);
|
final RenderOffstage offstage = RenderOffstage(offstage: false, child: box);
|
||||||
parent.child = offstage;
|
parent.adoptChild(offstage);
|
||||||
|
|
||||||
expect(offstage.paintsChild(box), true);
|
expect(offstage.paintsChild(box), true);
|
||||||
|
|
||||||
@ -702,9 +702,9 @@ void main() {
|
|||||||
|
|
||||||
test('Opacity implements paintsChild correctly', () {
|
test('Opacity implements paintsChild correctly', () {
|
||||||
final RenderBox box = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 20));
|
final RenderBox box = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 20));
|
||||||
final RenderProxyBox parent = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 20));
|
final RenderBox parent = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 20));
|
||||||
final RenderOpacity opacity = RenderOpacity(child: box);
|
final RenderOpacity opacity = RenderOpacity(child: box);
|
||||||
parent.child = opacity;
|
parent.adoptChild(opacity);
|
||||||
|
|
||||||
expect(opacity.paintsChild(box), true);
|
expect(opacity.paintsChild(box), true);
|
||||||
|
|
||||||
@ -714,11 +714,11 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('AnimatedOpacity sets paint matrix to zero when alpha == 0', () {
|
test('AnimatedOpacity sets paint matrix to zero when alpha == 0', () {
|
||||||
final RenderProxyBox box = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 20));
|
final RenderBox box = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 20));
|
||||||
final RenderProxyBox parent = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 20));
|
final RenderBox parent = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 20));
|
||||||
final AnimationController opacityAnimation = AnimationController(value: 1, vsync: FakeTickerProvider());
|
final AnimationController opacityAnimation = AnimationController(value: 1, vsync: FakeTickerProvider());
|
||||||
final RenderAnimatedOpacity opacity = RenderAnimatedOpacity(opacity: opacityAnimation, child: box);
|
final RenderAnimatedOpacity opacity = RenderAnimatedOpacity(opacity: opacityAnimation, child: box);
|
||||||
parent.child = opacity;
|
parent.adoptChild(opacity);
|
||||||
|
|
||||||
// Make it listen to the animation.
|
// Make it listen to the animation.
|
||||||
opacity.attach(PipelineOwner());
|
opacity.attach(PipelineOwner());
|
||||||
@ -732,10 +732,10 @@ void main() {
|
|||||||
|
|
||||||
test('AnimatedOpacity sets paint matrix to zero when alpha == 0 (sliver)', () {
|
test('AnimatedOpacity sets paint matrix to zero when alpha == 0 (sliver)', () {
|
||||||
final RenderSliver sliver = RenderSliverToBoxAdapter(child: RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 20)));
|
final RenderSliver sliver = RenderSliverToBoxAdapter(child: RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 20)));
|
||||||
final RenderSliverPadding parent = RenderSliverPadding(padding: const EdgeInsets.all(4));
|
final RenderBox parent = RenderConstrainedBox(additionalConstraints: const BoxConstraints.tightFor(width: 20));
|
||||||
final AnimationController opacityAnimation = AnimationController(value: 1, vsync: FakeTickerProvider());
|
final AnimationController opacityAnimation = AnimationController(value: 1, vsync: FakeTickerProvider());
|
||||||
final RenderSliverAnimatedOpacity opacity = RenderSliverAnimatedOpacity(opacity: opacityAnimation, sliver: sliver);
|
final RenderSliverAnimatedOpacity opacity = RenderSliverAnimatedOpacity(opacity: opacityAnimation, sliver: sliver);
|
||||||
parent.child = opacity;
|
parent.adoptChild(opacity);
|
||||||
|
|
||||||
// Make it listen to the animation.
|
// Make it listen to the animation.
|
||||||
opacity.attach(PipelineOwner());
|
opacity.attach(PipelineOwner());
|
||||||
|
@ -2924,8 +2924,8 @@ Future<void> main() async {
|
|||||||
final ScrollController controller = ScrollController();
|
final ScrollController controller = ScrollController();
|
||||||
|
|
||||||
RenderAnimatedOpacity? findRenderAnimatedOpacity() {
|
RenderAnimatedOpacity? findRenderAnimatedOpacity() {
|
||||||
RenderObject? parent = tester.renderObject(find.byType(Placeholder));
|
AbstractNode? parent = tester.renderObject(find.byType(Placeholder));
|
||||||
while (parent != null && parent is! RenderAnimatedOpacity) {
|
while (parent is RenderObject && parent is! RenderAnimatedOpacity) {
|
||||||
parent = parent.parent;
|
parent = parent.parent;
|
||||||
}
|
}
|
||||||
return parent is RenderAnimatedOpacity ? parent : null;
|
return parent is RenderAnimatedOpacity ? parent : null;
|
||||||
|
@ -308,7 +308,7 @@ mixin CommandHandlerFactory {
|
|||||||
SemanticsNode? node;
|
SemanticsNode? node;
|
||||||
while (renderObject != null && node == null) {
|
while (renderObject != null && node == null) {
|
||||||
node = renderObject.debugSemantics;
|
node = renderObject.debugSemantics;
|
||||||
renderObject = renderObject.parent;
|
renderObject = renderObject.parent as RenderObject?;
|
||||||
}
|
}
|
||||||
if (node == null)
|
if (node == null)
|
||||||
throw StateError('No semantics data found');
|
throw StateError('No semantics data found');
|
||||||
|
@ -23,7 +23,7 @@ Future<ui.Image> captureImage(Element element) {
|
|||||||
assert(element.renderObject != null);
|
assert(element.renderObject != null);
|
||||||
RenderObject renderObject = element.renderObject!;
|
RenderObject renderObject = element.renderObject!;
|
||||||
while (!renderObject.isRepaintBoundary) {
|
while (!renderObject.isRepaintBoundary) {
|
||||||
renderObject = renderObject.parent!;
|
renderObject = renderObject.parent! as RenderObject;
|
||||||
}
|
}
|
||||||
assert(!renderObject.debugNeedsPaint);
|
assert(!renderObject.debugNeedsPaint);
|
||||||
final OffsetLayer layer = renderObject.debugLayer! as OffsetLayer;
|
final OffsetLayer layer = renderObject.debugLayer! as OffsetLayer;
|
||||||
|
@ -82,7 +82,7 @@ RenderObject _findRepaintBoundary(Element element) {
|
|||||||
assert(element.renderObject != null);
|
assert(element.renderObject != null);
|
||||||
RenderObject renderObject = element.renderObject!;
|
RenderObject renderObject = element.renderObject!;
|
||||||
while (!renderObject.isRepaintBoundary) {
|
while (!renderObject.isRepaintBoundary) {
|
||||||
renderObject = renderObject.parent!;
|
renderObject = renderObject.parent! as RenderObject;
|
||||||
}
|
}
|
||||||
return renderObject;
|
return renderObject;
|
||||||
}
|
}
|
||||||
|
@ -1168,7 +1168,7 @@ abstract class WidgetController {
|
|||||||
RenderObject? renderObject = element.findRenderObject();
|
RenderObject? renderObject = element.findRenderObject();
|
||||||
SemanticsNode? result = renderObject?.debugSemantics;
|
SemanticsNode? result = renderObject?.debugSemantics;
|
||||||
while (renderObject != null && (result == null || result.isMergedIntoParent)) {
|
while (renderObject != null && (result == null || result.isMergedIntoParent)) {
|
||||||
renderObject = renderObject.parent;
|
renderObject = renderObject.parent as RenderObject?;
|
||||||
result = renderObject?.debugSemantics;
|
result = renderObject?.debugSemantics;
|
||||||
}
|
}
|
||||||
if (result == null)
|
if (result == null)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user