refactor(dom/html/nsGenericHTMLElement): Use Blur() when the element is disabled draft
authorSorin Davidoi <sorin.davidoi@gmail.com>
Sat, 10 Feb 2018 15:43:55 +0100
changeset 753529 22feead78ebbc2c563cbfc5e3af252f47c872231
parent 753528 bf1c5bb5293086190131c5c72b00d110e2670201
push id98580
push userbmo:sorin.davidoi@gmail.com
push dateSat, 10 Feb 2018 14:49:15 +0000
milestone60.0a1
refactor(dom/html/nsGenericHTMLElement): Use Blur() when the element is disabled MozReview-Commit-ID: BDnhZIh2sgc
dom/html/nsGenericHTMLElement.cpp
--- 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)