Backed out 2 changesets (bug 981248) for causing multiple failures.

CLOSED TREE

Backed out changeset 7a96708cc8b7 (bug 981248)
Backed out changeset 1eace7bd28d9 (bug 981248)
This commit is contained in:
Mihai Alexandru Michis
2020-01-14 19:28:17 +02:00
parent c7d67b115e
commit b51ee7e327
43 changed files with 1166 additions and 366 deletions

View File

@@ -37,6 +37,7 @@
#include "BrowserChild.h"
#include "nsFrameLoader.h"
#include "nsHTMLDocument.h"
#include "nsNumberControlFrame.h"
#include "nsNetUtil.h"
#include "nsRange.h"
@@ -315,6 +316,24 @@ Element* nsFocusManager::GetFocusedDescendant(
// static
Element* nsFocusManager::GetRedirectedFocus(nsIContent* aContent) {
// For input number, redirect focus to our anonymous text control.
if (aContent->IsHTMLElement(nsGkAtoms::input)) {
bool typeIsNumber =
static_cast<dom::HTMLInputElement*>(aContent)->ControlType() ==
NS_FORM_INPUT_NUMBER;
if (typeIsNumber) {
nsNumberControlFrame* numberControlFrame =
do_QueryFrame(aContent->GetPrimaryFrame());
if (numberControlFrame) {
HTMLInputElement* textControl =
numberControlFrame->GetAnonTextControl();
return textControl;
}
}
}
#ifdef MOZ_XUL
if (aContent->IsXULElement()) {
nsCOMPtr<nsIDOMXULMenuListElement> menulist =
@@ -1460,7 +1479,8 @@ Element* nsFocusManager::FlushAndCheckIfFocusable(Element* aElement,
// this is a special case for some XUL elements or input number, where an
// anonymous child is actually focusable and not the element itself.
if (RefPtr<Element> redirectedFocus = GetRedirectedFocus(aElement)) {
RefPtr<Element> redirectedFocus = GetRedirectedFocus(aElement);
if (redirectedFocus) {
return FlushAndCheckIfFocusable(redirectedFocus, aFlags);
}