Bug 847763, add a way to prevent an iframe to take focus, (pref'ed off by default), r=jst

This commit is contained in:
Olli Pettay
2013-11-20 00:21:16 +02:00
parent 2e3f9c25c5
commit 07b52ed713
19 changed files with 272 additions and 24 deletions

View File

@@ -838,6 +838,33 @@ nsIContent::AttrValueIs(int32_t aNameSpaceID,
AsElement()->AttrValueIs(aNameSpaceID, aName, aValue, aCaseSensitive);
}
bool
nsIContent::IsFocusable(int32_t* aTabIndex, bool aWithMouse)
{
bool focusable = IsFocusableInternal(aTabIndex, aWithMouse);
// Ensure that the return value and aTabIndex are consistent in the case
// we're in userfocusignored context.
if (focusable || (aTabIndex && *aTabIndex != -1)) {
if (nsContentUtils::IsUserFocusIgnored(this)) {
if (aTabIndex) {
*aTabIndex = -1;
}
return false;
}
return focusable;
}
return false;
}
bool
nsIContent::IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse)
{
if (aTabIndex) {
*aTabIndex = -1; // Default, not tabbable
}
return false;
}
const nsAttrValue*
FragmentOrElement::DoGetClasses() const
{