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
f2442b8a
Unverified
Commit
f2442b8a
authored
Aug 31, 2018
by
Jonah Williams
Committed by
GitHub
Aug 31, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix traversal order issues caused by intersecting or overlapping child rects (#21235)
parent
2f32166f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
114 additions
and
15 deletions
+114
-15
semantics.dart
packages/flutter/lib/src/semantics/semantics.dart
+8
-4
search_test.dart
packages/flutter/test/material/search_test.dart
+11
-11
traversal_order_test.dart
packages/flutter/test/semantics/traversal_order_test.dart
+95
-0
No files found.
packages/flutter/lib/src/semantics/semantics.dart
View file @
f2442b8a
...
...
@@ -2001,14 +2001,16 @@ class _SemanticsSortGroup extends Comparable<_SemanticsSortGroup> {
List
<
SemanticsNode
>
sortedWithinVerticalGroup
()
{
final
List
<
_BoxEdge
>
edges
=
<
_BoxEdge
>[];
for
(
SemanticsNode
child
in
nodes
)
{
// Using a small delta to shrink child rects removes overlapping cases.
final
Rect
childRect
=
child
.
rect
.
deflate
(
0.1
);
edges
.
add
(
new
_BoxEdge
(
isLeadingEdge:
true
,
offset:
_pointInParentCoordinates
(
child
,
child
.
r
ect
.
topLeft
).
dx
,
offset:
_pointInParentCoordinates
(
child
,
child
R
ect
.
topLeft
).
dx
,
node:
child
,
));
edges
.
add
(
new
_BoxEdge
(
isLeadingEdge:
false
,
offset:
_pointInParentCoordinates
(
child
,
child
.
r
ect
.
bottomRight
).
dx
,
offset:
_pointInParentCoordinates
(
child
,
child
R
ect
.
bottomRight
).
dx
,
node:
child
,
));
}
...
...
@@ -2145,14 +2147,16 @@ Offset _pointInParentCoordinates(SemanticsNode node, Offset point) {
List
<
SemanticsNode
>
_childrenInDefaultOrder
(
List
<
SemanticsNode
>
children
,
TextDirection
textDirection
)
{
final
List
<
_BoxEdge
>
edges
=
<
_BoxEdge
>[];
for
(
SemanticsNode
child
in
children
)
{
// Using a small delta to shrink child rects removes overlapping cases.
final
Rect
childRect
=
child
.
rect
.
deflate
(
0.1
);
edges
.
add
(
new
_BoxEdge
(
isLeadingEdge:
true
,
offset:
_pointInParentCoordinates
(
child
,
child
.
r
ect
.
topLeft
).
dy
,
offset:
_pointInParentCoordinates
(
child
,
child
R
ect
.
topLeft
).
dy
,
node:
child
,
));
edges
.
add
(
new
_BoxEdge
(
isLeadingEdge:
false
,
offset:
_pointInParentCoordinates
(
child
,
child
.
r
ect
.
bottomRight
).
dy
,
offset:
_pointInParentCoordinates
(
child
,
child
R
ect
.
bottomRight
).
dy
,
node:
child
,
));
}
...
...
packages/flutter/test/material/search_test.dart
View file @
f2442b8a
...
...
@@ -498,17 +498,6 @@ void main() {
label:
routeName
,
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
new
TestSemantics
(
id:
8
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isButton
,
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isEnabled
,
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'Suggestions'
,
textDirection:
TextDirection
.
ltr
,
),
new
TestSemantics
(
id:
9
,
children:
<
TestSemantics
>[
...
...
@@ -541,6 +530,17 @@ void main() {
),
],
),
new
TestSemantics
(
id:
8
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isButton
,
SemanticsFlag
.
hasEnabledState
,
SemanticsFlag
.
isEnabled
,
],
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
],
label:
'Suggestions'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
],
...
...
packages/flutter/test/semantics/traversal_order_test.dart
0 → 100644
View file @
f2442b8a
// Copyright 2018 The Chromium 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/material.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'../widgets/semantics_tester.dart'
;
void
main
(
)
{
testWidgets
(
'Traversal order handles touching elements'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
new
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
new
MaterialApp
(
home:
new
Column
(
children:
new
List
<
Widget
>.
generate
(
3
,
(
int
column
)
{
return
new
Row
(
children:
List
<
Widget
>.
generate
(
3
,
(
int
row
)
{
return
new
Semantics
(
child:
new
SizedBox
(
width:
50.0
,
height:
50.0
,
child:
new
Text
(
'
$column
-
$row
'
),
),
);
}));
}),
),
));
final
TestSemantics
expected
=
new
TestSemantics
.
root
(
children:
<
TestSemantics
>[
new
TestSemantics
(
id:
1
,
textDirection:
TextDirection
.
ltr
,
children:
<
TestSemantics
>[
new
TestSemantics
(
id:
2
,
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
scopesRoute
],
children:
<
TestSemantics
>[
new
TestSemantics
(
id:
3
,
label:
'0 - 0'
,
textDirection:
TextDirection
.
ltr
,
),
new
TestSemantics
(
id:
4
,
label:
'0 - 1'
,
textDirection:
TextDirection
.
ltr
,
),
new
TestSemantics
(
id:
5
,
label:
'0 - 2'
,
textDirection:
TextDirection
.
ltr
,
),
new
TestSemantics
(
id:
6
,
label:
'1 - 0'
,
textDirection:
TextDirection
.
ltr
,
),
new
TestSemantics
(
id:
7
,
label:
'1 - 1'
,
textDirection:
TextDirection
.
ltr
,
),
new
TestSemantics
(
id:
8
,
label:
'1 - 2'
,
textDirection:
TextDirection
.
ltr
,
),
new
TestSemantics
(
id:
9
,
label:
'2 - 0'
,
textDirection:
TextDirection
.
ltr
,
),
new
TestSemantics
(
id:
10
,
label:
'2 - 1'
,
textDirection:
TextDirection
.
ltr
,
),
new
TestSemantics
(
id:
11
,
label:
'2 - 2'
,
textDirection:
TextDirection
.
ltr
,
),
],
),
],
),
],
);
expect
(
semantics
,
hasSemantics
(
expected
,
ignoreRect:
true
,
ignoreTransform:
true
));
semantics
.
dispose
();
});
}
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