Bug 1268544: Refactor PDocAccessible and its dependencies, and add code to integrate remote COM objects; r=tbsaunde

MozReview-Commit-ID: Fr4q3dq1ZQU

--HG--
rename : accessible/ipc/DocAccessibleChild.cpp => accessible/ipc/other/DocAccessibleChild.cpp
rename : accessible/ipc/DocAccessibleChild.h => accessible/ipc/other/DocAccessibleChild.h
rename : accessible/ipc/PDocAccessible.ipdl => accessible/ipc/other/PDocAccessible.ipdl
rename : accessible/ipc/moz.build => accessible/ipc/other/moz.build
rename : accessible/ipc/PDocAccessible.ipdl => accessible/ipc/win/PDocAccessible.ipdl
This commit is contained in:
Aaron Klotz 2016-08-15 14:24:04 -06:00
Родитель 3a71cec502
Коммит 55b28e20c7
20 изменённых файлов: 584 добавлений и 148 удалений

Просмотреть файл

@ -855,11 +855,11 @@ Accessible::HandleAccEvent(AccEvent* aEvent)
ipcDoc->SendEvent(id, aEvent->GetEventType()); ipcDoc->SendEvent(id, aEvent->GetEventType());
break; break;
case nsIAccessibleEvent::EVENT_STATE_CHANGE: { case nsIAccessibleEvent::EVENT_STATE_CHANGE: {
AccStateChangeEvent* event = downcast_accEvent(aEvent); AccStateChangeEvent* event = downcast_accEvent(aEvent);
ipcDoc->SendStateChangeEvent(id, event->GetState(), ipcDoc->SendStateChangeEvent(id, event->GetState(),
event->IsStateEnabled()); event->IsStateEnabled());
break; break;
} }
case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED: { case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED: {
AccCaretMoveEvent* event = downcast_accEvent(aEvent); AccCaretMoveEvent* event = downcast_accEvent(aEvent);
ipcDoc->SendCaretMoveEvent(id, event->GetCaretOffset()); ipcDoc->SendCaretMoveEvent(id, event->GetCaretOffset());
@ -874,7 +874,7 @@ Accessible::HandleAccEvent(AccEvent* aEvent)
event->IsTextInserted(), event->IsTextInserted(),
event->IsFromUserInput()); event->IsFromUserInput());
break; break;
} }
case nsIAccessibleEvent::EVENT_SELECTION: case nsIAccessibleEvent::EVENT_SELECTION:
case nsIAccessibleEvent::EVENT_SELECTION_ADD: case nsIAccessibleEvent::EVENT_SELECTION_ADD:
case nsIAccessibleEvent::EVENT_SELECTION_REMOVE: { case nsIAccessibleEvent::EVENT_SELECTION_REMOVE: {
@ -883,9 +883,9 @@ Accessible::HandleAccEvent(AccEvent* aEvent)
reinterpret_cast<uintptr_t>(selEvent->Widget()); reinterpret_cast<uintptr_t>(selEvent->Widget());
ipcDoc->SendSelectionEvent(id, widgetID, aEvent->GetEventType()); ipcDoc->SendSelectionEvent(id, widgetID, aEvent->GetEventType());
break; break;
} }
default: default:
ipcDoc->SendEvent(id, aEvent->GetEventType()); ipcDoc->SendEvent(id, aEvent->GetEventType());
} }
} }
} }

Просмотреть файл

@ -577,7 +577,7 @@ protected:
*/ */
void SetIPCDoc(DocAccessibleChild* aIPCDoc) { mIPCDoc = aIPCDoc; } void SetIPCDoc(DocAccessibleChild* aIPCDoc) { mIPCDoc = aIPCDoc; }
friend class DocAccessibleChild; friend class DocAccessibleChildBase;
/** /**
* Used to fire scrolling end event after page scroll. * Used to fire scrolling end event after page scroll.

Просмотреть файл

@ -28,7 +28,6 @@ UNIFIED_SOURCES += [
LOCAL_INCLUDES += [ LOCAL_INCLUDES += [
'/accessible/base', '/accessible/base',
'/accessible/html', '/accessible/html',
'/accessible/ipc',
'/accessible/xpcom', '/accessible/xpcom',
'/accessible/xul', '/accessible/xul',
'/dom/base', '/dom/base',
@ -36,6 +35,15 @@ LOCAL_INCLUDES += [
'/layout/xul', '/layout/xul',
] ]
if CONFIG['OS_ARCH'] == 'WINNT':
LOCAL_INCLUDES += [
'/accessible/ipc/win',
]
else:
LOCAL_INCLUDES += [
'/accessible/ipc/other',
]
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
LOCAL_INCLUDES += [ LOCAL_INCLUDES += [
'/accessible/atk', '/accessible/atk',

Просмотреть файл

@ -0,0 +1,98 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#include "mozilla/a11y/DocAccessibleChildBase.h"
#include "Accessible-inl.h"
namespace mozilla {
namespace a11y {
/* static */ uint32_t
DocAccessibleChildBase::InterfacesFor(Accessible* aAcc)
{
uint32_t interfaces = 0;
if (aAcc->IsHyperText() && aAcc->AsHyperText()->IsTextRole())
interfaces |= Interfaces::HYPERTEXT;
if (aAcc->IsLink())
interfaces |= Interfaces::HYPERLINK;
if (aAcc->HasNumericValue())
interfaces |= Interfaces::VALUE;
if (aAcc->IsImage())
interfaces |= Interfaces::IMAGE;
if (aAcc->IsTable()) {
interfaces |= Interfaces::TABLE;
}
if (aAcc->IsTableCell())
interfaces |= Interfaces::TABLECELL;
if (aAcc->IsDoc())
interfaces |= Interfaces::DOCUMENT;
if (aAcc->IsSelect()) {
interfaces |= Interfaces::SELECTION;
}
if (aAcc->ActionCount()) {
interfaces |= Interfaces::ACTION;
}
return interfaces;
}
/* static */ void
DocAccessibleChildBase::SerializeTree(Accessible* aRoot,
nsTArray<AccessibleData>& aTree)
{
uint64_t id = reinterpret_cast<uint64_t>(aRoot->UniqueID());
uint32_t role = aRoot->Role();
uint32_t childCount = aRoot->ChildCount();
uint32_t interfaces = InterfacesFor(aRoot);
#if defined(XP_WIN)
IAccessibleHolder holder(CreateHolderFromAccessible(aRoot));
#endif
// OuterDocAccessibles are special because we don't want to serialize the
// child doc here, we'll call PDocAccessibleConstructor in
// NotificationController.
MOZ_ASSERT(!aRoot->IsDoc(), "documents shouldn't be serialized");
if (aRoot->IsOuterDoc()) {
childCount = 0;
}
#if defined(XP_WIN)
aTree.AppendElement(AccessibleData(id, role, childCount, interfaces,
holder));
#else
aTree.AppendElement(AccessibleData(id, role, childCount, interfaces));
#endif
for (uint32_t i = 0; i < childCount; i++) {
SerializeTree(aRoot->GetChildAt(i), aTree);
}
}
void
DocAccessibleChildBase::ShowEvent(AccShowEvent* aShowEvent)
{
Accessible* parent = aShowEvent->Parent();
uint64_t parentID = parent->IsDoc() ? 0 : reinterpret_cast<uint64_t>(parent->UniqueID());
uint32_t idxInParent = aShowEvent->InsertionIndex();
nsTArray<AccessibleData> shownTree;
ShowEventData data(parentID, idxInParent, shownTree);
SerializeTree(aShowEvent->GetAccessible(), data.NewTree());
SendShowEvent(data, aShowEvent->IsFromUserInput());
}
} // namespace a11y
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,70 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#ifndef mozilla_a11y_DocAccessibleChildBase_h
#define mozilla_a11y_DocAccessibleChildBase_h
#include "mozilla/a11y/DocAccessible.h"
#include "mozilla/a11y/PDocAccessibleChild.h"
#include "nsISupportsImpl.h"
namespace mozilla {
namespace a11y {
class Accessible;
class AccShowEvent;
class DocAccessibleChildBase : public PDocAccessibleChild
{
public:
explicit DocAccessibleChildBase(DocAccessible* aDoc)
: mDoc(aDoc)
{
MOZ_COUNT_CTOR(DocAccessibleChildBase);
}
~DocAccessibleChildBase()
{
// Shutdown() should have been called, but maybe it isn't if the process is
// killed?
MOZ_ASSERT(!mDoc);
if (mDoc) {
mDoc->SetIPCDoc(nullptr);
}
MOZ_COUNT_DTOR(DocAccessibleChildBase);
}
void Shutdown()
{
mDoc->SetIPCDoc(nullptr);
mDoc = nullptr;
SendShutdown();
}
void ShowEvent(AccShowEvent* aShowEvent);
virtual void ActorDestroy(ActorDestroyReason) override
{
if (!mDoc) {
return;
}
mDoc->SetIPCDoc(nullptr);
mDoc = nullptr;
}
protected:
static uint32_t InterfacesFor(Accessible* aAcc);
static void SerializeTree(Accessible* aRoot, nsTArray<AccessibleData>& aTree);
DocAccessible* mDoc;
};
} // namespace a11y
} // namespace mozilla
#endif // mozilla_a11y_DocAccessibleChildBase_h

Просмотреть файл

@ -6,7 +6,6 @@
#include "DocAccessibleParent.h" #include "DocAccessibleParent.h"
#include "mozilla/a11y/Platform.h" #include "mozilla/a11y/Platform.h"
#include "ProxyAccessible.h"
#include "mozilla/dom/TabParent.h" #include "mozilla/dom/TabParent.h"
#include "xpcAccessibleDocument.h" #include "xpcAccessibleDocument.h"
#include "xpcAccEvents.h" #include "xpcAccEvents.h"
@ -103,9 +102,24 @@ DocAccessibleParent::AddSubtree(ProxyAccessible* aParent,
} }
auto role = static_cast<a11y::role>(newChild.Role()); auto role = static_cast<a11y::role>(newChild.Role());
#if defined(XP_WIN)
const IAccessibleHolder& proxyStream = newChild.COMProxy();
RefPtr<IAccessible> comPtr(proxyStream.Get());
if (!comPtr) {
NS_ERROR("Could not obtain remote IAccessible interface");
return 0;
}
ProxyAccessible* newProxy =
new ProxyAccessible(newChild.ID(), aParent, this, role,
newChild.Interfaces(), comPtr);
#else
ProxyAccessible* newProxy = ProxyAccessible* newProxy =
new ProxyAccessible(newChild.ID(), aParent, this, role, new ProxyAccessible(newChild.ID(), aParent, this, role,
newChild.Interfaces()); newChild.Interfaces());
#endif
aParent->AddChildAt(aIdxInParent, newProxy); aParent->AddChildAt(aIdxInParent, newProxy);
mAccessibles.PutEntry(newChild.ID())->mProxy = newProxy; mAccessibles.PutEntry(newChild.ID())->mProxy = newProxy;
ProxyCreated(newProxy, newChild.Interfaces()); ProxyCreated(newProxy, newChild.Interfaces());
@ -452,5 +466,32 @@ DocAccessibleParent::GetXPCAccessible(ProxyAccessible* aProxy)
return doc->GetXPCAccessible(aProxy); return doc->GetXPCAccessible(aProxy);
} }
#if defined(XP_WIN)
/**
* @param aCOMProxy COM Proxy to the document in the content process.
* @param aParentCOMProxy COM Proxy to the OuterDocAccessible that is
* the parent of the document. The content process will use this
* proxy when traversing up across the content/chrome boundary.
*/
bool
DocAccessibleParent::RecvCOMProxy(const IAccessibleHolder& aCOMProxy,
IAccessibleHolder* aParentCOMProxy)
{
RefPtr<IAccessible> ptr(aCOMProxy.Get());
SetCOMInterface(ptr);
Accessible* outerDoc = OuterDocOfRemoteBrowser();
MOZ_ASSERT(outerDoc);
IAccessible* rawNative = nullptr;
if (outerDoc) {
outerDoc->GetNativeInterface((void**) &rawNative);
}
aParentCOMProxy->Set(IAccessibleHolder::COMPtrType(rawNative));
return true;
}
#endif // defined(XP_WIN)
} // a11y } // a11y
} // mozilla } // mozilla

Просмотреть файл

@ -8,8 +8,8 @@
#define mozilla_a11y_DocAccessibleParent_h #define mozilla_a11y_DocAccessibleParent_h
#include "nsAccessibilityService.h" #include "nsAccessibilityService.h"
#include "ProxyAccessible.h"
#include "mozilla/a11y/PDocAccessibleParent.h" #include "mozilla/a11y/PDocAccessibleParent.h"
#include "mozilla/a11y/ProxyAccessible.h"
#include "nsClassHashtable.h" #include "nsClassHashtable.h"
#include "nsHashKeys.h" #include "nsHashKeys.h"
#include "nsISupportsImpl.h" #include "nsISupportsImpl.h"
@ -142,6 +142,11 @@ public:
const DocAccessibleParent* ChildDocAt(size_t aIdx) const const DocAccessibleParent* ChildDocAt(size_t aIdx) const
{ return mChildDocs[aIdx]; } { return mChildDocs[aIdx]; }
#if defined(XP_WIN)
virtual bool RecvCOMProxy(const IAccessibleHolder& aCOMProxy,
IAccessibleHolder* aParentCOMProxy) override;
#endif
private: private:
class ProxyEntry : public PLDHashEntryHdr class ProxyEntry : public PLDHashEntryHdr

Просмотреть файл

@ -4,38 +4,22 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this # 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/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
IPDL_SOURCES += ['PDocAccessible.ipdl'] if CONFIG['OS_ARCH'] == 'WINNT':
DIRS += ['win']
# with --disable-accessibility we need to compile PDocAccessible.ipdl, but not
# the C++.
if CONFIG['ACCESSIBILITY']:
EXPORTS.mozilla.a11y += [
'DocAccessibleChild.h',
'DocAccessibleParent.h',
'ProxyAccessible.h'
]
SOURCES += [
'DocAccessibleChild.cpp',
'DocAccessibleParent.cpp',
'ProxyAccessible.cpp'
]
LOCAL_INCLUDES += [ LOCAL_INCLUDES += [
'../base', '/accessible/ipc/win',
'../generic', '/accessible/windows/ia2',
'../xpcom', '/accessible/windows/msaa',
]
else:
DIRS += ['other']
LOCAL_INCLUDES += [
'/accessible/ipc/other',
] ]
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']: if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
LOCAL_INCLUDES += [ LOCAL_INCLUDES += [
'/accessible/atk', '/accessible/atk',
] ]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
LOCAL_INCLUDES += [
'/accessible/windows/ia2',
'/accessible/windows/msaa',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
LOCAL_INCLUDES += [ LOCAL_INCLUDES += [
'/accessible/mac', '/accessible/mac',
@ -45,9 +29,30 @@ if CONFIG['ACCESSIBILITY']:
'/accessible/other', '/accessible/other',
] ]
FINAL_LIBRARY = 'xul' if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wno-error=shadow']
# with --disable-accessibility we need to compile PDocAccessible.ipdl, but not
# the C++.
if CONFIG['ACCESSIBILITY']:
EXPORTS.mozilla.a11y += [
'DocAccessibleChildBase.h',
'DocAccessibleParent.h',
'ProxyAccessible.h'
]
UNIFIED_SOURCES += [
'DocAccessibleChildBase.cpp',
'DocAccessibleParent.cpp',
'ProxyAccessible.cpp'
]
LOCAL_INCLUDES += [
'/accessible/base',
'/accessible/generic',
'/accessible/xpcom',
]
include('/ipc/chromium/chromium-config.mozbuild') include('/ipc/chromium/chromium-config.mozbuild')
if CONFIG['GNU_CXX']: FINAL_LIBRARY = 'xul'
CXXFLAGS += ['-Wno-error=shadow']

Просмотреть файл

@ -24,63 +24,6 @@
namespace mozilla { namespace mozilla {
namespace a11y { namespace a11y {
static uint32_t
InterfacesFor(Accessible* aAcc)
{
uint32_t interfaces = 0;
if (aAcc->IsHyperText() && aAcc->AsHyperText()->IsTextRole())
interfaces |= Interfaces::HYPERTEXT;
if (aAcc->IsLink())
interfaces |= Interfaces::HYPERLINK;
if (aAcc->HasNumericValue())
interfaces |= Interfaces::VALUE;
if (aAcc->IsImage())
interfaces |= Interfaces::IMAGE;
if (aAcc->IsTable()) {
interfaces |= Interfaces::TABLE;
}
if (aAcc->IsTableCell())
interfaces |= Interfaces::TABLECELL;
if (aAcc->IsDoc())
interfaces |= Interfaces::DOCUMENT;
if (aAcc->IsSelect()) {
interfaces |= Interfaces::SELECTION;
}
if (aAcc->ActionCount()) {
interfaces |= Interfaces::ACTION;
}
return interfaces;
}
static void
SerializeTree(Accessible* aRoot, nsTArray<AccessibleData>& aTree)
{
uint64_t id = reinterpret_cast<uint64_t>(aRoot->UniqueID());
uint32_t role = aRoot->Role();
uint32_t childCount = aRoot->ChildCount();
uint32_t interfaces = InterfacesFor(aRoot);
// OuterDocAccessibles are special because we don't want to serialize the
// child doc here, we'll call PDocAccessibleConstructor in
// NotificationController.
MOZ_ASSERT(!aRoot->IsDoc(), "documents shouldn't be serialized");
if (aRoot->IsOuterDoc())
childCount = 0;
aTree.AppendElement(AccessibleData(id, role, childCount, interfaces));
for (uint32_t i = 0; i < childCount; i++)
SerializeTree(aRoot->GetChildAt(i), aTree);
}
Accessible* Accessible*
DocAccessibleChild::IdToAccessible(const uint64_t& aID) const DocAccessibleChild::IdToAccessible(const uint64_t& aID) const
{ {
@ -142,18 +85,6 @@ DocAccessibleChild::IdToTableAccessible(const uint64_t& aID) const
return (acc && acc->IsTable()) ? acc->AsTable() : nullptr; return (acc && acc->IsTable()) ? acc->AsTable() : nullptr;
} }
void
DocAccessibleChild::ShowEvent(AccShowEvent* aShowEvent)
{
Accessible* parent = aShowEvent->Parent();
uint64_t parentID = parent->IsDoc() ? 0 : reinterpret_cast<uint64_t>(parent->UniqueID());
uint32_t idxInParent = aShowEvent->InsertionIndex();
nsTArray<AccessibleData> shownTree;
ShowEventData data(parentID, idxInParent, shownTree);
SerializeTree(aShowEvent->GetAccessible(), data.NewTree());
SendShowEvent(data, aShowEvent->IsFromUserInput());
}
bool bool
DocAccessibleChild::RecvState(const uint64_t& aID, uint64_t* aState) DocAccessibleChild::RecvState(const uint64_t& aID, uint64_t* aState)
{ {

Просмотреть файл

@ -7,58 +7,36 @@
#ifndef mozilla_a11y_DocAccessibleChild_h #ifndef mozilla_a11y_DocAccessibleChild_h
#define mozilla_a11y_DocAccessibleChild_h #define mozilla_a11y_DocAccessibleChild_h
#include "mozilla/a11y/DocAccessible.h" #include "mozilla/a11y/DocAccessibleChildBase.h"
#include "mozilla/a11y/PDocAccessibleChild.h"
#include "nsISupportsImpl.h"
namespace mozilla { namespace mozilla {
namespace a11y { namespace a11y {
class Accessible; class Accessible;
class HyperTextAccessible; class HyperTextAccessible;
class TextLeafAccessible; class TextLeafAccessible;
class ImageAccessible; class ImageAccessible;
class TableAccessible; class TableAccessible;
class TableCellAccessible; class TableCellAccessible;
class AccShowEvent;
/* /*
* These objects handle content side communication for an accessible document, * These objects handle content side communication for an accessible document,
* and their lifetime is the same as the document they represent. * and their lifetime is the same as the document they represent.
*/ */
class DocAccessibleChild : public PDocAccessibleChild class DocAccessibleChild : public DocAccessibleChildBase
{ {
public: public:
explicit DocAccessibleChild(DocAccessible* aDoc) : explicit DocAccessibleChild(DocAccessible* aDoc)
mDoc(aDoc) : DocAccessibleChildBase(aDoc)
{ MOZ_COUNT_CTOR(DocAccessibleChild); } {
MOZ_COUNT_CTOR_INHERITED(DocAccessibleChild, DocAccessibleChildBase);
}
~DocAccessibleChild() ~DocAccessibleChild()
{ {
// Shutdown() should have been called, but maybe it isn't if the process is MOZ_COUNT_DTOR_INHERITED(DocAccessibleChild, DocAccessibleChildBase);
// killed?
MOZ_ASSERT(!mDoc);
if (mDoc)
mDoc->SetIPCDoc(nullptr);
MOZ_COUNT_DTOR(DocAccessibleChild);
} }
void Shutdown()
{
mDoc->SetIPCDoc(nullptr);
mDoc = nullptr;
SendShutdown();
}
virtual void ActorDestroy(ActorDestroyReason) override
{
if (!mDoc)
return;
mDoc->SetIPCDoc(nullptr);
mDoc = nullptr;
}
void ShowEvent(AccShowEvent* aShowEvent);
/* /*
* Return the state for the accessible with given ID. * Return the state for the accessible with given ID.
*/ */
@ -496,8 +474,6 @@ private:
bool PersistentPropertiesToArray(nsIPersistentProperties* aProps, bool PersistentPropertiesToArray(nsIPersistentProperties* aProps,
nsTArray<Attribute>* aAttributes); nsTArray<Attribute>* aAttributes);
DocAccessible* mDoc;
}; };
} }

Просмотреть файл

@ -0,0 +1,44 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.
IPDL_SOURCES += ['PDocAccessible.ipdl']
# with --disable-accessibility we need to compile PDocAccessible.ipdl, but not
# the C++.
if CONFIG['ACCESSIBILITY']:
EXPORTS.mozilla.a11y += [
'DocAccessibleChild.h',
'ProxyAccessible.h'
]
SOURCES += [
'DocAccessibleChild.cpp',
'ProxyAccessible.cpp'
]
LOCAL_INCLUDES += [
'../../base',
'../../generic',
'../../xpcom',
]
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
LOCAL_INCLUDES += [
'/accessible/atk',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
LOCAL_INCLUDES += [
'/accessible/mac',
]
else:
LOCAL_INCLUDES += [
'/accessible/other',
]
include('/ipc/chromium/chromium-config.mozbuild')
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wno-error=shadow']

Просмотреть файл

@ -0,0 +1,50 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#include "mozilla/a11y/COMPtrTypes.h"
#include "MainThreadUtils.h"
#include "mozilla/a11y/Accessible.h"
#include "mozilla/Move.h"
#include "mozilla/mscom/MainThreadHandoff.h"
#include "mozilla/RefPtr.h"
using mozilla::mscom::MainThreadHandoff;
using mozilla::mscom::STAUniquePtr;
namespace mozilla {
namespace a11y {
IAccessibleHolder
CreateHolderFromAccessible(Accessible* aAccToWrap)
{
MOZ_ASSERT(aAccToWrap && NS_IsMainThread());
if (!aAccToWrap) {
return nullptr;
}
IAccessible* rawNative = nullptr;
aAccToWrap->GetNativeInterface((void**)&rawNative);
MOZ_ASSERT(rawNative);
if (!rawNative) {
return nullptr;
}
STAUniquePtr<IAccessible> iaToProxy(rawNative);
IAccessible* rawIntercepted = nullptr;
HRESULT hr = MainThreadHandoff::WrapInterface(iaToProxy, &rawIntercepted);
MOZ_ASSERT(SUCCEEDED(hr));
if (FAILED(hr)) {
return nullptr;
}
IAccessibleHolder::COMPtrType iaIntercepted(rawIntercepted);
return IAccessibleHolder(Move(iaIntercepted));
}
} // namespace a11y
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,27 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#ifndef mozilla_a11y_COMPtrTypes_h
#define mozilla_a11y_COMPtrTypes_h
#include "mozilla/mscom/COMPtrHolder.h"
#include <oleacc.h>
namespace mozilla {
namespace a11y {
typedef mozilla::mscom::COMPtrHolder<IAccessible, IID_IAccessible> IAccessibleHolder;
class Accessible;
IAccessibleHolder
CreateHolderFromAccessible(Accessible* aAccToWrap);
} // namespace a11y
} // namespace mozilla
#endif // mozilla_a11y_COMPtrTypes_h

Просмотреть файл

@ -0,0 +1,36 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#include "DocAccessibleChild.h"
#include "Accessible-inl.h"
namespace mozilla {
namespace a11y {
DocAccessibleChild::DocAccessibleChild(DocAccessible* aDoc)
: DocAccessibleChildBase(aDoc)
{
MOZ_COUNT_CTOR_INHERITED(DocAccessibleChild, DocAccessibleChildBase);
}
DocAccessibleChild::~DocAccessibleChild()
{
MOZ_COUNT_DTOR_INHERITED(DocAccessibleChild, DocAccessibleChildBase);
}
void
DocAccessibleChild::SendCOMProxy(const IAccessibleHolder& aProxy)
{
IAccessibleHolder parentProxy;
PDocAccessibleChild::SendCOMProxy(aProxy, &parentProxy);
mParentProxy.reset(parentProxy.Release());
MOZ_ASSERT(mParentProxy);
}
} // namespace a11y
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,37 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
#ifndef mozilla_a11y_DocAccessibleChild_h
#define mozilla_a11y_DocAccessibleChild_h
#include "mozilla/a11y/COMPtrTypes.h"
#include "mozilla/a11y/DocAccessibleChildBase.h"
#include "mozilla/mscom/Ptr.h"
namespace mozilla {
namespace a11y {
/*
* These objects handle content side communication for an accessible document,
* and their lifetime is the same as the document they represent.
*/
class DocAccessibleChild : public DocAccessibleChildBase
{
public:
explicit DocAccessibleChild(DocAccessible* aDoc);
~DocAccessibleChild();
void SendCOMProxy(const IAccessibleHolder& aProxy);
IAccessible* GetParentIAccessible() const { return mParentProxy.get(); }
private:
mscom::ProxyUniquePtr<IAccessible> mParentProxy;
};
} // namespace a11y
} // namespace mozilla
#endif // mozilla_a11y_DocAccessibleChild_h

Просмотреть файл

@ -0,0 +1,73 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
include protocol PBrowser;
using mozilla::a11y::IAccessibleHolder from "mozilla/a11y/COMPtrTypes.h";
namespace mozilla {
namespace a11y {
struct AccessibleData
{
uint64_t ID;
uint32_t Role;
uint32_t ChildrenCount;
uint32_t Interfaces;
IAccessibleHolder COMProxy;
};
struct ShowEventData
{
uint64_t ID;
uint32_t Idx;
AccessibleData[] NewTree;
};
struct Attribute
{
nsCString Name;
nsString Value;
};
sync protocol PDocAccessible
{
manager PBrowser;
parent:
async Shutdown();
/*
* Notify the parent process the document in the child process is firing an
* event.
*/
async Event(uint64_t aID, uint32_t type);
async ShowEvent(ShowEventData data, bool aFromuser);
async HideEvent(uint64_t aRootID, bool aFromUser);
async StateChangeEvent(uint64_t aID, uint64_t aState, bool aEnabled);
async CaretMoveEvent(uint64_t aID, int32_t aOffset);
async TextChangeEvent(uint64_t aID, nsString aStr, int32_t aStart, uint32_t aLen,
bool aIsInsert, bool aFromUser);
async SelectionEvent(uint64_t aID, uint64_t aWidgetID, uint32_t aType);
async RoleChangedEvent(uint32_t aRole);
/*
* Tell the parent document to bind the existing document as a new child
* document.
*/
async BindChildDoc(PDocAccessible aChildDoc, uint64_t aID);
// For now we'll add the command to send the proxy here. This might move to
// PDocAccessible constructor in PBrowser.
sync COMProxy(IAccessibleHolder aDocCOMProxy)
returns(IAccessibleHolder aParentCOMProxy);
child:
async __delete__();
};
}
}

Просмотреть файл

@ -0,0 +1,32 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# 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/.
IPDL_SOURCES += ['PDocAccessible.ipdl']
# with --disable-accessibility we need to compile PDocAccessible.ipdl, but not
# the C++.
if CONFIG['ACCESSIBILITY']:
EXPORTS.mozilla.a11y += [
'COMPtrTypes.h',
'DocAccessibleChild.h',
]
SOURCES += [
'COMPtrTypes.cpp',
'DocAccessibleChild.cpp',
]
LOCAL_INCLUDES += [
'/accessible/base',
'/accessible/generic',
'/accessible/windows/ia2',
'/accessible/windows/msaa',
'/accessible/xpcom',
]
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'

Просмотреть файл

@ -32,6 +32,7 @@ LOCAL_INCLUDES += [
'/accessible/generic', '/accessible/generic',
'/accessible/html', '/accessible/html',
'/accessible/ipc', '/accessible/ipc',
'/accessible/ipc/other',
'/accessible/xul', '/accessible/xul',
'/layout/generic', '/layout/generic',
'/layout/xul', '/layout/xul',

Просмотреть файл

@ -49,6 +49,8 @@ LOCAL_INCLUDES += [
'/accessible/base', '/accessible/base',
'/accessible/generic', '/accessible/generic',
'/accessible/html', '/accessible/html',
'/accessible/ipc',
'/accessible/ipc/win',
'/accessible/windows', '/accessible/windows',
'/accessible/windows/ia2', '/accessible/windows/ia2',
'/accessible/windows/sdn', '/accessible/windows/sdn',