Skip to content

Commit

Permalink
Bug 1543298 part 2: Add PBrowserBridge::SetEmbeddedDocAccessibleCOMPr…
Browse files Browse the repository at this point in the history
…oxy so the parent can send the child the COM proxy for the embedded document accessible. r=eeejay,nika

Differential Revision: https://phabricator.services.mozilla.com/D32279

--HG--
extra : moz-landing-system : lando
  • Loading branch information
jcsteh committed May 24, 2019
1 parent ca09924 commit 4e9fb4d
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
27 changes: 26 additions & 1 deletion dom/ipc/BrowserBridgeChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#if defined(ACCESSIBILITY) && defined(XP_WIN)
# include "mozilla/a11y/ProxyAccessible.h"
# include "mozilla/a11y/ProxyWrappers.h"
#endif
#include "mozilla/dom/BrowserBridgeChild.h"
#include "mozilla/dom/BrowsingContext.h"
#include "nsFocusManager.h"
Expand All @@ -24,7 +28,13 @@ BrowserBridgeChild::BrowserBridgeChild(nsFrameLoader* aFrameLoader,
mFrameLoader(aFrameLoader),
mBrowsingContext(aBrowsingContext) {}

BrowserBridgeChild::~BrowserBridgeChild() {}
BrowserBridgeChild::~BrowserBridgeChild() {
#if defined(ACCESSIBILITY) && defined(XP_WIN)
if (mEmbeddedDocAccessible) {
mEmbeddedDocAccessible->Shutdown();
}
#endif
}

void BrowserBridgeChild::NavigateByKey(bool aForward,
bool aForDocumentNavigation) {
Expand Down Expand Up @@ -113,6 +123,21 @@ mozilla::ipc::IPCResult BrowserBridgeChild::RecvMoveFocus(
return IPC_OK();
}

mozilla::ipc::IPCResult
BrowserBridgeChild::RecvSetEmbeddedDocAccessibleCOMProxy(
const a11y::IDispatchHolder& aCOMProxy) {
#if defined(ACCESSIBILITY) && defined(XP_WIN)
MOZ_ASSERT(!aCOMProxy.IsNull());
if (mEmbeddedDocAccessible) {
mEmbeddedDocAccessible->Shutdown();
}
RefPtr<IDispatch> comProxy(aCOMProxy.Get());
mEmbeddedDocAccessible =
new a11y::RemoteIframeDocProxyAccessibleWrap(comProxy);
#endif
return IPC_OK();
}

void BrowserBridgeChild::ActorDestroy(ActorDestroyReason aWhy) {
mIPCOpen = false;
}
Expand Down
17 changes: 17 additions & 0 deletions dom/ipc/BrowserBridgeChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
#include "mozilla/dom/BrowserChild.h"

namespace mozilla {

namespace a11y {
class RemoteIframeDocProxyAccessibleWrap;
}

namespace dom {
class BrowsingContext;
class ContentChild;
Expand Down Expand Up @@ -44,6 +49,12 @@ class BrowserBridgeChild : public PBrowserBridgeChild {

void SetIsUnderHiddenEmbedderElement(bool aIsUnderHiddenEmbedderElement);

#if defined(ACCESSIBILITY) && defined(XP_WIN)
a11y::RemoteIframeDocProxyAccessibleWrap* GetEmbeddedDocAccessible() {
return mEmbeddedDocAccessible;
}
#endif

static BrowserBridgeChild* GetFrom(nsFrameLoader* aFrameLoader);

static BrowserBridgeChild* GetFrom(nsIContent* aContent);
Expand All @@ -63,6 +74,9 @@ class BrowserBridgeChild : public PBrowserBridgeChild {
mozilla::ipc::IPCResult RecvMoveFocus(const bool& aForward,
const bool& aForDocumentNavigation);

mozilla::ipc::IPCResult RecvSetEmbeddedDocAccessibleCOMProxy(
const IDispatchHolder& aCOMProxy);

void ActorDestroy(ActorDestroyReason aWhy) override;

private:
Expand All @@ -72,6 +86,9 @@ class BrowserBridgeChild : public PBrowserBridgeChild {
bool mIPCOpen;
RefPtr<nsFrameLoader> mFrameLoader;
RefPtr<BrowsingContext> mBrowsingContext;
#if defined(ACCESSIBILITY) && defined(XP_WIN)
RefPtr<a11y::RemoteIframeDocProxyAccessibleWrap> mEmbeddedDocAccessible;
#endif
};

} // namespace dom
Expand Down
6 changes: 6 additions & 0 deletions dom/ipc/PBrowserBridge.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ using nsSizeMode from "nsIWidgetListener.h";
using mozilla::layers::LayersObserverEpoch from "mozilla/layers/LayersTypes.h";
using mozilla::layers::LayersId from "mozilla/layers/LayersTypes.h";
using mozilla::WidgetMouseEvent from "ipc/nsGUIEventIPC.h";
using mozilla::a11y::IDispatchHolder from "mozilla/a11y/IPCTypes.h";

namespace mozilla {
namespace dom {
Expand Down Expand Up @@ -44,6 +45,11 @@ child:
*/
async MoveFocus(bool forward, bool forDocumentNavigation);

/**
* Send the child the COM proxy for the embedded document accessible.
*/
async SetEmbeddedDocAccessibleCOMProxy(IDispatchHolder aCOMProxy);

parent:
// Destroy the remote web browser due to the nsFrameLoader going away.
async __delete__();
Expand Down

0 comments on commit 4e9fb4d

Please sign in to comment.