Bug 1817723 - Allow HTMLEditor can receive events when the focus is switched between elements in the same shadow tree. r=masayuki
The EditorEventListener for HTMLEditor is registered on document, which is problematic because it can't receive events when the focus is switched between elements in the same shadow tree due to shadow dom encapsulation. We fix this by moving the EditorEventListener to nsWindowRoot so the events can always be received. Differential Revision: https://phabricator.services.mozilla.com/D178215
This commit is contained in:
@@ -924,6 +924,10 @@ nsDocShellTreeOwner::HandleEvent(Event* aEvent) {
|
||||
handler->CanDropLink(dragEvent, false, &canDropLink);
|
||||
if (canDropLink) {
|
||||
aEvent->PreventDefault();
|
||||
WidgetDragEvent* asWidgetDropEvent =
|
||||
dragEvent->WidgetEventPtr()->AsDragEvent();
|
||||
asWidgetDropEvent->UpdateDefaultPreventedOnContent(
|
||||
asWidgetDropEvent->mCurrentTarget);
|
||||
}
|
||||
} else if (eventType.EqualsLiteral("drop")) {
|
||||
nsIWebNavigation* webnav = static_cast<nsIWebNavigation*>(mWebBrowser);
|
||||
@@ -974,6 +978,10 @@ nsDocShellTreeOwner::HandleEvent(Event* aEvent) {
|
||||
} else {
|
||||
aEvent->StopPropagation();
|
||||
aEvent->PreventDefault();
|
||||
WidgetDragEvent* asWidgetDropEvent =
|
||||
dragEvent->WidgetEventPtr()->AsDragEvent();
|
||||
asWidgetDropEvent->UpdateDefaultPreventedOnContent(
|
||||
asWidgetDropEvent->mCurrentTarget);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user