Skip to content

Commit

Permalink
[framework] inline AbstractNode into RenderObject (#103832)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahwilliams authored May 19, 2022
1 parent 586b15c commit 24bd28f
Show file tree
Hide file tree
Showing 22 changed files with 246 additions and 217 deletions.
4 changes: 1 addition & 3 deletions packages/flutter/lib/src/cupertino/dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1566,9 +1566,7 @@ class _ActionButtonParentDataWidget
parentData.isPressed = isPressed;

// Force a repaint.
final AbstractNode? targetParent = renderObject.parent;
if (targetParent is RenderObject)
targetParent.markNeedsPaint();
renderObject.parent?.markNeedsPaint();
}
}

Expand Down
5 changes: 2 additions & 3 deletions packages/flutter/lib/src/material/data_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import 'dart:math' as math;

import 'package:flutter/foundation.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';

Expand Down Expand Up @@ -1086,9 +1085,9 @@ class TableRowInkWell extends InkResponse {
RectCallback getRectCallback(RenderBox referenceBox) {
return () {
RenderObject cell = referenceBox;
AbstractNode? table = cell.parent;
RenderObject? table = cell.parent;
final Matrix4 transform = Matrix4.identity();
while (table is RenderObject && table is! RenderTable) {
while (table != null && table is! RenderTable) {
table.applyPaintTransform(cell, transform);
assert(table == cell.parent);
cell = table;
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/material/material.dart
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ abstract class InkFeature {
RenderObject node = referenceBox;
while (node != _controller) {
final RenderObject childNode = node;
node = node.parent! as RenderObject;
node = node.parent!;
if (!node.paintsChild(childNode)) {
// Some node between the reference box and this would skip painting on
// the reference box, so bail out early and avoid unnecessary painting.
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/lib/src/rendering/box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(!debugNeedsLayout);
assert(() {
final RenderObject? parent = this.parent as RenderObject?;
final RenderObject? parent = this.parent;
if (owner!.debugDoingLayout)
return (RenderObject.debugActiveLayout == parent) && parent!.debugDoingThisLayout;
if (owner!.debugDoingPaint)
Expand Down Expand Up @@ -2367,7 +2367,7 @@ abstract class RenderBox extends RenderObject {

@override
void markNeedsLayout() {
if (_clearCachedData() && parent is RenderObject) {
if (_clearCachedData() && parent != null) {
markParentNeedsLayout();
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@ class RenderListWheelViewport
// `child` will be the last RenderObject before the viewport when walking up from `target`.
RenderObject child = target;
while (child.parent != this)
child = child.parent! as RenderObject;
child = child.parent!;

final ListWheelParentData parentData = child.parentData! as ListWheelParentData;
final double targetOffset = parentData.offset.dy; // the so-called "centerPosition"
Expand Down
Loading

0 comments on commit 24bd28f

Please sign in to comment.