Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
a3514c77
Unverified
Commit
a3514c77
authored
Mar 14, 2022
by
LongCatIsLooong
Committed by
GitHub
Mar 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Avoid calling `performLayout` when only the relayout boundary is different" (#100068)
parent
f58e8f56
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
96 deletions
+9
-96
object.dart
packages/flutter/lib/src/rendering/object.dart
+9
-35
relayout_boundary_test.dart
packages/flutter/test/rendering/relayout_boundary_test.dart
+0
-61
No files found.
packages/flutter/lib/src/rendering/object.dart
View file @
a3514c77
...
...
@@ -1629,16 +1629,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
assert
(
_debugSubtreeRelayoutRootAlreadyMarkedNeedsLayout
());
return
;
}
if
(
_relayoutBoundary
==
null
)
{
_needsLayout
=
true
;
if
(
parent
!=
null
)
{
// _relayoutBoundary is cleaned by an ancestor in RenderObject.layout.
// Conservatively mark everything dirty until it reaches the closest
// known relayout boundary.
markParentNeedsLayout
();
}
return
;
}
assert
(
_relayoutBoundary
!=
null
);
if
(
_relayoutBoundary
!=
this
)
{
markParentNeedsLayout
();
}
else
{
...
...
@@ -1692,31 +1683,16 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
void
_cleanRelayoutBoundary
()
{
if
(
_relayoutBoundary
!=
this
)
{
_relayoutBoundary
=
null
;
_needsLayout
=
true
;
visitChildren
(
_cleanChildRelayoutBoundary
);
}
}
void
_propagateRelayoutBoundary
()
{
if
(
_relayoutBoundary
==
this
)
{
return
;
}
final
RenderObject
?
parentRelayoutBoundary
=
(
parent
as
RenderObject
?)?.
_relayoutBoundary
;
assert
(
parentRelayoutBoundary
!=
null
);
if
(
parentRelayoutBoundary
!=
_relayoutBoundary
)
{
_relayoutBoundary
=
parentRelayoutBoundary
;
visitChildren
(
_propagateRelayoutBoundaryToChild
);
}
}
// Reduces closure allocation for visitChildren use cases.
static
void
_cleanChildRelayoutBoundary
(
RenderObject
child
)
{
child
.
_cleanRelayoutBoundary
();
}
static
void
_propagateRelayoutBoundaryToChild
(
RenderObject
child
)
{
child
.
_propagateRelayoutBoundary
();
}
/// Bootstrap the rendering pipeline by scheduling the very first layout.
///
/// Requires this render object to be attached and that this render object
...
...
@@ -1838,14 +1814,17 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
));
assert
(!
_debugDoingThisResize
);
assert
(!
_debugDoingThisLayout
);
final
bool
isRelayoutBoundary
=
!
parentUsesSize
||
sizedByParent
||
constraints
.
isTight
||
parent
is
!
RenderObject
;
final
RenderObject
relayoutBoundary
=
isRelayoutBoundary
?
this
:
(
parent
!
as
RenderObject
).
_relayoutBoundary
!;
RenderObject
?
relayoutBoundary
;
if
(!
parentUsesSize
||
sizedByParent
||
constraints
.
isTight
||
parent
is
!
RenderObject
)
{
relayoutBoundary
=
this
;
}
else
{
relayoutBoundary
=
(
parent
!
as
RenderObject
).
_relayoutBoundary
;
}
assert
(()
{
_debugCanParentUseSize
=
parentUsesSize
;
return
true
;
}());
if
(!
_needsLayout
&&
constraints
==
_constraints
)
{
if
(!
_needsLayout
&&
constraints
==
_constraints
&&
relayoutBoundary
==
_relayoutBoundary
)
{
assert
(()
{
// in case parentUsesSize changed since the last invocation, set size
// to itself, so it has the right internal debug values.
...
...
@@ -1860,11 +1839,6 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
return
true
;
}());
if
(
relayoutBoundary
!=
_relayoutBoundary
)
{
_relayoutBoundary
=
relayoutBoundary
;
visitChildren
(
_propagateRelayoutBoundaryToChild
);
}
if
(!
kReleaseMode
&&
debugProfileLayoutsEnabled
)
Timeline
.
finishSync
();
return
;
...
...
packages/flutter/test/rendering/relayout_boundary_test.dart
deleted
100644 → 0
View file @
f58e8f56
// 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/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'relayout boundary change does not trigger relayout'
,
(
WidgetTester
tester
)
async
{
final
RenderLayoutCount
renderLayoutCount
=
RenderLayoutCount
();
final
Widget
layoutCounter
=
Center
(
key:
GlobalKey
(),
child:
WidgetToRenderBoxAdapter
(
renderBox:
renderLayoutCount
),
);
await
tester
.
pumpWidget
(
Center
(
child:
SizedBox
(
width:
100
,
height:
100
,
child:
Center
(
child:
SizedBox
(
width:
100
,
height:
100
,
child:
Center
(
child:
layoutCounter
,
),
),
),
),
),
);
expect
(
renderLayoutCount
.
layoutCount
,
1
);
await
tester
.
pumpWidget
(
Center
(
child:
SizedBox
(
width:
100
,
height:
100
,
child:
layoutCounter
,
),
),
);
expect
(
renderLayoutCount
.
layoutCount
,
1
);
});
}
// This class is needed because LayoutBuilder's RenderObject does not always
// call the builder method in its PerformLayout method.
class
RenderLayoutCount
extends
RenderBox
{
int
layoutCount
=
0
;
@override
void
performLayout
()
{
layoutCount
+=
1
;
size
=
constraints
.
biggest
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment