diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
commit | a90a5cba08fdf6c0ceb95101c275108a152a3aed (patch) | |
tree | 532507288f3defd7f4dcf1af49698bcb76034855 /dom/xul | |
parent | Adding debian version 126.0.1-1. (diff) | |
download | firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.tar.xz firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/xul')
-rw-r--r-- | dom/xul/nsXULElement.cpp | 23 | ||||
-rw-r--r-- | dom/xul/nsXULElement.h | 4 |
2 files changed, 13 insertions, 14 deletions
diff --git a/dom/xul/nsXULElement.cpp b/dom/xul/nsXULElement.cpp index 5bccc15f69..be798e309f 100644 --- a/dom/xul/nsXULElement.cpp +++ b/dom/xul/nsXULElement.cpp @@ -37,6 +37,7 @@ #include "mozilla/EventQueue.h" #include "mozilla/EventStateManager.h" #include "mozilla/FlushType.h" +#include "mozilla/FocusModel.h" #include "mozilla/GlobalKeyListener.h" #include "mozilla/HoldDropJSObjects.h" #include "mozilla/MacroForEach.h" @@ -50,6 +51,7 @@ #include "mozilla/StaticAnalysisFunctions.h" #include "mozilla/StaticPrefs_javascript.h" #include "mozilla/StaticPtr.h" +#include "mozilla/FocusModel.h" #include "mozilla/TaskController.h" #include "mozilla/UniquePtr.h" #include "mozilla/URLExtraData.h" @@ -373,12 +375,12 @@ static bool IsNonList(mozilla::dom::NodeInfo* aNodeInfo) { } nsXULElement::XULFocusability nsXULElement::GetXULFocusability( - bool aWithMouse) { + IsFocusableFlags aFlags) { #ifdef XP_MACOSX // On Mac, mouse interactions only focus the element if it's a list, // or if it's a remote target, since the remote target must handle // the focus. - if (aWithMouse && IsNonList(mNodeInfo) && + if ((aFlags & IsFocusableFlags::WithMouse) && IsNonList(mNodeInfo) && !EventStateManager::IsTopLevelRemoteTarget(this)) { return XULFocusability::NeverFocusable(); } @@ -402,15 +404,12 @@ nsXULElement::XULFocusability nsXULElement::GetXULFocusability( result.mForcedFocusable.emplace(true); result.mForcedTabIndexIfFocusable.emplace(attrVal.value()); } - if (xulControl && sTabFocusModelAppliesToXUL && - !(sTabFocusModel & eTabFocus_formElementsMask) && IsNonList(mNodeInfo)) { + if (xulControl && FocusModel::AppliesToXUL() && + !FocusModel::IsTabFocusable(TabFocusableType::FormElements) && + IsNonList(mNodeInfo)) { // By default, the tab focus model doesn't apply to xul element on any - // system but OS X. on OS X we're following it for UI elements (XUL) as - // sTabFocusModel is based on "Full Keyboard Access" system setting (see - // mac/nsILookAndFeel). both textboxes and list elements (i.e. trees and - // list) should always be focusable (textboxes are handled as html:input) - // For compatibility, we only do this for controls, otherwise elements - // like <browser> cannot take this focus. + // system but OS X. For compatibility, we only do this for controls, + // otherwise elements like <browser> cannot take this focus. result.mForcedTabIndexIfFocusable = Some(-1); } return result; @@ -418,8 +417,8 @@ nsXULElement::XULFocusability nsXULElement::GetXULFocusability( // XUL elements are not focusable unless explicitly opted-into it with // -moz-user-focus: normal, or the tabindex attribute. -Focusable nsXULElement::IsFocusableWithoutStyle(bool aWithMouse) { - const auto focusability = GetXULFocusability(aWithMouse); +Focusable nsXULElement::IsFocusableWithoutStyle(IsFocusableFlags aFlags) { + const auto focusability = GetXULFocusability(aFlags); const bool focusable = focusability.mDefaultFocusable; return {focusable, focusable ? focusability.mForcedTabIndexIfFocusable.valueOr(-1) : -1}; diff --git a/dom/xul/nsXULElement.h b/dom/xul/nsXULElement.h index 2681a14a9a..f14ec31505 100644 --- a/dom/xul/nsXULElement.h +++ b/dom/xul/nsXULElement.h @@ -401,8 +401,8 @@ class nsXULElement : public nsStyledElement { return {false, mozilla::Some(false), mozilla::Some(-1)}; } }; - XULFocusability GetXULFocusability(bool aWithMouse); - Focusable IsFocusableWithoutStyle(bool aWithMouse) override; + XULFocusability GetXULFocusability(mozilla::IsFocusableFlags); + Focusable IsFocusableWithoutStyle(mozilla::IsFocusableFlags) override; NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override; |