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
Show 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
renderView
.
configuration
=
new
ViewConfiguration
(
size:
ui
.
window
.
size
);
}
mojom
.
Semantics
Client
_semanticsClient
;
void
setSemanticsClient
(
mojom
.
Semantics
Client
client
)
{
mojom
.
Semantics
Listener
_semanticsClient
;
void
setSemanticsClient
(
mojom
.
Semantics
Listener
client
)
{
assert
(
_semanticsClient
==
null
);
_semanticsClient
=
client
;
if
(
renderView
!=
null
)
...
...
packages/flutter/lib/src/rendering/semantics.dart
View file @
f8342c7a
...
...
@@ -333,7 +333,7 @@ class SemanticsNode extends AbstractNode {
return
result
;
}
static
void
sendSemanticsTreeTo
(
mojom
.
Semantics
Client
client
)
{
static
void
sendSemanticsTreeTo
(
mojom
.
Semantics
Listener
client
)
{
for
(
SemanticsNode
oldNode
in
_detachedNodes
)
{
// 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
...
...
@@ -427,6 +427,8 @@ class SemanticsNode extends AbstractNode {
}
class
SemanticsServer
extends
mojom
.
SemanticsServer
{
void
addSemanticsListener
(
mojom
.
SemanticsListener
listener
)
{
}
void
tap
(
int
nodeID
)
{
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;
import
'package:flutter/painting.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
'framework.dart'
;
...
...
@@ -22,11 +22,11 @@ class SemanticsDebugger extends StatefulComponent {
class
_SemanticsDebuggerState
extends
State
<
SemanticsDebugger
>
{
void
initState
()
{
super
.
initState
();
_SemanticsDebugger
Client
.
ensureInstantiated
();
_SemanticsDebugger
Client
.
instance
.
addListener
(
_update
);
_SemanticsDebugger
Listener
.
ensureInstantiated
();
_SemanticsDebugger
Listener
.
instance
.
addListener
(
_update
);
}
void
dispose
()
{
_SemanticsDebugger
Client
.
instance
.
removeListener
(
_update
);
_SemanticsDebugger
Listener
.
instance
.
removeListener
(
_update
);
super
.
dispose
();
}
void
_update
()
{
...
...
@@ -42,28 +42,28 @@ class _SemanticsDebuggerState extends State<SemanticsDebugger> {
}
void
_handleTap
()
{
assert
(
_lastPointerDownLocation
!=
null
);
_SemanticsDebugger
Client
.
instance
.
handleTap
(
_lastPointerDownLocation
);
_SemanticsDebugger
Listener
.
instance
.
handleTap
(
_lastPointerDownLocation
);
setState
(()
{
_lastPointerDownLocation
=
null
;
});
}
void
_handleLongPress
()
{
assert
(
_lastPointerDownLocation
!=
null
);
_SemanticsDebugger
Client
.
instance
.
handleLongPress
(
_lastPointerDownLocation
);
_SemanticsDebugger
Listener
.
instance
.
handleLongPress
(
_lastPointerDownLocation
);
setState
(()
{
_lastPointerDownLocation
=
null
;
});
}
void
_handlePanEnd
(
Offset
velocity
)
{
assert
(
_lastPointerDownLocation
!=
null
);
_SemanticsDebugger
Client
.
instance
.
handlePanEnd
(
_lastPointerDownLocation
,
velocity
);
_SemanticsDebugger
Listener
.
instance
.
handlePanEnd
(
_lastPointerDownLocation
,
velocity
);
setState
(()
{
_lastPointerDownLocation
=
null
;
});
}
Widget
build
(
BuildContext
context
)
{
return
new
CustomPaint
(
foregroundPainter:
new
_SemanticsDebuggerPainter
(
_SemanticsDebugger
Client
.
instance
.
generation
,
_lastPointerDownLocation
),
foregroundPainter:
new
_SemanticsDebuggerPainter
(
_SemanticsDebugger
Listener
.
instance
.
generation
,
_lastPointerDownLocation
),
child:
new
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
onTap:
_handleTap
,
...
...
@@ -233,16 +233,16 @@ class _SemanticsDebuggerEntry {
}
}
class
_SemanticsDebugger
Client
implements
engine
.
SemanticsClient
{
_SemanticsDebugger
Client
.
_
()
{
class
_SemanticsDebugger
Listener
implements
mojom
.
SemanticsListener
{
_SemanticsDebugger
Listener
.
_
()
{
Renderer
.
instance
.
setSemanticsClient
(
this
);
}
static
_SemanticsDebugger
Client
instance
;
static
engine
.
SemanticsServer
_server
;
static
void
ensureInstantiated
({
engine
.
SemanticsServer
server
})
{
static
_SemanticsDebugger
Listener
instance
;
static
mojom
.
SemanticsServer
_server
;
static
void
ensureInstantiated
({
mojom
.
SemanticsServer
server
})
{
_server
=
server
??
new
SemanticsServer
();
instance
??=
new
_SemanticsDebugger
Client
.
_
();
instance
??=
new
_SemanticsDebugger
Listener
.
_
();
}
Set
<
VoidCallback
>
_listeners
=
new
Set
<
VoidCallback
>();
...
...
@@ -256,7 +256,7 @@ class _SemanticsDebuggerClient implements engine.SemanticsClient {
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
));
if
(
node
.
flags
!=
null
)
{
entry
.
canBeTapped
=
node
.
flags
.
canBeTapped
;
...
...
@@ -295,7 +295,7 @@ class _SemanticsDebuggerClient implements engine.SemanticsClient {
Set
oldChildren
=
new
Set
<
_SemanticsDebuggerEntry
>.
from
(
entry
.
children
??
const
<
_SemanticsDebuggerEntry
>[]);
entry
.
children
?.
clear
();
entry
.
children
??=
new
List
<
_SemanticsDebuggerEntry
>();
for
(
engine
.
SemanticsNode
child
in
node
.
children
)
for
(
mojom
.
SemanticsNode
child
in
node
.
children
)
entry
.
children
.
add
(
_updateNode
(
child
));
Set
newChildren
=
new
Set
<
_SemanticsDebuggerEntry
>.
from
(
entry
.
children
);
Set
<
_SemanticsDebuggerEntry
>
removedChildren
=
oldChildren
.
difference
(
newChildren
);
...
...
@@ -307,9 +307,9 @@ class _SemanticsDebuggerClient implements engine.SemanticsClient {
int
generation
=
0
;
updateSemanticsTree
(
List
<
engine
.
SemanticsNode
>
nodes
)
{
updateSemanticsTree
(
List
<
mojom
.
SemanticsNode
>
nodes
)
{
generation
+=
1
;
for
(
engine
.
SemanticsNode
node
in
nodes
)
for
(
mojom
.
SemanticsNode
node
in
nodes
)
_updateNode
(
node
);
for
(
VoidCallback
listener
in
_listeners
)
listener
();
...
...
@@ -347,9 +347,9 @@ class _SemanticsDebuggerPainter extends CustomPainter {
final
int
generation
;
final
Point
pointerPosition
;
void
paint
(
Canvas
canvas
,
Size
size
)
{
_SemanticsDebugger
Client
.
instance
.
nodes
[
0
]?.
paint
(
_SemanticsDebugger
Listener
.
instance
.
nodes
[
0
]?.
paint
(
canvas
,
_SemanticsDebugger
Client
.
instance
.
nodes
[
0
].
findDepth
()
_SemanticsDebugger
Listener
.
instance
.
nodes
[
0
].
findDepth
()
);
if
(
pointerPosition
!=
null
)
{
Paint
paint
=
new
Paint
();
...
...
packages/flutter/test/widget/buttons_test.dart
View file @
f8342c7a
...
...
@@ -12,7 +12,7 @@ import 'test_semantics.dart';
void
main
(
)
{
test
(
'Does FlatButton contribute semantics'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
TestSemantics
Client
client
=
new
TestSemanticsClient
();
TestSemantics
Listener
client
=
new
TestSemanticsListener
();
tester
.
pumpWidget
(
new
Material
(
child:
new
Center
(
...
...
packages/flutter/test/widget/semantics_1_test.dart
View file @
f8342c7a
...
...
@@ -13,7 +13,7 @@ import 'test_semantics.dart';
void
main
(
)
{
test
(
'Semantics 1'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
TestSemantics
Client
client
=
new
TestSemanticsClient
();
TestSemantics
Listener
client
=
new
TestSemanticsListener
();
// smoketest
tester
.
pumpWidget
(
...
...
packages/flutter/test/widget/semantics_2_test.dart
View file @
f8342c7a
...
...
@@ -13,7 +13,7 @@ import 'test_semantics.dart';
void
main
(
)
{
test
(
'Semantics 2'
,
()
{
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
// 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';
void
main
(
)
{
test
(
'Semantics 3'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
TestSemantics
Client
client
=
new
TestSemanticsClient
();
TestSemantics
Listener
client
=
new
TestSemanticsListener
();
// implicit annotators
tester
.
pumpWidget
(
...
...
packages/flutter/test/widget/semantics_4_test.dart
View file @
f8342c7a
...
...
@@ -12,7 +12,7 @@ import 'test_semantics.dart';
void
main
(
)
{
test
(
'Semantics 4'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
TestSemantics
Client
client
=
new
TestSemanticsClient
();
TestSemantics
Listener
client
=
new
TestSemanticsListener
();
// O
// / \ O=root
...
...
packages/flutter/test/widget/semantics_5_test.dart
View file @
f8342c7a
...
...
@@ -12,7 +12,7 @@ import 'test_semantics.dart';
void
main
(
)
{
test
(
'Semantics 5'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
TestSemantics
Client
client
=
new
TestSemanticsClient
();
TestSemantics
Listener
client
=
new
TestSemanticsListener
();
tester
.
pumpWidget
(
new
Stack
(
...
...
packages/flutter/test/widget/test_semantics.dart
View file @
f8342c7a
...
...
@@ -3,15 +3,15 @@
// found in the LICENSE file.
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
{
TestSemantics
Client
()
{
class
TestSemantics
Listener
implements
mojom
.
SemanticsListener
{
TestSemantics
Listener
()
{
Renderer
.
instance
.
setSemanticsClient
(
this
);
}
final
List
<
engine
.
SemanticsNode
>
updates
=
<
engine
.
SemanticsNode
>[];
updateSemanticsTree
(
List
<
engine
.
SemanticsNode
>
nodes
)
{
assert
(!
nodes
.
any
((
engine
.
SemanticsNode
node
)
=>
node
==
null
));
final
List
<
mojom
.
SemanticsNode
>
updates
=
<
mojom
.
SemanticsNode
>[];
updateSemanticsTree
(
List
<
mojom
.
SemanticsNode
>
nodes
)
{
assert
(!
nodes
.
any
((
mojom
.
SemanticsNode
node
)
=>
node
==
null
));
updates
.
addAll
(
nodes
);
updates
.
add
(
null
);
}
...
...
packages/flutter/test/widget/tooltip_test.dart
View file @
f8342c7a
...
...
@@ -359,7 +359,7 @@ void main() {
test
(
'Does tooltip contribute semantics'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
TestSemantics
Client
client
=
new
TestSemanticsClient
();
TestSemantics
Listener
client
=
new
TestSemanticsListener
();
GlobalKey
key
=
new
GlobalKey
();
tester
.
pumpWidget
(
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