Bug 1543161 - Simplify some rules used for file inputs. r=mats

There's only one button in a file input. This used to be an
input[type="button"].

There's no point in using more specific rules or such, the regular UA rules just
work, and content can't style this button so it can't be overriden.

This should be an idempotent patch.

Differential Revision: https://phabricator.services.mozilla.com/D26753
This commit is contained in:
Emilio Cobos Álvarez
2019-04-09 18:05:18 +02:00
parent 5929ae7268
commit 753b796e77
4 changed files with 10 additions and 19 deletions

View File

@@ -2978,13 +2978,10 @@ void HTMLInputElement::Focus(ErrorResult& aError) {
if (frame) {
for (nsIFrame* childFrame : frame->PrincipalChildList()) {
// See if the child is a button control.
nsCOMPtr<nsIFormControl> formCtrl =
do_QueryInterface(childFrame->GetContent());
if (formCtrl && formCtrl->ControlType() == NS_FORM_BUTTON_BUTTON) {
nsCOMPtr<Element> element = do_QueryInterface(formCtrl);
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm && element) {
fm->SetFocus(element, 0);
if (childFrame->GetContent() &&
childFrame->GetContent()->IsHTMLElement(nsGkAtoms::button)) {
if (nsIFocusManager* fm = nsFocusManager::GetFocusManager()) {
fm->SetFocus(childFrame->GetContent()->AsElement(), 0);
}
break;
}
@@ -3651,8 +3648,7 @@ bool HTMLInputElement::ShouldPreventDOMActivateDispatch(
return target->GetParent() == this &&
target->IsRootOfNativeAnonymousSubtree() &&
target->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
nsGkAtoms::button, eCaseMatters);
target->IsHTMLElement(nsGkAtoms::button);
}
nsresult HTMLInputElement::MaybeInitPickers(EventChainPostVisitor& aVisitor) {