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
f8342c7a
Commit
f8342c7a
authored
Jan 31, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix analyzer warnings related to SemanticsListener
These were introduced by the recent engine roll.
parent
4bec05ad
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
40 additions
and
38 deletions
+40
-38
binding.dart
packages/flutter/lib/src/rendering/binding.dart
+2
-2
semantics.dart
packages/flutter/lib/src/rendering/semantics.dart
+5
-3
semantics_debugger.dart
packages/flutter/lib/src/widgets/semantics_debugger.dart
+20
-20
buttons_test.dart
packages/flutter/test/widget/buttons_test.dart
+1
-1
semantics_1_test.dart
packages/flutter/test/widget/semantics_1_test.dart
+1
-1
semantics_2_test.dart
packages/flutter/test/widget/semantics_2_test.dart
+1
-1
semantics_3_test.dart
packages/flutter/test/widget/semantics_3_test.dart
+1
-1
semantics_4_test.dart
packages/flutter/test/widget/semantics_4_test.dart
+1
-1
semantics_5_test.dart
packages/flutter/test/widget/semantics_5_test.dart
+1
-1
test_semantics.dart
packages/flutter/test/widget/test_semantics.dart
+6
-6
tooltip_test.dart
packages/flutter/test/widget/tooltip_test.dart
+1
-1
No files found.
packages/flutter/lib/src/rendering/binding.dart
View file @
f8342c7a
...
@@ -65,8 +65,8 @@ abstract class Renderer extends Scheduler
...
@@ -65,8 +65,8 @@ abstract class Renderer extends Scheduler
renderView
.
configuration
=
new
ViewConfiguration
(
size:
ui
.
window
.
size
);
renderView
.
configuration
=
new
ViewConfiguration
(
size:
ui
.
window
.
size
);
}
}
mojom
.
Semantics
Client
_semanticsClient
;
mojom
.
Semantics
Listener
_semanticsClient
;
void
setSemanticsClient
(
mojom
.
Semantics
Client
client
)
{
void
setSemanticsClient
(
mojom
.
Semantics
Listener
client
)
{
assert
(
_semanticsClient
==
null
);
assert
(
_semanticsClient
==
null
);
_semanticsClient
=
client
;
_semanticsClient
=
client
;
if
(
renderView
!=
null
)
if
(
renderView
!=
null
)
...
...
packages/flutter/lib/src/rendering/semantics.dart
View file @
f8342c7a
...
@@ -208,7 +208,7 @@ class SemanticsNode extends AbstractNode {
...
@@ -208,7 +208,7 @@ class SemanticsNode extends AbstractNode {
if
(
child
.
parent
!=
this
)
{
if
(
child
.
parent
!=
this
)
{
if
(
child
.
parent
!=
null
)
{
if
(
child
.
parent
!=
null
)
{
// we're rebuilding the tree from the bottom up, so it's possible
// we're rebuilding the tree from the bottom up, so it's possible
// that our child was, in the last pass, a child of one of our
// that our child was, in the last pass, a child of one of our
// ancestors. In that case, we drop the child eagerly here.
// ancestors. In that case, we drop the child eagerly here.
// TODO(ianh): Find a way to assert that the same node didn't
// TODO(ianh): Find a way to assert that the same node didn't
// actually appear in the tree in two places.
// actually appear in the tree in two places.
...
@@ -333,7 +333,7 @@ class SemanticsNode extends AbstractNode {
...
@@ -333,7 +333,7 @@ class SemanticsNode extends AbstractNode {
return
result
;
return
result
;
}
}
static
void
sendSemanticsTreeTo
(
mojom
.
Semantics
Client
client
)
{
static
void
sendSemanticsTreeTo
(
mojom
.
Semantics
Listener
client
)
{
for
(
SemanticsNode
oldNode
in
_detachedNodes
)
{
for
(
SemanticsNode
oldNode
in
_detachedNodes
)
{
// The other side will have forgotten this node if we even send
// The other side will have forgotten this node if we even send
// it again, so make sure to mark it dirty so that it'll get
// it again, so make sure to mark it dirty so that it'll get
...
@@ -359,7 +359,7 @@ class SemanticsNode extends AbstractNode {
...
@@ -359,7 +359,7 @@ class SemanticsNode extends AbstractNode {
child
.
mergeAllDescendantsIntoThisNode
=
true
;
// this can add the node to the dirty list
child
.
mergeAllDescendantsIntoThisNode
=
true
;
// this can add the node to the dirty list
}
}
assert
(
_dirtyNodes
[
index
]
==
node
);
// make sure nothing went in front of us in the list
assert
(
_dirtyNodes
[
index
]
==
node
);
// make sure nothing went in front of us in the list
}
}
_dirtyNodes
.
sort
((
SemanticsNode
a
,
SemanticsNode
b
)
=>
a
.
depth
-
b
.
depth
);
_dirtyNodes
.
sort
((
SemanticsNode
a
,
SemanticsNode
b
)
=>
a
.
depth
-
b
.
depth
);
List
<
mojom
.
SemanticsNode
>
updatedNodes
=
<
mojom
.
SemanticsNode
>[];
List
<
mojom
.
SemanticsNode
>
updatedNodes
=
<
mojom
.
SemanticsNode
>[];
for
(
SemanticsNode
node
in
_dirtyNodes
)
{
for
(
SemanticsNode
node
in
_dirtyNodes
)
{
...
@@ -427,6 +427,8 @@ class SemanticsNode extends AbstractNode {
...
@@ -427,6 +427,8 @@ class SemanticsNode extends AbstractNode {
}
}
class
SemanticsServer
extends
mojom
.
SemanticsServer
{
class
SemanticsServer
extends
mojom
.
SemanticsServer
{
void
addSemanticsListener
(
mojom
.
SemanticsListener
listener
)
{
}
void
tap
(
int
nodeID
)
{
void
tap
(
int
nodeID
)
{
SemanticsNode
.
getSemanticActionHandlerForId
(
nodeID
,
neededFlag:
_SemanticFlags
.
canBeTapped
)?.
handleSemanticTap
();
SemanticsNode
.
getSemanticActionHandlerForId
(
nodeID
,
neededFlag:
_SemanticFlags
.
canBeTapped
)?.
handleSemanticTap
();
}
}
...
...
packages/flutter/lib/src/widgets/semantics_debugger.dart
View file @
f8342c7a
...
@@ -7,7 +7,7 @@ import 'dart:ui' as ui;
...
@@ -7,7 +7,7 @@ import 'dart:ui' as ui;
import
'package:flutter/painting.dart'
;
import
'package:flutter/painting.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:sky_services/semantics/semantics.mojom.dart'
as
engine
;
import
'package:sky_services/semantics/semantics.mojom.dart'
as
mojom
;
import
'basic.dart'
;
import
'basic.dart'
;
import
'framework.dart'
;
import
'framework.dart'
;
...
@@ -22,11 +22,11 @@ class SemanticsDebugger extends StatefulComponent {
...
@@ -22,11 +22,11 @@ class SemanticsDebugger extends StatefulComponent {
class
_SemanticsDebuggerState
extends
State
<
SemanticsDebugger
>
{
class
_SemanticsDebuggerState
extends
State
<
SemanticsDebugger
>
{
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
_SemanticsDebugger
Client
.
ensureInstantiated
();
_SemanticsDebugger
Listener
.
ensureInstantiated
();
_SemanticsDebugger
Client
.
instance
.
addListener
(
_update
);
_SemanticsDebugger
Listener
.
instance
.
addListener
(
_update
);
}
}
void
dispose
()
{
void
dispose
()
{
_SemanticsDebugger
Client
.
instance
.
removeListener
(
_update
);
_SemanticsDebugger
Listener
.
instance
.
removeListener
(
_update
);
super
.
dispose
();
super
.
dispose
();
}
}
void
_update
()
{
void
_update
()
{
...
@@ -42,28 +42,28 @@ class _SemanticsDebuggerState extends State<SemanticsDebugger> {
...
@@ -42,28 +42,28 @@ class _SemanticsDebuggerState extends State<SemanticsDebugger> {
}
}
void
_handleTap
()
{
void
_handleTap
()
{
assert
(
_lastPointerDownLocation
!=
null
);
assert
(
_lastPointerDownLocation
!=
null
);
_SemanticsDebugger
Client
.
instance
.
handleTap
(
_lastPointerDownLocation
);
_SemanticsDebugger
Listener
.
instance
.
handleTap
(
_lastPointerDownLocation
);
setState
(()
{
setState
(()
{
_lastPointerDownLocation
=
null
;
_lastPointerDownLocation
=
null
;
});
});
}
}
void
_handleLongPress
()
{
void
_handleLongPress
()
{
assert
(
_lastPointerDownLocation
!=
null
);
assert
(
_lastPointerDownLocation
!=
null
);
_SemanticsDebugger
Client
.
instance
.
handleLongPress
(
_lastPointerDownLocation
);
_SemanticsDebugger
Listener
.
instance
.
handleLongPress
(
_lastPointerDownLocation
);
setState
(()
{
setState
(()
{
_lastPointerDownLocation
=
null
;
_lastPointerDownLocation
=
null
;
});
});
}
}
void
_handlePanEnd
(
Offset
velocity
)
{
void
_handlePanEnd
(
Offset
velocity
)
{
assert
(
_lastPointerDownLocation
!=
null
);
assert
(
_lastPointerDownLocation
!=
null
);
_SemanticsDebugger
Client
.
instance
.
handlePanEnd
(
_lastPointerDownLocation
,
velocity
);
_SemanticsDebugger
Listener
.
instance
.
handlePanEnd
(
_lastPointerDownLocation
,
velocity
);
setState
(()
{
setState
(()
{
_lastPointerDownLocation
=
null
;
_lastPointerDownLocation
=
null
;
});
});
}
}
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
new
CustomPaint
(
return
new
CustomPaint
(
foregroundPainter:
new
_SemanticsDebuggerPainter
(
_SemanticsDebugger
Client
.
instance
.
generation
,
_lastPointerDownLocation
),
foregroundPainter:
new
_SemanticsDebuggerPainter
(
_SemanticsDebugger
Listener
.
instance
.
generation
,
_lastPointerDownLocation
),
child:
new
GestureDetector
(
child:
new
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
behavior:
HitTestBehavior
.
opaque
,
onTap:
_handleTap
,
onTap:
_handleTap
,
...
@@ -233,16 +233,16 @@ class _SemanticsDebuggerEntry {
...
@@ -233,16 +233,16 @@ class _SemanticsDebuggerEntry {
}
}
}
}
class
_SemanticsDebugger
Client
implements
engine
.
SemanticsClient
{
class
_SemanticsDebugger
Listener
implements
mojom
.
SemanticsListener
{
_SemanticsDebugger
Client
.
_
()
{
_SemanticsDebugger
Listener
.
_
()
{
Renderer
.
instance
.
setSemanticsClient
(
this
);
Renderer
.
instance
.
setSemanticsClient
(
this
);
}
}
static
_SemanticsDebugger
Client
instance
;
static
_SemanticsDebugger
Listener
instance
;
static
engine
.
SemanticsServer
_server
;
static
mojom
.
SemanticsServer
_server
;
static
void
ensureInstantiated
({
engine
.
SemanticsServer
server
})
{
static
void
ensureInstantiated
({
mojom
.
SemanticsServer
server
})
{
_server
=
server
??
new
SemanticsServer
();
_server
=
server
??
new
SemanticsServer
();
instance
??=
new
_SemanticsDebugger
Client
.
_
();
instance
??=
new
_SemanticsDebugger
Listener
.
_
();
}
}
Set
<
VoidCallback
>
_listeners
=
new
Set
<
VoidCallback
>();
Set
<
VoidCallback
>
_listeners
=
new
Set
<
VoidCallback
>();
...
@@ -256,7 +256,7 @@ class _SemanticsDebuggerClient implements engine.SemanticsClient {
...
@@ -256,7 +256,7 @@ class _SemanticsDebuggerClient implements engine.SemanticsClient {
Map
<
int
,
_SemanticsDebuggerEntry
>
nodes
=
<
int
,
_SemanticsDebuggerEntry
>{};
Map
<
int
,
_SemanticsDebuggerEntry
>
nodes
=
<
int
,
_SemanticsDebuggerEntry
>{};
_SemanticsDebuggerEntry
_updateNode
(
engine
.
SemanticsNode
node
)
{
_SemanticsDebuggerEntry
_updateNode
(
mojom
.
SemanticsNode
node
)
{
_SemanticsDebuggerEntry
entry
=
nodes
.
putIfAbsent
(
node
.
id
,
()
=>
new
_SemanticsDebuggerEntry
(
node
.
id
));
_SemanticsDebuggerEntry
entry
=
nodes
.
putIfAbsent
(
node
.
id
,
()
=>
new
_SemanticsDebuggerEntry
(
node
.
id
));
if
(
node
.
flags
!=
null
)
{
if
(
node
.
flags
!=
null
)
{
entry
.
canBeTapped
=
node
.
flags
.
canBeTapped
;
entry
.
canBeTapped
=
node
.
flags
.
canBeTapped
;
...
@@ -295,7 +295,7 @@ class _SemanticsDebuggerClient implements engine.SemanticsClient {
...
@@ -295,7 +295,7 @@ class _SemanticsDebuggerClient implements engine.SemanticsClient {
Set
oldChildren
=
new
Set
<
_SemanticsDebuggerEntry
>.
from
(
entry
.
children
??
const
<
_SemanticsDebuggerEntry
>[]);
Set
oldChildren
=
new
Set
<
_SemanticsDebuggerEntry
>.
from
(
entry
.
children
??
const
<
_SemanticsDebuggerEntry
>[]);
entry
.
children
?.
clear
();
entry
.
children
?.
clear
();
entry
.
children
??=
new
List
<
_SemanticsDebuggerEntry
>();
entry
.
children
??=
new
List
<
_SemanticsDebuggerEntry
>();
for
(
engine
.
SemanticsNode
child
in
node
.
children
)
for
(
mojom
.
SemanticsNode
child
in
node
.
children
)
entry
.
children
.
add
(
_updateNode
(
child
));
entry
.
children
.
add
(
_updateNode
(
child
));
Set
newChildren
=
new
Set
<
_SemanticsDebuggerEntry
>.
from
(
entry
.
children
);
Set
newChildren
=
new
Set
<
_SemanticsDebuggerEntry
>.
from
(
entry
.
children
);
Set
<
_SemanticsDebuggerEntry
>
removedChildren
=
oldChildren
.
difference
(
newChildren
);
Set
<
_SemanticsDebuggerEntry
>
removedChildren
=
oldChildren
.
difference
(
newChildren
);
...
@@ -307,9 +307,9 @@ class _SemanticsDebuggerClient implements engine.SemanticsClient {
...
@@ -307,9 +307,9 @@ class _SemanticsDebuggerClient implements engine.SemanticsClient {
int
generation
=
0
;
int
generation
=
0
;
updateSemanticsTree
(
List
<
engine
.
SemanticsNode
>
nodes
)
{
updateSemanticsTree
(
List
<
mojom
.
SemanticsNode
>
nodes
)
{
generation
+=
1
;
generation
+=
1
;
for
(
engine
.
SemanticsNode
node
in
nodes
)
for
(
mojom
.
SemanticsNode
node
in
nodes
)
_updateNode
(
node
);
_updateNode
(
node
);
for
(
VoidCallback
listener
in
_listeners
)
for
(
VoidCallback
listener
in
_listeners
)
listener
();
listener
();
...
@@ -347,9 +347,9 @@ class _SemanticsDebuggerPainter extends CustomPainter {
...
@@ -347,9 +347,9 @@ class _SemanticsDebuggerPainter extends CustomPainter {
final
int
generation
;
final
int
generation
;
final
Point
pointerPosition
;
final
Point
pointerPosition
;
void
paint
(
Canvas
canvas
,
Size
size
)
{
void
paint
(
Canvas
canvas
,
Size
size
)
{
_SemanticsDebugger
Client
.
instance
.
nodes
[
0
]?.
paint
(
_SemanticsDebugger
Listener
.
instance
.
nodes
[
0
]?.
paint
(
canvas
,
canvas
,
_SemanticsDebugger
Client
.
instance
.
nodes
[
0
].
findDepth
()
_SemanticsDebugger
Listener
.
instance
.
nodes
[
0
].
findDepth
()
);
);
if
(
pointerPosition
!=
null
)
{
if
(
pointerPosition
!=
null
)
{
Paint
paint
=
new
Paint
();
Paint
paint
=
new
Paint
();
...
...
packages/flutter/test/widget/buttons_test.dart
View file @
f8342c7a
...
@@ -12,7 +12,7 @@ import 'test_semantics.dart';
...
@@ -12,7 +12,7 @@ import 'test_semantics.dart';
void
main
(
)
{
void
main
(
)
{
test
(
'Does FlatButton contribute semantics'
,
()
{
test
(
'Does FlatButton contribute semantics'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
TestSemantics
Client
client
=
new
TestSemanticsClient
();
TestSemantics
Listener
client
=
new
TestSemanticsListener
();
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Material
(
new
Material
(
child:
new
Center
(
child:
new
Center
(
...
...
packages/flutter/test/widget/semantics_1_test.dart
View file @
f8342c7a
...
@@ -13,7 +13,7 @@ import 'test_semantics.dart';
...
@@ -13,7 +13,7 @@ import 'test_semantics.dart';
void
main
(
)
{
void
main
(
)
{
test
(
'Semantics 1'
,
()
{
test
(
'Semantics 1'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
TestSemantics
Client
client
=
new
TestSemanticsClient
();
TestSemantics
Listener
client
=
new
TestSemanticsListener
();
// smoketest
// smoketest
tester
.
pumpWidget
(
tester
.
pumpWidget
(
...
...
packages/flutter/test/widget/semantics_2_test.dart
View file @
f8342c7a
...
@@ -13,7 +13,7 @@ import 'test_semantics.dart';
...
@@ -13,7 +13,7 @@ import 'test_semantics.dart';
void
main
(
)
{
void
main
(
)
{
test
(
'Semantics 2'
,
()
{
test
(
'Semantics 2'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
TestSemantics
Client
client
=
new
TestSemanticsClient
();
TestSemantics
Listener
client
=
new
TestSemanticsListener
();
// this test is the same as the test in Semantics 1, but
// this test is the same as the test in Semantics 1, but
// starting with the second branch being ignored and then
// starting with the second branch being ignored and then
...
...
packages/flutter/test/widget/semantics_3_test.dart
View file @
f8342c7a
...
@@ -12,7 +12,7 @@ import 'test_semantics.dart';
...
@@ -12,7 +12,7 @@ import 'test_semantics.dart';
void
main
(
)
{
void
main
(
)
{
test
(
'Semantics 3'
,
()
{
test
(
'Semantics 3'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
TestSemantics
Client
client
=
new
TestSemanticsClient
();
TestSemantics
Listener
client
=
new
TestSemanticsListener
();
// implicit annotators
// implicit annotators
tester
.
pumpWidget
(
tester
.
pumpWidget
(
...
...
packages/flutter/test/widget/semantics_4_test.dart
View file @
f8342c7a
...
@@ -12,7 +12,7 @@ import 'test_semantics.dart';
...
@@ -12,7 +12,7 @@ import 'test_semantics.dart';
void
main
(
)
{
void
main
(
)
{
test
(
'Semantics 4'
,
()
{
test
(
'Semantics 4'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
TestSemantics
Client
client
=
new
TestSemanticsClient
();
TestSemantics
Listener
client
=
new
TestSemanticsListener
();
// O
// O
// / \ O=root
// / \ O=root
...
...
packages/flutter/test/widget/semantics_5_test.dart
View file @
f8342c7a
...
@@ -12,7 +12,7 @@ import 'test_semantics.dart';
...
@@ -12,7 +12,7 @@ import 'test_semantics.dart';
void
main
(
)
{
void
main
(
)
{
test
(
'Semantics 5'
,
()
{
test
(
'Semantics 5'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
TestSemantics
Client
client
=
new
TestSemanticsClient
();
TestSemantics
Listener
client
=
new
TestSemanticsListener
();
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Stack
(
new
Stack
(
...
...
packages/flutter/test/widget/test_semantics.dart
View file @
f8342c7a
...
@@ -3,15 +3,15 @@
...
@@ -3,15 +3,15 @@
// found in the LICENSE file.
// found in the LICENSE file.
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:sky_services/semantics/semantics.mojom.dart'
as
engine
;
import
'package:sky_services/semantics/semantics.mojom.dart'
as
mojom
;
class
TestSemantics
Client
implements
engine
.
SemanticsClient
{
class
TestSemantics
Listener
implements
mojom
.
SemanticsListener
{
TestSemantics
Client
()
{
TestSemantics
Listener
()
{
Renderer
.
instance
.
setSemanticsClient
(
this
);
Renderer
.
instance
.
setSemanticsClient
(
this
);
}
}
final
List
<
engine
.
SemanticsNode
>
updates
=
<
engine
.
SemanticsNode
>[];
final
List
<
mojom
.
SemanticsNode
>
updates
=
<
mojom
.
SemanticsNode
>[];
updateSemanticsTree
(
List
<
engine
.
SemanticsNode
>
nodes
)
{
updateSemanticsTree
(
List
<
mojom
.
SemanticsNode
>
nodes
)
{
assert
(!
nodes
.
any
((
engine
.
SemanticsNode
node
)
=>
node
==
null
));
assert
(!
nodes
.
any
((
mojom
.
SemanticsNode
node
)
=>
node
==
null
));
updates
.
addAll
(
nodes
);
updates
.
addAll
(
nodes
);
updates
.
add
(
null
);
updates
.
add
(
null
);
}
}
...
...
packages/flutter/test/widget/tooltip_test.dart
View file @
f8342c7a
...
@@ -359,7 +359,7 @@ void main() {
...
@@ -359,7 +359,7 @@ void main() {
test
(
'Does tooltip contribute semantics'
,
()
{
test
(
'Does tooltip contribute semantics'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
testWidgets
((
WidgetTester
tester
)
{
TestSemantics
Client
client
=
new
TestSemanticsClient
();
TestSemantics
Listener
client
=
new
TestSemanticsListener
();
GlobalKey
key
=
new
GlobalKey
();
GlobalKey
key
=
new
GlobalKey
();
tester
.
pumpWidget
(
tester
.
pumpWidget
(
new
Overlay
(
new
Overlay
(
...
...
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