Commit 45fa3d20 authored by Aaron Klotz's avatar Aaron Klotz
Browse files

Bug 1390652: Part 1 - Send parent COM proxies to content as IDispatch instead...

Bug 1390652: Part 1 - Send parent COM proxies to content as IDispatch instead of IAccessible to match the outparam type of IAccessible::get_accParent; r=yzen

MozReview-Commit-ID: 1CplfZrIt6l

--HG--
extra : rebase_source : 7fa2485a402ae647468eb090c04ec1752990e392
parent 0d4c9329
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -624,7 +624,7 @@ DocAccessibleParent::MaybeInitWindowEmulation()
  }

  nsWinUtils::NativeWindowCreateProc onCreate([this](HWND aHwnd) -> void {
    IAccessibleHolder hWndAccHolder;
    IDispatchHolder hWndAccHolder;

    ::SetPropW(aHwnd, kPropNameDocAccParent, reinterpret_cast<HANDLE>(this));

@@ -634,7 +634,7 @@ DocAccessibleParent::MaybeInitWindowEmulation()
    if (SUCCEEDED(::AccessibleObjectFromWindow(aHwnd, OBJID_WINDOW,
                                               IID_IAccessible,
                                               (void**)&rawHWNDAcc))) {
      hWndAccHolder.Set(IAccessibleHolder::COMPtrType(rawHWNDAcc));
      hWndAccHolder.Set(IDispatchHolder::COMPtrType(rawHWNDAcc));
    }

    Unused << SendEmulatedWindow(reinterpret_cast<uintptr_t>(mEmulatedWindowHandle),
@@ -672,8 +672,8 @@ DocAccessibleParent::SendParentCOMProxy()
  outerDoc->GetNativeInterface((void**) &rawNative);
  MOZ_ASSERT(rawNative);

  IAccessibleHolder::COMPtrType ptr(rawNative);
  IAccessibleHolder holder(Move(ptr));
  IDispatchHolder::COMPtrType ptr(rawNative);
  IDispatchHolder holder(Move(ptr));
  if (!PDocAccessibleParent::SendParentCOMProxy(holder)) {
    return;
  }
+1 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ namespace mozilla {
namespace a11y {

typedef uint32_t IAccessibleHolder;
typedef uint32_t IDispatchHolder;
typedef uint32_t IHandlerControlHolder;

} // namespace a11y
+1 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@ namespace mozilla {
namespace a11y {

typedef mozilla::mscom::COMPtrHolder<IAccessible, IID_IAccessible> IAccessibleHolder;
typedef mozilla::mscom::COMPtrHolder<IDispatch, IID_IDispatch> IDispatchHolder;

class Accessible;

+4 −4
Original line number Diff line number Diff line
@@ -49,10 +49,10 @@ DocAccessibleChild::Shutdown()
}

ipc::IPCResult
DocAccessibleChild::RecvParentCOMProxy(const IAccessibleHolder& aParentCOMProxy)
DocAccessibleChild::RecvParentCOMProxy(const IDispatchHolder& aParentCOMProxy)
{
  MOZ_ASSERT(!mParentProxy && !aParentCOMProxy.IsNull());
  mParentProxy.reset(const_cast<IAccessibleHolder&>(aParentCOMProxy).Release());
  mParentProxy.reset(const_cast<IDispatchHolder&>(aParentCOMProxy).Release());
  SetConstructedInParentProcess();

  for (uint32_t i = 0, l = mDeferredEvents.Length(); i < l; ++i) {
@@ -66,13 +66,13 @@ DocAccessibleChild::RecvParentCOMProxy(const IAccessibleHolder& aParentCOMProxy)

ipc::IPCResult
DocAccessibleChild::RecvEmulatedWindow(const WindowsHandle& aEmulatedWindowHandle,
                                       const IAccessibleHolder& aEmulatedWindowCOMProxy)
                                       const IDispatchHolder& aEmulatedWindowCOMProxy)
{
  mEmulatedWindowHandle = reinterpret_cast<HWND>(aEmulatedWindowHandle);
  if (!aEmulatedWindowCOMProxy.IsNull()) {
    MOZ_ASSERT(!mEmulatedWindowProxy);
    mEmulatedWindowProxy.reset(
      const_cast<IAccessibleHolder&>(aEmulatedWindowCOMProxy).Release());
      const_cast<IDispatchHolder&>(aEmulatedWindowCOMProxy).Release());
  }

  return IPC_OK();
+6 −6
Original line number Diff line number Diff line
@@ -28,17 +28,17 @@ public:
  virtual void Shutdown() override;

  virtual ipc::IPCResult
    RecvParentCOMProxy(const IAccessibleHolder& aParentCOMProxy) override;
    RecvParentCOMProxy(const IDispatchHolder& aParentCOMProxy) override;
  virtual ipc::IPCResult
    RecvEmulatedWindow(const WindowsHandle& aEmulatedWindowHandle,
                       const IAccessibleHolder& aEmulatedWindowCOMProxy) override;
                       const IDispatchHolder& aEmulatedWindowCOMProxy) override;
  virtual ipc::IPCResult
    RecvRestoreFocus() override;

  HWND GetNativeWindowHandle() const;
  IAccessible* GetEmulatedWindowIAccessible() const { return mEmulatedWindowProxy.get(); }
  IDispatch* GetEmulatedWindowIAccessible() const { return mEmulatedWindowProxy.get(); }

  IAccessible* GetParentIAccessible() const { return mParentProxy.get(); }
  IDispatch* GetParentIAccessible() const { return mParentProxy.get(); }

  bool SendEvent(const uint64_t& aID, const uint32_t& type);
  bool SendHideEvent(const uint64_t& aRootID, const bool& aFromUser);
@@ -344,8 +344,8 @@ private:
  };

  bool mIsRemoteConstructed;
  mscom::ProxyUniquePtr<IAccessible> mParentProxy;
  mscom::ProxyUniquePtr<IAccessible> mEmulatedWindowProxy;
  mscom::ProxyUniquePtr<IDispatch> mParentProxy;
  mscom::ProxyUniquePtr<IDispatch> mEmulatedWindowProxy;
  nsTArray<UniquePtr<DeferredEvent>> mDeferredEvents;
  HWND mEmulatedWindowHandle;
};
Loading