diff options
Diffstat (limited to 'dom/html/HTMLImageElement.cpp')
-rw-r--r-- | dom/html/HTMLImageElement.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
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; |