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
f57fcac7
Unverified
Commit
f57fcac7
authored
Aug 30, 2022
by
Jason Simmons
Committed by
GitHub
Aug 30, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clear the static _debugDoingBaseline flag if baseline calculation throws (#110387)
parent
728bd65b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
2 deletions
+39
-2
box.dart
packages/flutter/lib/src/rendering/box.dart
+6
-2
box_test.dart
packages/flutter/test/rendering/box_test.dart
+33
-0
No files found.
packages/flutter/lib/src/rendering/box.dart
View file @
f57fcac7
...
@@ -2191,8 +2191,12 @@ abstract class RenderBox extends RenderObject {
...
@@ -2191,8 +2191,12 @@ abstract class RenderBox extends RenderObject {
return
false
;
return
false
;
}());
}());
assert
(
_debugSetDoingBaseline
(
true
));
assert
(
_debugSetDoingBaseline
(
true
));
final
double
?
result
=
getDistanceToActualBaseline
(
baseline
);
final
double
?
result
;
assert
(
_debugSetDoingBaseline
(
false
));
try
{
result
=
getDistanceToActualBaseline
(
baseline
);
}
finally
{
assert
(
_debugSetDoingBaseline
(
false
));
}
if
(
result
==
null
&&
!
onlyReal
)
{
if
(
result
==
null
&&
!
onlyReal
)
{
return
size
.
height
;
return
size
.
height
;
}
}
...
...
packages/flutter/test/rendering/box_test.dart
View file @
f57fcac7
...
@@ -36,6 +36,18 @@ class MissingSetSizeRenderBox extends RenderBox {
...
@@ -36,6 +36,18 @@ class MissingSetSizeRenderBox extends RenderBox {
void
performLayout
()
{
}
void
performLayout
()
{
}
}
}
class
BadBaselineRenderBox
extends
RenderBox
{
@override
void
performLayout
()
{
size
=
constraints
.
biggest
;
}
@override
double
?
computeDistanceToActualBaseline
(
TextBaseline
baseline
)
{
throw
Exception
();
}
}
void
main
(
)
{
void
main
(
)
{
TestRenderingFlutterBinding
.
ensureInitialized
();
TestRenderingFlutterBinding
.
ensureInitialized
();
...
@@ -1196,6 +1208,27 @@ void main() {
...
@@ -1196,6 +1208,27 @@ void main() {
),
),
);
);
});
});
test
(
'debugDoingBaseline flag is cleared after exception'
,
()
{
final
BadBaselineRenderBox
badChild
=
BadBaselineRenderBox
();
final
RenderBox
badRoot
=
RenderBaseline
(
child:
badChild
,
baseline:
0.0
,
baselineType:
TextBaseline
.
alphabetic
,
);
final
List
<
dynamic
>
exceptions
=
<
dynamic
>[];
layout
(
badRoot
,
onErrors:
()
{
exceptions
.
addAll
(
TestRenderingFlutterBinding
.
instance
.
takeAllFlutterExceptions
());
});
expect
(
exceptions
,
isNotEmpty
);
final
RenderBox
goodRoot
=
RenderBaseline
(
child:
RenderDecoratedBox
(
decoration:
const
BoxDecoration
()),
baseline:
0.0
,
baselineType:
TextBaseline
.
alphabetic
,
);
layout
(
goodRoot
,
onErrors:
()
{
assert
(
false
);
});
});
}
}
class
_DummyHitTestTarget
implements
HitTestTarget
{
class
_DummyHitTestTarget
implements
HitTestTarget
{
...
...
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