mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fix inconsistent enum/class private member naming (flutter/engine#32409)
Classes that model enums in dart:ui typically name fields modelling the enum values as `_kFooIndex`. This associated value matches the enum value from embedder.h. In https://github.com/flutter/engine/pull/32408 we add a test that verifies that dart:ui classes model the same set of values in the native implementation, the web_ui implementation, and the embedder API. Testing this is much simpler if we use consistent naming for all enum values. Issue: https://github.com/flutter/engine/pull/32408
This commit is contained in:
parent
fc114a5431
commit
a551b91c78
@ -34,11 +34,11 @@ class SemanticsAction {
|
||||
static const int _kPasteIndex = 1 << 14;
|
||||
static const int _kDidGainAccessibilityFocusIndex = 1 << 15;
|
||||
static const int _kDidLoseAccessibilityFocusIndex = 1 << 16;
|
||||
static const int _kCustomAction = 1 << 17;
|
||||
static const int _kCustomActionIndex = 1 << 17;
|
||||
static const int _kDismissIndex = 1 << 18;
|
||||
static const int _kMoveCursorForwardByWordIndex = 1 << 19;
|
||||
static const int _kMoveCursorBackwardByWordIndex = 1 << 20;
|
||||
static const int _kSetText = 1 << 21;
|
||||
static const int _kSetTextIndex = 1 << 21;
|
||||
// READ THIS: if you add an action here, you MUST update the
|
||||
// numSemanticsActions value in testing/dart/semantics_test.dart, or tests
|
||||
// will fail.
|
||||
@ -122,7 +122,7 @@ class SemanticsAction {
|
||||
///
|
||||
/// The action includes a string argument, which is the new text to
|
||||
/// replace.
|
||||
static const SemanticsAction setText = SemanticsAction._(_kSetText);
|
||||
static const SemanticsAction setText = SemanticsAction._(_kSetTextIndex);
|
||||
|
||||
/// Set the text selection to the given range.
|
||||
///
|
||||
@ -174,7 +174,7 @@ class SemanticsAction {
|
||||
///
|
||||
/// This handler is added automatically whenever a custom accessibility
|
||||
/// action is added to a semantics node.
|
||||
static const SemanticsAction customAction = SemanticsAction._(_kCustomAction);
|
||||
static const SemanticsAction customAction = SemanticsAction._(_kCustomActionIndex);
|
||||
|
||||
/// A request that the node should be dismissed.
|
||||
///
|
||||
@ -223,11 +223,11 @@ class SemanticsAction {
|
||||
_kPasteIndex: paste,
|
||||
_kDidGainAccessibilityFocusIndex: didGainAccessibilityFocus,
|
||||
_kDidLoseAccessibilityFocusIndex: didLoseAccessibilityFocus,
|
||||
_kCustomAction: customAction,
|
||||
_kCustomActionIndex: customAction,
|
||||
_kDismissIndex: dismiss,
|
||||
_kMoveCursorForwardByWordIndex: moveCursorForwardByWord,
|
||||
_kMoveCursorBackwardByWordIndex: moveCursorBackwardByWord,
|
||||
_kSetText: setText,
|
||||
_kSetTextIndex: setText,
|
||||
};
|
||||
|
||||
@override
|
||||
@ -267,7 +267,7 @@ class SemanticsAction {
|
||||
return 'SemanticsAction.didGainAccessibilityFocus';
|
||||
case _kDidLoseAccessibilityFocusIndex:
|
||||
return 'SemanticsAction.didLoseAccessibilityFocus';
|
||||
case _kCustomAction:
|
||||
case _kCustomActionIndex:
|
||||
return 'SemanticsAction.customAction';
|
||||
case _kDismissIndex:
|
||||
return 'SemanticsAction.dismiss';
|
||||
@ -275,7 +275,7 @@ class SemanticsAction {
|
||||
return 'SemanticsAction.moveCursorForwardByWord';
|
||||
case _kMoveCursorBackwardByWordIndex:
|
||||
return 'SemanticsAction.moveCursorBackwardByWord';
|
||||
case _kSetText:
|
||||
case _kSetTextIndex:
|
||||
return 'SemanticsAction.setText';
|
||||
}
|
||||
assert(false, 'Unhandled index: $index (0x${index.toRadixString(8).padLeft(4, "0")})');
|
||||
|
||||
@ -786,7 +786,7 @@ class SingletonFlutterWindow extends FlutterWindow {
|
||||
class AccessibilityFeatures {
|
||||
const AccessibilityFeatures._(this._index);
|
||||
|
||||
static const int _kAccessibleNavigation = 1 << 0;
|
||||
static const int _kAccessibleNavigationIndex = 1 << 0;
|
||||
static const int _kInvertColorsIndex = 1 << 1;
|
||||
static const int _kDisableAnimationsIndex = 1 << 2;
|
||||
static const int _kBoldTextIndex = 1 << 3;
|
||||
@ -801,7 +801,7 @@ class AccessibilityFeatures {
|
||||
/// interaction model of the device.
|
||||
///
|
||||
/// For example, TalkBack on Android and VoiceOver on iOS enable this flag.
|
||||
bool get accessibleNavigation => _kAccessibleNavigation & _index != 0;
|
||||
bool get accessibleNavigation => _kAccessibleNavigationIndex & _index != 0;
|
||||
|
||||
/// The platform is inverting the colors of the application.
|
||||
bool get invertColors => _kInvertColorsIndex & _index != 0;
|
||||
|
||||
@ -24,11 +24,11 @@ class SemanticsAction {
|
||||
static const int _kPasteIndex = 1 << 14;
|
||||
static const int _kDidGainAccessibilityFocusIndex = 1 << 15;
|
||||
static const int _kDidLoseAccessibilityFocusIndex = 1 << 16;
|
||||
static const int _kCustomAction = 1 << 17;
|
||||
static const int _kCustomActionIndex = 1 << 17;
|
||||
static const int _kDismissIndex = 1 << 18;
|
||||
static const int _kMoveCursorForwardByWordIndex = 1 << 19;
|
||||
static const int _kMoveCursorBackwardByWordIndex = 1 << 20;
|
||||
static const int _kSetText = 1 << 21;
|
||||
static const int _kSetTextIndex = 1 << 21;
|
||||
|
||||
final int index;
|
||||
|
||||
@ -43,14 +43,14 @@ class SemanticsAction {
|
||||
static const SemanticsAction showOnScreen = SemanticsAction._(_kShowOnScreenIndex);
|
||||
static const SemanticsAction moveCursorForwardByCharacter = SemanticsAction._(_kMoveCursorForwardByCharacterIndex);
|
||||
static const SemanticsAction moveCursorBackwardByCharacter = SemanticsAction._(_kMoveCursorBackwardByCharacterIndex);
|
||||
static const SemanticsAction setText = SemanticsAction._(_kSetText);
|
||||
static const SemanticsAction setText = SemanticsAction._(_kSetTextIndex);
|
||||
static const SemanticsAction setSelection = SemanticsAction._(_kSetSelectionIndex);
|
||||
static const SemanticsAction copy = SemanticsAction._(_kCopyIndex);
|
||||
static const SemanticsAction cut = SemanticsAction._(_kCutIndex);
|
||||
static const SemanticsAction paste = SemanticsAction._(_kPasteIndex);
|
||||
static const SemanticsAction didGainAccessibilityFocus = SemanticsAction._(_kDidGainAccessibilityFocusIndex);
|
||||
static const SemanticsAction didLoseAccessibilityFocus = SemanticsAction._(_kDidLoseAccessibilityFocusIndex);
|
||||
static const SemanticsAction customAction = SemanticsAction._(_kCustomAction);
|
||||
static const SemanticsAction customAction = SemanticsAction._(_kCustomActionIndex);
|
||||
static const SemanticsAction dismiss = SemanticsAction._(_kDismissIndex);
|
||||
static const SemanticsAction moveCursorForwardByWord = SemanticsAction._(_kMoveCursorForwardByWordIndex);
|
||||
static const SemanticsAction moveCursorBackwardByWord = SemanticsAction._(_kMoveCursorBackwardByWordIndex);
|
||||
@ -73,11 +73,11 @@ class SemanticsAction {
|
||||
_kPasteIndex: paste,
|
||||
_kDidGainAccessibilityFocusIndex: didGainAccessibilityFocus,
|
||||
_kDidLoseAccessibilityFocusIndex: didLoseAccessibilityFocus,
|
||||
_kCustomAction: customAction,
|
||||
_kCustomActionIndex: customAction,
|
||||
_kDismissIndex: dismiss,
|
||||
_kMoveCursorForwardByWordIndex: moveCursorForwardByWord,
|
||||
_kMoveCursorBackwardByWordIndex: moveCursorBackwardByWord,
|
||||
_kSetText: setText,
|
||||
_kSetTextIndex: setText,
|
||||
};
|
||||
|
||||
@override
|
||||
@ -117,7 +117,7 @@ class SemanticsAction {
|
||||
return 'SemanticsAction.didGainAccessibilityFocus';
|
||||
case _kDidLoseAccessibilityFocusIndex:
|
||||
return 'SemanticsAction.didLoseAccessibilityFocus';
|
||||
case _kCustomAction:
|
||||
case _kCustomActionIndex:
|
||||
return 'SemanticsAction.customAction';
|
||||
case _kDismissIndex:
|
||||
return 'SemanticsAction.dismiss';
|
||||
@ -125,7 +125,7 @@ class SemanticsAction {
|
||||
return 'SemanticsAction.moveCursorForwardByWord';
|
||||
case _kMoveCursorBackwardByWordIndex:
|
||||
return 'SemanticsAction.moveCursorBackwardByWord';
|
||||
case _kSetText:
|
||||
case _kSetTextIndex:
|
||||
return 'SemanticsAction.setText';
|
||||
}
|
||||
assert(false, 'Unhandled index: $index (0x${index.toRadixString(8).padLeft(4, "0")})');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user