Add multi-line flag to semantics (flutter/engine#9850)

This commit is contained in:
Mouad Debbar 2019-07-17 09:51:09 -07:00 committed by GitHub
parent 0416e89591
commit 046005bf1f
3 changed files with 18 additions and 0 deletions

View File

@ -288,6 +288,7 @@ class SemanticsFlag {
static const int _kHasToggledStateIndex = 1 << 16;
static const int _kIsToggledIndex = 1 << 17;
static const int _kHasImplicitScrollingIndex = 1 << 18;
static const int _kIsMultilineIndex = 1 << 19;
static const int _kIsReadOnlyIndex = 1 << 20;
const SemanticsFlag._(this.index);
@ -386,6 +387,13 @@ class SemanticsFlag {
/// is a password or contains other sensitive information.
static const SemanticsFlag isObscured = SemanticsFlag._(_kIsObscuredIndex);
/// Whether the value of the semantics node is coming from a multi-line text
/// field.
///
/// This is used for text fields to distinguish single-line text fields from
/// multi-line ones.
static const SemanticsFlag isMultiline = SemanticsFlag._(_kIsMultilineIndex);
/// Whether the semantics node is the root of a subtree for which a route name
/// should be announced.
///
@ -512,6 +520,10 @@ class SemanticsFlag {
_kHasToggledStateIndex: hasToggledState,
_kIsToggledIndex: isToggled,
_kHasImplicitScrollingIndex: hasImplicitScrolling,
// TODO(mdebbar): Uncomment after both these PRs are landed:
// - https://github.com/flutter/engine/pull/9850
// - https://github.com/flutter/flutter/pull/36297
// _kIsMultilineIndex: isMultiline,
_kIsReadOnlyIndex: isReadOnly,
};
@ -556,6 +568,8 @@ class SemanticsFlag {
return 'SemanticsFlag.isToggled';
case _kHasImplicitScrollingIndex:
return 'SemanticsFlag.hasImplicitScrolling';
case _kIsMultilineIndex:
return 'SemanticsFlag.isMultiline';
case _kIsReadOnlyIndex:
return 'SemanticsFlag.isReadOnly';
}

View File

@ -69,6 +69,8 @@ enum class SemanticsFlags : int32_t {
kHasToggledState = 1 << 16,
kIsToggled = 1 << 17,
kHasImplicitScrolling = 1 << 18,
// The Dart API defines the following flag but it isn't used in iOS.
// kIsMultiline = 1 << 19,
kIsReadOnly = 1 << 20,
};

View File

@ -1614,6 +1614,8 @@ public class AccessibilityBridge extends AccessibilityNodeProvider {
HAS_TOGGLED_STATE(1 << 16),
IS_TOGGLED(1 << 17),
HAS_IMPLICIT_SCROLLING(1 << 18),
// The Dart API defines the following flag but it isn't used in Android.
// IS_MULTILINE(1 << 19);
IS_READ_ONLY(1 << 20);
final int value;