void HTMLObjectElement::HandleFocusBlurPlugin(Element* aElement, WidgetEvent* aEvent) { if (!aEvent->mFlags.mIsTrusted) { return; } switch (aEvent->message) { case NS_FOCUS_CONTENT: { OnFocusBlurPlugin(aElement, true); break; } case NS_BLUR_CONTENT: { OnFocusBlurPlugin(aElement, false); break; } } }
void HTMLObjectElement::HandleFocusBlurPlugin(Element* aElement, WidgetEvent* aEvent) { if (!aEvent->mFlags.mIsTrusted) { return; } switch (aEvent->mMessage) { case eFocus: { OnFocusBlurPlugin(aElement, true); break; } case eBlur: { OnFocusBlurPlugin(aElement, false); break; } default: break; } }
void HTMLObjectElement::UnbindFromTree(bool aDeep, bool aNullParent) { #ifdef XP_MACOSX // When a page is reloaded (when an nsIDocument's content is removed), the // focused element isn't necessarily sent an eBlur event. See // nsFocusManager::ContentRemoved(). This means that a widget may think it // still contains a focused plugin when it doesn't -- which in turn can // disable text input in the browser window. See bug 1137229. OnFocusBlurPlugin(this, false); #endif nsObjectLoadingContent::UnbindFromTree(aDeep, aNullParent); nsGenericHTMLFormElement::UnbindFromTree(aDeep, aNullParent); }
void HTMLObjectElement::HandlePluginInstantiated(Element* aElement) { // If aElement is already focused when a plugin is instantiated, we need // to initiate a call to nsIWidget::SetPluginFocused(true). Otherwise // keyboard input won't work in a click-to-play plugin until aElement // loses focus and regains it. nsIContent* focusedContent = nullptr; nsFocusManager *fm = nsFocusManager::GetFocusManager(); if (fm) { focusedContent = fm->GetFocusedContent(); } if (SameCOMIdentity(focusedContent, aElement)) { OnFocusBlurPlugin(aElement, true); } }
void HTMLObjectElement::HandlePluginCrashed(Element* aElement) { OnFocusBlurPlugin(aElement, false); }