Bug 1110888 - Always do plugin IME in main process, even with e10s. r=masayuki,smaug

This commit is contained in:
Steven Michaud
2015-02-20 10:37:02 -06:00
parent 4706881d21
commit 39604719c4
19 changed files with 377 additions and 92 deletions

View File

@@ -20,6 +20,10 @@
#include "nsNPAPIPluginInstance.h"
#include "nsIWidget.h"
#include "nsContentUtils.h"
#ifdef XP_MACOSX
#include "mozilla/EventDispatcher.h"
#include "mozilla/dom/Event.h"
#endif
namespace mozilla {
namespace dom {
@@ -104,6 +108,55 @@ NS_IMPL_ELEMENT_CLONE(HTMLObjectElement)
// nsIConstraintValidation
NS_IMPL_NSICONSTRAINTVALIDATION(HTMLObjectElement)
#ifdef XP_MACOSX
static nsIWidget* GetWidget(Element* aElement)
{
nsIWidget* retval = NULL;
nsIFrame* frame = aElement->GetPrimaryFrame();
if (frame) {
retval = frame->GetNearestWidget();
}
return retval;
}
static void OnFocusBlurPlugin(Element* aElement, bool aFocus)
{
nsIWidget* widget = GetWidget(aElement);
if (widget) {
bool value = aFocus;
widget->SetPluginFocused(value);
}
}
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;
}
}
}
NS_IMETHODIMP
HTMLObjectElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
{
HandleFocusBlurPlugin(this, aVisitor.mEvent);
return NS_OK;
}
#endif // #ifdef XP_MACOSX
NS_IMETHODIMP
HTMLObjectElement::GetForm(nsIDOMHTMLFormElement **aForm)
{