Bug 1909577 - Make some nsFocusManager::GetFocusedElement() users use its static version instead r=emilio,credential-management-reviewers,issammani
Now, we have `nsFocusManager::GetFocusedElementStatic()` which returns focused element if the `nsFocusManager` instance is available. Therefore, if `nsFocusManager::GetFocusedElement()` users do not use other methods of `nsFocusManager`, they can use `nsFocusManager::GetFocusedElementStatic()` and make themselves simpler. Note that some callers return early if `nsFocusManager` is not available, but they do not return error and `nsFocusManager` instance is available in most time of the life time of the process. Therefore, we can simply stop using the early return. Differential Revision: https://phabricator.services.mozilla.com/D217527
This commit is contained in:
@@ -9208,11 +9208,7 @@ bool PresShell::EventHandler::AdjustContextMenuKeyEvent(
|
||||
// If we're here because of the key-equiv for showing context menus, we
|
||||
// have to reset the event target to the currently focused element. Get it
|
||||
// from the focus controller.
|
||||
RefPtr<Element> currentFocus;
|
||||
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (fm) {
|
||||
currentFocus = fm->GetFocusedElement();
|
||||
}
|
||||
RefPtr<Element> currentFocus = nsFocusManager::GetFocusedElementStatic();
|
||||
|
||||
// Reset event coordinates relative to focused frame in view
|
||||
if (currentFocus) {
|
||||
|
||||
Reference in New Issue
Block a user