From 8dd16259287f58f9273002717ec4d27e97127719 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:43:14 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- dom/html/HTMLImageElement.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'dom/html/HTMLImageElement.cpp') diff --git a/dom/html/HTMLImageElement.cpp b/dom/html/HTMLImageElement.cpp index 691216d152..597d7f4b22 100644 --- a/dom/html/HTMLImageElement.cpp +++ b/dom/html/HTMLImageElement.cpp @@ -6,6 +6,7 @@ #include "mozilla/dom/HTMLImageElement.h" #include "mozilla/PresShell.h" +#include "mozilla/FocusModel.h" #include "mozilla/dom/BindContext.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/HTMLImageElementBinding.h" @@ -488,13 +489,13 @@ nsINode* HTMLImageElement::GetScopeChainParent() const { return nsGenericHTMLElement::GetScopeChainParent(); } -bool HTMLImageElement::IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable, - int32_t* aTabIndex) { +bool HTMLImageElement::IsHTMLFocusable(IsFocusableFlags aFlags, + bool* aIsFocusable, int32_t* aTabIndex) { int32_t tabIndex = TabIndex(); if (IsInComposedDoc() && FindImageMap()) { // Use tab index on individual map areas. - *aTabIndex = (sTabFocusModel & eTabFocus_linksMask) ? 0 : -1; + *aTabIndex = FocusModel::IsTabFocusable(TabFocusableType::Links) ? 0 : -1; // Image map is not focusable itself, but flag as tabbable // so that image map areas get walked into. *aIsFocusable = false; @@ -502,8 +503,10 @@ bool HTMLImageElement::IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable, } // Can be in tab order if tabindex >=0 and form controls are tabbable. - *aTabIndex = (sTabFocusModel & eTabFocus_formElementsMask) ? tabIndex : -1; - *aIsFocusable = IsFormControlDefaultFocusable(aWithMouse) && + *aTabIndex = FocusModel::IsTabFocusable(TabFocusableType::FormElements) + ? tabIndex + : -1; + *aIsFocusable = IsFormControlDefaultFocusable(aFlags) && (tabIndex >= 0 || GetTabIndexAttrValue().isSome()); return false; -- cgit v1.2.3