refactor: use kKeyModifiers in IsAltModifier() (#47089)

We probably didn't use this before because IsAltModifier() was written
two years before the KeyModifiers mask was added upstream in 98ec378a.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot]
2025-05-14 12:53:59 -05:00
committed by GitHub
parent 8de0bb5bc3
commit df8ed0acc3

View File

@@ -20,13 +20,8 @@ bool IsAltKey(const input::NativeWebKeyboardEvent& event) {
}
bool IsAltModifier(const input::NativeWebKeyboardEvent& event) {
using Modifiers = input::NativeWebKeyboardEvent::Modifiers;
int modifiers = event.GetModifiers();
modifiers &= ~Modifiers::kNumLockOn;
modifiers &= ~Modifiers::kCapsLockOn;
return (modifiers == Modifiers::kAltKey) ||
(modifiers == (Modifiers::kAltKey | Modifiers::kIsLeft)) ||
(modifiers == (Modifiers::kAltKey | Modifiers::kIsRight));
using Mods = input::NativeWebKeyboardEvent::Modifiers;
return (event.GetModifiers() & Mods::kKeyModifiers) == Mods::kAltKey;
}
} // namespace