Announce the correct new value after increase/decrease has been performed on iOS (flutter/engine#4282)
This commit is contained in:
committed by
GitHub
parent
f0df2b460d
commit
49200487c9
@@ -215,9 +215,12 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
|
||||
/// with an action that is no longer possible.
|
||||
///
|
||||
/// The `label` is a string that describes this node. The `value` property
|
||||
/// describes the current value of the node as a string. The `hint` string
|
||||
/// describes what result an action performed on this node has. The reading
|
||||
/// direction of all these strings is given by `textDirection`.
|
||||
/// describes the current value of the node as a string. The `increasedValue`
|
||||
/// string will become the `value` string after a [SemanticsAction.increase]
|
||||
/// action is performed. The `decreasedValue` string will become the `value`
|
||||
/// string after a [SemanticsAction.decrease] action is performed. The `hint`
|
||||
/// string describes what result an action performed on this node has. The
|
||||
/// reading direction of all these strings is given by `textDirection`.
|
||||
///
|
||||
/// The `rect` is the region occupied by this node in its own coordinate
|
||||
/// system.
|
||||
@@ -232,6 +235,8 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
|
||||
String label,
|
||||
String hint,
|
||||
String value,
|
||||
String increasedValue,
|
||||
String decreasedValue,
|
||||
TextDirection textDirection,
|
||||
Float64List transform,
|
||||
Int32List children
|
||||
@@ -248,6 +253,8 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
|
||||
label,
|
||||
hint,
|
||||
value,
|
||||
increasedValue,
|
||||
decreasedValue,
|
||||
textDirection != null ? textDirection.index + 1 : 0,
|
||||
transform,
|
||||
children);
|
||||
@@ -263,6 +270,8 @@ class SemanticsUpdateBuilder extends NativeFieldWrapperClass2 {
|
||||
String label,
|
||||
String hint,
|
||||
String value,
|
||||
String increasedValue,
|
||||
String decreasedValue,
|
||||
int textDirection,
|
||||
Float64List transform,
|
||||
Int32List children
|
||||
|
||||
@@ -54,6 +54,8 @@ struct SemanticsNode {
|
||||
std::string label;
|
||||
std::string hint;
|
||||
std::string value;
|
||||
std::string increasedValue;
|
||||
std::string decreasedValue;
|
||||
int32_t textDirection = 0; // 0=unknown, 1=rtl, 2=ltr
|
||||
|
||||
SkRect rect = SkRect::MakeEmpty();
|
||||
|
||||
@@ -44,6 +44,8 @@ void SemanticsUpdateBuilder::updateNode(int id,
|
||||
std::string label,
|
||||
std::string hint,
|
||||
std::string value,
|
||||
std::string increasedValue,
|
||||
std::string decreasedValue,
|
||||
int textDirection,
|
||||
const tonic::Float64List& transform,
|
||||
const tonic::Int32List& children) {
|
||||
@@ -55,6 +57,8 @@ void SemanticsUpdateBuilder::updateNode(int id,
|
||||
node.label = label;
|
||||
node.hint = hint;
|
||||
node.value = value;
|
||||
node.increasedValue = increasedValue;
|
||||
node.decreasedValue = decreasedValue;
|
||||
node.textDirection = textDirection;
|
||||
node.transform.setColMajord(transform.data());
|
||||
node.children = std::vector<int32_t>(
|
||||
|
||||
@@ -35,6 +35,8 @@ class SemanticsUpdateBuilder
|
||||
std::string label,
|
||||
std::string hint,
|
||||
std::string value,
|
||||
std::string increasedValue,
|
||||
std::string decreasedValue,
|
||||
int textDirection,
|
||||
const tonic::Float64List& transform,
|
||||
const tonic::Int32List& children);
|
||||
|
||||
@@ -245,12 +245,14 @@ bool GeometryComparator(SemanticsObject* a, SemanticsObject* b) {
|
||||
|
||||
- (void)accessibilityIncrement {
|
||||
if (_node.HasAction(blink::SemanticsAction::kIncrease)) {
|
||||
_node.value = _node.increasedValue;
|
||||
_bridge->DispatchSemanticsAction(_uid, blink::SemanticsAction::kIncrease);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)accessibilityDecrement {
|
||||
if (_node.HasAction(blink::SemanticsAction::kDecrease)) {
|
||||
_node.value = _node.decreasedValue;
|
||||
_bridge->DispatchSemanticsAction(_uid, blink::SemanticsAction::kDecrease);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user