refactor(dom/html/nsGenericHTMLElement): Use Blur() when the element is disabled
draft
refactor(dom/html/nsGenericHTMLElement): Use Blur() when the element is disabled
MozReview-Commit-ID: BDnhZIh2sgc
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -2429,21 +2429,18 @@ void nsGenericHTMLFormElement::UpdateDis
disabledStates |= NS_EVENT_STATE_ENABLED;
}
EventStates oldDisabledStates = State() & DISABLED_STATES;
EventStates changedStates = disabledStates ^ oldDisabledStates;
if (!changedStates.IsEmpty()) {
if (aNotify) {
- nsFocusManager *fm = nsFocusManager::GetFocusManager();
-
- if (fm && fm->IsFocused(this)) {
- fm->ClearFocus(OwnerDoc()->GetWindow());
- }
+ mozilla::ErrorResult errResult;
+ this->Blur(errResult);
}
ToggleStates(changedStates, aNotify);
}
}
void
nsGenericHTMLFormElement::UpdateRequiredState(bool aIsRequired, bool aNotify)