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
13fcedc7
Unverified
Commit
13fcedc7
authored
Sep 16, 2020
by
Jonah Williams
Committed by
GitHub
Sep 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter] elide semantic information from certain widget spans (#65857)
parent
a48e1430
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
10 deletions
+59
-10
paragraph.dart
packages/flutter/lib/src/rendering/paragraph.dart
+12
-10
text_test.dart
packages/flutter/test/widgets/text_test.dart
+47
-0
No files found.
packages/flutter/lib/src/rendering/paragraph.dart
View file @
13fcedc7
...
...
@@ -918,16 +918,18 @@ class RenderParagraph extends RenderBox
);
if
(
info
.
isPlaceholder
)
{
final
SemanticsNode
childNode
=
children
.
elementAt
(
placeholderIndex
++);
final
TextParentData
parentData
=
child
!.
parentData
as
TextParentData
;
childNode
.
rect
=
Rect
.
fromLTWH
(
childNode
.
rect
.
left
,
childNode
.
rect
.
top
,
childNode
.
rect
.
width
*
parentData
.
scale
!,
childNode
.
rect
.
height
*
parentData
.
scale
!,
);
newChildren
.
add
(
childNode
);
child
=
childAfter
(
child
);
if
(
children
.
isNotEmpty
)
{
final
SemanticsNode
childNode
=
children
.
elementAt
(
placeholderIndex
++);
final
TextParentData
parentData
=
child
!.
parentData
as
TextParentData
;
childNode
.
rect
=
Rect
.
fromLTWH
(
childNode
.
rect
.
left
,
childNode
.
rect
.
top
,
childNode
.
rect
.
width
*
parentData
.
scale
!,
childNode
.
rect
.
height
*
parentData
.
scale
!,
);
newChildren
.
add
(
childNode
);
child
=
childAfter
(
child
);
}
}
else
{
final
SemanticsConfiguration
configuration
=
SemanticsConfiguration
()
..
sortKey
=
OrdinalSortKey
(
ordinal
++)
...
...
packages/flutter/test/widgets/text_test.dart
View file @
13fcedc7
...
...
@@ -958,6 +958,53 @@ void main() {
paragraph
.
layout
(
const
ui
.
ParagraphConstraints
(
width:
1000
));
expect
(
paragraph
.
getBoxesForRange
(
2
,
2
),
isEmpty
);
});
// Regression test for https://github.com/flutter/flutter/issues/65818
testWidgets
(
'WidgetSpans with no semantic information are elided from semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
// Without the fix for this bug the pump widget will throw a RangeError.
await
tester
.
pumpWidget
(
RichText
(
textDirection:
TextDirection
.
ltr
,
text:
TextSpan
(
children:
<
InlineSpan
>[
const
WidgetSpan
(
child:
SizedBox
.
shrink
()),
TextSpan
(
text:
'HELLO'
,
style:
const
TextStyle
(
color:
Colors
.
black
),
recognizer:
TapGestureRecognizer
()..
onTap
=
()
{},
)
]),
),
);
expect
(
semantics
,
hasSemantics
(
TestSemantics
.
root
(
children:
<
TestSemantics
>[
TestSemantics
(
id:
1
,
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
800.0
,
600.0
),
transform:
Matrix4
(
3.0
,
0.0
,
0.0
,
0.0
,
0.0
,
3.0
,
0.0
,
0.0
,
0.0
,
0.0
,
1.0
,
0.0
,
0.0
,
0.0
,
0.0
,
1.0
,
),
children:
<
TestSemantics
>[
TestSemantics
(
rect:
const
Rect
.
fromLTRB
(-
4.0
,
-
4.0
,
74.0
,
18.0
),
id:
2
,
label:
'HELLO'
,
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
,
],
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isLink
,
],
),
],
),
],
)));
},
semanticsEnabled:
true
,
skip:
isBrowser
);
// Browser semantics have different sizes.
}
Future
<
void
>
_pumpTextWidget
({
WidgetTester
tester
,
String
text
,
TextOverflow
overflow
})
{
...
...
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