This is an automated email from the git hooks/post-receive script.
richard pushed a commit to branch base-browser-102.5.0esr-12.0-1 in repository tor-browser.
commit 1f8f27445df1bee4b2b9e7901f1163b509cf54ed Author: Nika Layzell nika@thelayzells.com AuthorDate: Fri Oct 14 21:32:17 2022 +0000
Bug 1793676 - Dynamically generate DOM code names for some continuous runs of codes, r=mccr8, a=dmeehan
Differential Revision: https://phabricator.services.mozilla.com/D159400 --- widget/WidgetEventImpl.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
diff --git a/widget/WidgetEventImpl.cpp b/widget/WidgetEventImpl.cpp index 254b176a4365..aa3a9f94adf5 100644 --- a/widget/WidgetEventImpl.cpp +++ b/widget/WidgetEventImpl.cpp @@ -1186,6 +1186,37 @@ void WidgetKeyboardEvent::GetDOMCodeName(CodeNameIndex aCodeNameIndex, MOZ_RELEASE_ASSERT( static_cast<size_t>(aCodeNameIndex) < ArrayLength(kCodeNames), "Illegal physical code enumeration value"); + + // Generate some continuous runs of codes, rather than looking them up. + if (aCodeNameIndex >= CODE_NAME_INDEX_KeyA && + aCodeNameIndex <= CODE_NAME_INDEX_KeyZ) { + uint32_t index = aCodeNameIndex - CODE_NAME_INDEX_KeyA; + aCodeName.AssignLiteral(u"Key"); + aCodeName.Append(u'A' + index); + return; + } + if (aCodeNameIndex >= CODE_NAME_INDEX_Digit0 && + aCodeNameIndex <= CODE_NAME_INDEX_Digit9) { + uint32_t index = aCodeNameIndex - CODE_NAME_INDEX_Digit0; + aCodeName.AssignLiteral(u"Digit"); + aCodeName.AppendInt(index); + return; + } + if (aCodeNameIndex >= CODE_NAME_INDEX_Numpad0 && + aCodeNameIndex <= CODE_NAME_INDEX_Numpad9) { + uint32_t index = aCodeNameIndex - CODE_NAME_INDEX_Numpad0; + aCodeName.AssignLiteral(u"Numpad"); + aCodeName.AppendInt(index); + return; + } + if (aCodeNameIndex >= CODE_NAME_INDEX_F1 && + aCodeNameIndex <= CODE_NAME_INDEX_F24) { + uint32_t index = aCodeNameIndex - CODE_NAME_INDEX_F1; + aCodeName.Assign(u'F'); + aCodeName.AppendInt(index + 1); + return; + } + aCodeName = kCodeNames[aCodeNameIndex]; }