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
b20e27e7
Unverified
Commit
b20e27e7
authored
May 06, 2022
by
xubaolin
Committed by
GitHub
May 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Does not replace the root layer unnecessarily (#101748)
parent
82afe3ea
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
2 deletions
+20
-2
view.dart
packages/flutter/lib/src/rendering/view.dart
+5
-1
view_test.dart
packages/flutter/test/rendering/view_test.dart
+14
-0
binding.dart
packages/flutter_test/lib/src/binding.dart
+1
-1
No files found.
packages/flutter/lib/src/rendering/view.dart
View file @
b20e27e7
...
...
@@ -82,6 +82,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
/// The constraints used for the root layout.
ViewConfiguration
get
configuration
=>
_configuration
;
ViewConfiguration
_configuration
;
/// The configuration is initially set by the `configuration` argument
/// passed to the constructor.
///
...
...
@@ -90,8 +91,11 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
assert
(
value
!=
null
);
if
(
configuration
==
value
)
return
;
final
ViewConfiguration
oldConfiguration
=
_configuration
;
_configuration
=
value
;
replaceRootLayer
(
_updateMatricesAndCreateNewRootLayer
());
if
(
oldConfiguration
.
toMatrix
()
!=
_configuration
.
toMatrix
())
{
replaceRootLayer
(
_updateMatricesAndCreateNewRootLayer
());
}
assert
(
_rootTransform
!=
null
);
markNeedsLayout
();
}
...
...
packages/flutter/test/rendering/view_test.dart
View file @
b20e27e7
...
...
@@ -47,6 +47,20 @@ void main() {
view
.
configuration
=
createViewConfiguration
(
devicePixelRatio:
5.0
);
expect
(
identical
(
view
.
debugLayer
,
firstLayer
),
false
);
});
test
(
'does not replace the root layer unnecessarily when window resize'
,
()
{
final
ui
.
FlutterView
window
=
TestWindow
(
window:
RendererBinding
.
instance
.
window
);
final
RenderView
view
=
RenderView
(
configuration:
createViewConfiguration
(
size:
const
Size
(
100.0
,
100.0
)),
window:
window
,
);
final
PipelineOwner
owner
=
PipelineOwner
();
view
.
attach
(
owner
);
view
.
prepareInitialFrame
();
final
ContainerLayer
firstLayer
=
view
.
debugLayer
!;
view
.
configuration
=
createViewConfiguration
(
size:
const
Size
(
100.0
,
1117.0
));
expect
(
identical
(
view
.
debugLayer
,
firstLayer
),
true
);
});
});
test
(
'ViewConfiguration == and hashCode'
,
()
{
...
...
packages/flutter_test/lib/src/binding.dart
View file @
b20e27e7
...
...
@@ -1779,7 +1779,7 @@ class TestViewConfiguration extends ViewConfiguration {
TestViewConfiguration
.
_
(
Size
size
,
ui
.
FlutterView
window
)
:
_paintMatrix
=
_getMatrix
(
size
,
window
.
devicePixelRatio
,
window
),
_hitTestMatrix
=
_getMatrix
(
size
,
1.0
,
window
),
super
(
size:
size
);
super
(
size:
size
,
devicePixelRatio:
window
.
devicePixelRatio
);
static
Matrix4
_getMatrix
(
Size
size
,
double
devicePixelRatio
,
ui
.
FlutterView
window
)
{
final
double
inverseRatio
=
devicePixelRatio
/
window
.
devicePixelRatio
;
...
...
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