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
c9215e6b
Unverified
Commit
c9215e6b
authored
Jan 26, 2018
by
Michael Goderbauer
Committed by
GitHub
Jan 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wiring for semantic actions copy, cut, paste (#14295)
* Roll engine to 6921873c71e700235c0f68f0359be2332f93c8bc
parent
4c21bf10
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
172 additions
and
1 deletion
+172
-1
engine.version
bin/internal/engine.version
+1
-1
custom_paint.dart
packages/flutter/lib/src/rendering/custom_paint.dart
+9
-0
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+79
-0
semantics.dart
packages/flutter/lib/src/semantics/semantics.dart
+68
-0
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+12
-0
semantics_test.dart
packages/flutter/test/widgets/semantics_test.dart
+3
-0
No files found.
bin/internal/engine.version
View file @
c9215e6b
7c34dfafc9acece1a9438f206bfbb0a9bedba3bf
6921873c71e700235c0f68f0359be2332f93c8bc
packages/flutter/lib/src/rendering/custom_paint.dart
View file @
c9215e6b
...
...
@@ -859,6 +859,15 @@ class RenderCustomPaint extends RenderProxyBox {
if
(
properties
.
onDecrease
!=
null
)
{
config
.
onDecrease
=
properties
.
onDecrease
;
}
if
(
properties
.
onCopy
!=
null
)
{
config
.
onCopy
=
properties
.
onCopy
;
}
if
(
properties
.
onCut
!=
null
)
{
config
.
onCut
=
properties
.
onCut
;
}
if
(
properties
.
onPaste
!=
null
)
{
config
.
onPaste
=
properties
.
onPaste
;
}
if
(
properties
.
onMoveCursorForwardByCharacter
!=
null
)
{
config
.
onMoveCursorForwardByCharacter
=
properties
.
onMoveCursorForwardByCharacter
;
}
...
...
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
c9215e6b
...
...
@@ -3015,6 +3015,9 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
VoidCallback
onScrollDown
,
VoidCallback
onIncrease
,
VoidCallback
onDecrease
,
VoidCallback
onCopy
,
VoidCallback
onCut
,
VoidCallback
onPaste
,
MoveCursorHandler
onMoveCursorForwardByCharacter
,
MoveCursorHandler
onMoveCursorBackwardByCharacter
,
SetSelectionHandler
onSetSelection
,
...
...
@@ -3039,6 +3042,9 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
_onScrollDown
=
onScrollDown
,
_onIncrease
=
onIncrease
,
_onDecrease
=
onDecrease
,
_onCopy
=
onCopy
,
_onCut
=
onCut
,
_onPaste
=
onPaste
,
_onMoveCursorForwardByCharacter
=
onMoveCursorForwardByCharacter
,
_onMoveCursorBackwardByCharacter
=
onMoveCursorBackwardByCharacter
,
_onSetSelection
=
onSetSelection
,
...
...
@@ -3365,6 +3371,58 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
markNeedsSemanticsUpdate
();
}
/// The handler for [SemanticsAction.copy].
///
/// This is a request to copy the current selection to the clipboard.
///
/// TalkBack users on Android can trigger this action from the local context
/// menu of a text field, for example.
VoidCallback
get
onCopy
=>
_onCopy
;
VoidCallback
_onCopy
;
set
onCopy
(
VoidCallback
handler
)
{
if
(
_onCopy
==
handler
)
return
;
final
bool
hadValue
=
_onCopy
!=
null
;
_onCopy
=
handler
;
if
((
handler
!=
null
)
!=
hadValue
)
markNeedsSemanticsUpdate
();
}
/// The handler for [SemanticsAction.cut].
///
/// This is a request to cut the current selection and place it in the
/// clipboard.
///
/// TalkBack users on Android can trigger this action from the local context
/// menu of a text field, for example.
VoidCallback
get
onCut
=>
_onCut
;
VoidCallback
_onCut
;
set
onCut
(
VoidCallback
handler
)
{
if
(
_onCut
==
handler
)
return
;
final
bool
hadValue
=
_onCut
!=
null
;
_onCut
=
handler
;
if
((
handler
!=
null
)
!=
hadValue
)
markNeedsSemanticsUpdate
();
}
/// The handler for [SemanticsAction.paste].
///
/// This is a request to paste the current content of the clipboard.
///
/// TalkBack users on Android can trigger this action from the local context
/// menu of a text field, for example.
VoidCallback
get
onPaste
=>
_onPaste
;
VoidCallback
_onPaste
;
set
onPaste
(
VoidCallback
handler
)
{
if
(
_onPaste
==
handler
)
return
;
final
bool
hadValue
=
_onPaste
!=
null
;
_onPaste
=
handler
;
if
((
handler
!=
null
)
!=
hadValue
)
markNeedsSemanticsUpdate
();
}
/// The handler for [SemanticsAction.onMoveCursorForwardByCharacter].
///
/// This handler is invoked when the user wants to move the cursor in a
...
...
@@ -3464,6 +3522,12 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
config
.
onIncrease
=
_performIncrease
;
if
(
onDecrease
!=
null
)
config
.
onDecrease
=
_performDecrease
;
if
(
onCopy
!=
null
)
config
.
onCopy
=
_performCopy
;
if
(
onCut
!=
null
)
config
.
onCut
=
_performCut
;
if
(
onPaste
!=
null
)
config
.
onPaste
=
_performPaste
;
if
(
onMoveCursorForwardByCharacter
!=
null
)
config
.
onMoveCursorForwardByCharacter
=
_performMoveCursorForwardByCharacter
;
if
(
onMoveCursorBackwardByCharacter
!=
null
)
...
...
@@ -3512,6 +3576,21 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
onDecrease
();
}
void
_performCopy
()
{
if
(
onCopy
!=
null
)
onCopy
();
}
void
_performCut
()
{
if
(
onCut
!=
null
)
onCut
();
}
void
_performPaste
()
{
if
(
onPaste
!=
null
)
onPaste
();
}
void
_performMoveCursorForwardByCharacter
(
bool
extendSelection
)
{
if
(
onMoveCursorForwardByCharacter
!=
null
)
onMoveCursorForwardByCharacter
(
extendSelection
);
...
...
packages/flutter/lib/src/semantics/semantics.dart
View file @
c9215e6b
...
...
@@ -277,6 +277,9 @@ class SemanticsProperties extends DiagnosticableTree {
this
.
onScrollDown
,
this
.
onIncrease
,
this
.
onDecrease
,
this
.
onCopy
,
this
.
onCut
,
this
.
onPaste
,
this
.
onMoveCursorForwardByCharacter
,
this
.
onMoveCursorBackwardByCharacter
,
this
.
onSetSelection
,
...
...
@@ -472,6 +475,31 @@ class SemanticsProperties extends DiagnosticableTree {
/// volume down button.
final
VoidCallback
onDecrease
;
/// The handler for [SemanticsAction.copy].
///
/// This is a request to copy the current selection to the clipboard.
///
/// TalkBack users on Android can trigger this action from the local context
/// menu of a text field, for example.
final
VoidCallback
onCopy
;
/// The handler for [SemanticsAction.cut].
///
/// This is a request to cut the current selection and place it in the
/// clipboard.
///
/// TalkBack users on Android can trigger this action from the local context
/// menu of a text field, for example.
final
VoidCallback
onCut
;
/// The handler for [SemanticsAction.paste].
///
/// This is a request to paste the current content of the clipboard.
///
/// TalkBack users on Android can trigger this action from the local context
/// menu of a text field, for example.
final
VoidCallback
onPaste
;
/// The handler for [SemanticsAction.onMoveCursorForwardByCharacter].
///
/// This handler is invoked when the user wants to move the cursor in a
...
...
@@ -1618,6 +1646,46 @@ class SemanticsConfiguration {
_onDecrease
=
value
;
}
/// The handler for [SemanticsAction.copy].
///
/// This is a request to copy the current selection to the clipboard.
///
/// TalkBack users on Android can trigger this action from the local context
/// menu of a text field, for example.
VoidCallback
get
onCopy
=>
_onCopy
;
VoidCallback
_onCopy
;
set
onCopy
(
VoidCallback
value
)
{
_addArgumentlessAction
(
SemanticsAction
.
copy
,
value
);
_onCopy
=
value
;
}
/// The handler for [SemanticsAction.cut].
///
/// This is a request to cut the current selection and place it in the
/// clipboard.
///
/// TalkBack users on Android can trigger this action from the local context
/// menu of a text field, for example.
VoidCallback
get
onCut
=>
_onCut
;
VoidCallback
_onCut
;
set
onCut
(
VoidCallback
value
)
{
_addArgumentlessAction
(
SemanticsAction
.
cut
,
value
);
_onCut
=
value
;
}
/// The handler for [SemanticsAction.paste].
///
/// This is a request to paste the current content of the clipboard.
///
/// TalkBack users on Android can trigger this action from the local context
/// menu of a text field, for example.
VoidCallback
get
onPaste
=>
_onPaste
;
VoidCallback
_onPaste
;
set
onPaste
(
VoidCallback
value
)
{
_addArgumentlessAction
(
SemanticsAction
.
paste
,
value
);
_onPaste
=
value
;
}
/// The handler for [SemanticsAction.showOnScreen].
///
/// A request to fully show the semantics node on screen. For example, this
...
...
packages/flutter/lib/src/widgets/basic.dart
View file @
c9215e6b
...
...
@@ -4852,6 +4852,9 @@ class Semantics extends SingleChildRenderObjectWidget {
VoidCallback
onScrollDown
,
VoidCallback
onIncrease
,
VoidCallback
onDecrease
,
VoidCallback
onCopy
,
VoidCallback
onCut
,
VoidCallback
onPaste
,
MoveCursorHandler
onMoveCursorForwardByCharacter
,
MoveCursorHandler
onMoveCursorBackwardByCharacter
,
SetSelectionHandler
onSetSelection
,
...
...
@@ -4879,6 +4882,9 @@ class Semantics extends SingleChildRenderObjectWidget {
onScrollDown:
onScrollDown
,
onIncrease:
onIncrease
,
onDecrease:
onDecrease
,
onCopy:
onCopy
,
onCut:
onCut
,
onPaste:
onPaste
,
onMoveCursorForwardByCharacter:
onMoveCursorForwardByCharacter
,
onMoveCursorBackwardByCharacter:
onMoveCursorBackwardByCharacter
,
onSetSelection:
onSetSelection
,
...
...
@@ -4948,6 +4954,9 @@ class Semantics extends SingleChildRenderObjectWidget {
onScrollDown:
properties
.
onScrollDown
,
onIncrease:
properties
.
onIncrease
,
onDecrease:
properties
.
onDecrease
,
onCopy:
properties
.
onCopy
,
onCut:
properties
.
onCut
,
onPaste:
properties
.
onPaste
,
onMoveCursorForwardByCharacter:
properties
.
onMoveCursorForwardByCharacter
,
onMoveCursorBackwardByCharacter:
properties
.
onMoveCursorBackwardByCharacter
,
onSetSelection:
properties
.
onSetSelection
,
...
...
@@ -4988,6 +4997,9 @@ class Semantics extends SingleChildRenderObjectWidget {
..
onScrollDown
=
properties
.
onScrollDown
..
onIncrease
=
properties
.
onIncrease
..
onDecrease
=
properties
.
onDecrease
..
onCopy
=
properties
.
onCopy
..
onCut
=
properties
.
onCut
..
onPaste
=
properties
.
onPaste
..
onMoveCursorForwardByCharacter
=
properties
.
onMoveCursorForwardByCharacter
..
onMoveCursorBackwardByCharacter
=
properties
.
onMoveCursorForwardByCharacter
..
onSetSelection
=
properties
.
onSetSelection
;
...
...
packages/flutter/test/widgets/semantics_test.dart
View file @
c9215e6b
...
...
@@ -392,6 +392,9 @@ void main() {
onScrollDown:
()
=>
performedActions
.
add
(
SemanticsAction
.
scrollDown
),
onIncrease:
()
=>
performedActions
.
add
(
SemanticsAction
.
increase
),
onDecrease:
()
=>
performedActions
.
add
(
SemanticsAction
.
decrease
),
onCopy:
()
=>
performedActions
.
add
(
SemanticsAction
.
copy
),
onCut:
()
=>
performedActions
.
add
(
SemanticsAction
.
cut
),
onPaste:
()
=>
performedActions
.
add
(
SemanticsAction
.
paste
),
onMoveCursorForwardByCharacter:
(
bool
_
)
=>
performedActions
.
add
(
SemanticsAction
.
moveCursorForwardByCharacter
),
onMoveCursorBackwardByCharacter:
(
bool
_
)
=>
performedActions
.
add
(
SemanticsAction
.
moveCursorBackwardByCharacter
),
onSetSelection:
(
TextSelection
_
)
=>
performedActions
.
add
(
SemanticsAction
.
setSelection
),
...
...
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