Backed out 6 changesets (bug 1288841, bug 1268544) for causing Win7 e10s Marionette to fail in test_import_script.py TestImportScriptContent.test_imports_apply_globally

Backed out changeset c9f49a119255 (bug 1288841)
Backed out changeset a9d43e83e070 (bug 1268544)
Backed out changeset d898178a0809 (bug 1268544)
Backed out changeset 4887b4164dd9 (bug 1268544)
Backed out changeset 7c3a5a770cae (bug 1268544)
Backed out changeset 12aa15cf5879 (bug 1268544)

--HG--
rename : accessible/ipc/other/DocAccessibleChild.cpp => accessible/ipc/DocAccessibleChild.cpp
rename : accessible/ipc/other/DocAccessibleChild.h => accessible/ipc/DocAccessibleChild.h
rename : accessible/ipc/win/PDocAccessible.ipdl => accessible/ipc/PDocAccessible.ipdl
rename : accessible/ipc/win/ProxyAccessible.cpp => accessible/ipc/ProxyAccessible.cpp
rename : accessible/ipc/win/ProxyAccessible.h => accessible/ipc/ProxyAccessible.h
This commit is contained in:
Phil Ringnalda 2016-08-18 00:30:21 -07:00
Родитель 27624bd372
Коммит 0d69896d44
53 изменённых файлов: 880 добавлений и 1926 удалений

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

@ -36,7 +36,6 @@ LOCAL_INCLUDES += [
'/accessible/generic',
'/accessible/html',
'/accessible/ipc',
'/accessible/ipc/other',
'/accessible/xpcom',
'/accessible/xul',
'/other-licenses/atk-1.0',

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

@ -515,11 +515,6 @@ DocManager::CreateDocOrRootAccessible(nsIDocument* aDocument)
docAcc->SetIPCDoc(ipcDoc);
static_cast<TabChild*>(tabChild.get())->
SendPDocAccessibleConstructor(ipcDoc, nullptr, 0);
#if defined(XP_WIN)
IAccessibleHolder holder(CreateHolderFromAccessible(docAcc));
ipcDoc->SendCOMProxy(holder);
#endif
}
}
}

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

@ -420,10 +420,6 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)
if (tabChild) {
static_cast<TabChild*>(tabChild.get())->
SendPDocAccessibleConstructor(ipcDoc, parentIPCDoc, id);
#if defined(XP_WIN)
IAccessibleHolder holder(CreateHolderFromAccessible(childDoc));
ipcDoc->SendCOMProxy(holder);
#endif
}
}
}

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

@ -4,9 +4,6 @@
* 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_Platform_h
#define mozilla_a11y_Platform_h
#include <stdint.h>
class nsString;
@ -85,4 +82,3 @@ void ProxySelectionEvent(ProxyAccessible* aTarget, ProxyAccessible* aWidget,
} // namespace a11y
} // namespace mozilla
#endif // mozilla_a11y_Platform_h

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

@ -63,18 +63,6 @@ LOCAL_INCLUDES += [
'/accessible/generic',
'/accessible/html',
'/accessible/ipc',
]
if CONFIG['OS_ARCH'] == 'WINNT':
LOCAL_INCLUDES += [
'/accessible/ipc/win',
]
else:
LOCAL_INCLUDES += [
'/accessible/ipc/other',
]
LOCAL_INCLUDES += [
'/accessible/xpcom',
'/accessible/xul',
'/dom/base',

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

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

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

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

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

@ -28,6 +28,7 @@ UNIFIED_SOURCES += [
LOCAL_INCLUDES += [
'/accessible/base',
'/accessible/html',
'/accessible/ipc',
'/accessible/xpcom',
'/accessible/xul',
'/dom/base',
@ -35,15 +36,6 @@ LOCAL_INCLUDES += [
'/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']:
LOCAL_INCLUDES += [
'/accessible/atk',

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

@ -24,6 +24,63 @@
namespace mozilla {
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*
DocAccessibleChild::IdToAccessible(const uint64_t& aID) const
{
@ -85,6 +142,18 @@ DocAccessibleChild::IdToTableAccessible(const uint64_t& aID) const
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
DocAccessibleChild::RecvState(const uint64_t& aID, uint64_t* aState)
{

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

@ -7,36 +7,58 @@
#ifndef mozilla_a11y_DocAccessibleChild_h
#define mozilla_a11y_DocAccessibleChild_h
#include "mozilla/a11y/DocAccessibleChildBase.h"
#include "mozilla/a11y/DocAccessible.h"
#include "mozilla/a11y/PDocAccessibleChild.h"
#include "nsISupportsImpl.h"
namespace mozilla {
namespace a11y {
class Accessible;
class HyperTextAccessible;
class TextLeafAccessible;
class ImageAccessible;
class TableAccessible;
class TableCellAccessible;
class AccShowEvent;
/*
* 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
/*
* These objects handle content side communication for an accessible document,
* and their lifetime is the same as the document they represent.
*/
class DocAccessibleChild : public PDocAccessibleChild
{
public:
explicit DocAccessibleChild(DocAccessible* aDoc)
: DocAccessibleChildBase(aDoc)
{
MOZ_COUNT_CTOR_INHERITED(DocAccessibleChild, DocAccessibleChildBase);
}
explicit DocAccessibleChild(DocAccessible* aDoc) :
mDoc(aDoc)
{ MOZ_COUNT_CTOR(DocAccessibleChild); }
~DocAccessibleChild()
{
MOZ_COUNT_DTOR_INHERITED(DocAccessibleChild, 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(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.
*/
@ -474,6 +496,8 @@ private:
bool PersistentPropertiesToArray(nsIPersistentProperties* aProps,
nsTArray<Attribute>* aAttributes);
DocAccessible* mDoc;
};
}

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

@ -1,99 +0,0 @@
/* -*- 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 "mozilla/a11y/ProxyAccessible.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

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

@ -1,70 +0,0 @@
/* -*- 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,6 +6,7 @@
#include "DocAccessibleParent.h"
#include "mozilla/a11y/Platform.h"
#include "ProxyAccessible.h"
#include "mozilla/dom/TabParent.h"
#include "xpcAccessibleDocument.h"
#include "xpcAccEvents.h"
@ -102,24 +103,9 @@ DocAccessibleParent::AddSubtree(ProxyAccessible* aParent,
}
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 =
new ProxyAccessible(newChild.ID(), aParent, this, role,
newChild.Interfaces());
#endif
aParent->AddChildAt(aIdxInParent, newProxy);
mAccessibles.PutEntry(newChild.ID())->mProxy = newProxy;
ProxyCreated(newProxy, newChild.Interfaces());
@ -466,32 +452,5 @@ DocAccessibleParent::GetXPCAccessible(ProxyAccessible* 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
} // mozilla

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

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

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

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ProxyAccessible.h"
#include "mozilla/a11y/DocAccessibleParent.h"
#include "DocAccessibleParent.h"
#include "DocAccessible.h"
#include "mozilla/a11y/DocManager.h"
#include "mozilla/dom/Element.h"
@ -19,6 +19,69 @@
namespace mozilla {
namespace a11y {
void
ProxyAccessible::Shutdown()
{
MOZ_DIAGNOSTIC_ASSERT(!IsDoc());
NS_ASSERTION(!mOuterDoc, "Why do we still have a child doc?");
xpcAccessibleDocument* xpcDoc =
GetAccService()->GetCachedXPCDocument(Document());
if (xpcDoc) {
xpcDoc->NotifyOfShutdown(this);
}
// XXX Ideally this wouldn't be necessary, but it seems OuterDoc accessibles
// can be destroyed before the doc they own.
if (!mOuterDoc) {
uint32_t childCount = mChildren.Length();
for (uint32_t idx = 0; idx < childCount; idx++)
mChildren[idx]->Shutdown();
} else {
if (mChildren.Length() != 1)
MOZ_CRASH("outer doc doesn't own adoc!");
mChildren[0]->AsDoc()->Unbind();
}
mChildren.Clear();
ProxyDestroyed(this);
mDoc->RemoveAccessible(this);
}
void
ProxyAccessible::SetChildDoc(DocAccessibleParent* aParent)
{
if (aParent) {
MOZ_ASSERT(mChildren.IsEmpty());
mChildren.AppendElement(aParent);
mOuterDoc = true;
} else {
MOZ_ASSERT(mChildren.Length() == 1);
mChildren.Clear();
mOuterDoc = false;
}
}
bool
ProxyAccessible::MustPruneChildren() const
{
// this is the equivalent to nsAccUtils::MustPrune for proxies and should be
// kept in sync with that.
if (mRole != roles::MENUITEM && mRole != roles::COMBOBOX_OPTION
&& mRole != roles::OPTION && mRole != roles::ENTRY
&& mRole != roles::FLAT_EQUATION && mRole != roles::PASSWORD_TEXT
&& mRole != roles::PUSHBUTTON && mRole != roles::TOGGLE_BUTTON
&& mRole != roles::GRAPHIC && mRole != roles::SLIDER
&& mRole != roles::PROGRESSBAR && mRole != roles::SEPARATOR)
return false;
if (mChildren.Length() != 1)
return false;
return mChildren[0]->Role() == roles::TEXT_LEAF
|| mChildren[0]->Role() == roles::STATICTEXT;
}
uint64_t
ProxyAccessible::State() const
{
@ -969,6 +1032,55 @@ ProxyAccessible::TakeFocus()
Unused << mDoc->SendTakeFocus(mID);
}
uint32_t
ProxyAccessible::EmbeddedChildCount() const
{
size_t count = 0, kids = mChildren.Length();
for (size_t i = 0; i < kids; i++) {
if (mChildren[i]->IsEmbeddedObject()) {
count++;
}
}
return count;
}
int32_t
ProxyAccessible::IndexOfEmbeddedChild(const ProxyAccessible* aChild)
{
size_t index = 0, kids = mChildren.Length();
for (size_t i = 0; i < kids; i++) {
if (mChildren[i]->IsEmbeddedObject()) {
if (mChildren[i] == aChild) {
return index;
}
index++;
}
}
return -1;
}
ProxyAccessible*
ProxyAccessible::EmbeddedChildAt(size_t aChildIdx)
{
size_t index = 0, kids = mChildren.Length();
for (size_t i = 0; i < kids; i++) {
if (!mChildren[i]->IsEmbeddedObject()) {
continue;
}
if (index == aChildIdx) {
return mChildren[i];
}
index++;
}
return nullptr;
}
ProxyAccessible*
ProxyAccessible::FocusedChild()
{
@ -1063,5 +1175,18 @@ ProxyAccessible::DOMNodeID(nsString& aID)
Unused << mDoc->SendDOMNodeID(mID, &aID);
}
Accessible*
ProxyAccessible::OuterDocOfRemoteBrowser() const
{
auto tab = static_cast<dom::TabParent*>(mDoc->Manager());
dom::Element* frame = tab->GetOwnerElement();
NS_ASSERTION(frame, "why isn't the tab in a frame!");
if (!frame)
return nullptr;
DocAccessible* chromeDoc = GetExistingDocAccessible(frame->OwnerDoc());
return chromeDoc ? chromeDoc->GetAccessible(frame) : nullptr;
}
}
}

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

@ -7,33 +7,115 @@
#ifndef mozilla_a11y_ProxyAccessible_h
#define mozilla_a11y_ProxyAccessible_h
#include "Accessible.h"
#include "mozilla/a11y/ProxyAccessibleBase.h"
#include "mozilla/a11y/Role.h"
#include "nsIAccessibleText.h"
#include "nsIAccessibleTypes.h"
#include "Accessible.h"
#include "nsString.h"
#include "nsTArray.h"
#include "nsRect.h"
#include "Accessible.h"
namespace mozilla {
namespace a11y {
class ProxyAccessible : public ProxyAccessibleBase<ProxyAccessible>
class Accessible;
class Attribute;
class DocAccessibleParent;
enum class RelationType;
enum Interfaces
{
HYPERTEXT = 1,
HYPERLINK = 1 << 1,
IMAGE = 1 << 2,
VALUE = 1 << 3,
TABLE = 1 << 4,
TABLECELL = 1 << 5,
DOCUMENT = 1 << 6,
SELECTION = 1 << 7,
ACTION = 1 << 8,
};
class ProxyAccessible
{
public:
ProxyAccessible(uint64_t aID, ProxyAccessible* aParent,
DocAccessibleParent* aDoc, role aRole, uint32_t aInterfaces)
: ProxyAccessibleBase(aID, aParent, aDoc, aRole, aInterfaces)
DocAccessibleParent* aDoc, role aRole, uint32_t aInterfaces) :
mParent(aParent), mDoc(aDoc), mWrapper(0), mID(aID), mRole(aRole),
mOuterDoc(false), mIsDoc(false),
mHasValue(aInterfaces & Interfaces::VALUE),
mIsHyperLink(aInterfaces & Interfaces::HYPERLINK),
mIsHyperText(aInterfaces & Interfaces::HYPERTEXT)
{
MOZ_COUNT_CTOR_INHERITED(ProxyAccessible, ProxyAccessibleBase);
MOZ_COUNT_CTOR(ProxyAccessible);
}
~ProxyAccessible()
{
MOZ_COUNT_DTOR_INHERITED(ProxyAccessible, ProxyAccessibleBase);
MOZ_COUNT_DTOR(ProxyAccessible);
MOZ_ASSERT(!mWrapper);
}
void AddChildAt(uint32_t aIdx, ProxyAccessible* aChild)
{ mChildren.InsertElementAt(aIdx, aChild); }
uint32_t ChildrenCount() const { return mChildren.Length(); }
ProxyAccessible* ChildAt(uint32_t aIdx) const { return mChildren[aIdx]; }
ProxyAccessible* FirstChild() const
{ return mChildren.Length() ? mChildren[0] : nullptr; }
ProxyAccessible* LastChild() const
{ return mChildren.Length() ? mChildren[mChildren.Length() - 1] : nullptr; }
ProxyAccessible* PrevSibling() const
{
size_t idx = IndexInParent();
return idx > 0 ? Parent()->mChildren[idx - 1] : nullptr;
}
ProxyAccessible* NextSibling() const
{
size_t idx = IndexInParent();
return idx + 1 < Parent()->mChildren.Length() ? Parent()->mChildren[idx + 1]
: nullptr;
}
// XXX evaluate if this is fast enough.
size_t IndexInParent() const { return Parent()->mChildren.IndexOf(this); }
uint32_t EmbeddedChildCount() const;
int32_t IndexOfEmbeddedChild(const ProxyAccessible*);
ProxyAccessible* EmbeddedChildAt(size_t aChildIdx);
bool MustPruneChildren() const;
void Shutdown();
void SetChildDoc(DocAccessibleParent*);
/**
* Remove The given child.
*/
void RemoveChild(ProxyAccessible* aChild)
{ mChildren.RemoveElement(aChild); }
/**
* Return the proxy for the parent of the wrapped accessible.
*/
ProxyAccessible* Parent() const { return mParent; }
Accessible* OuterDocOfRemoteBrowser() const;
/**
* Get the role of the accessible we're proxying.
*/
role Role() const { return mRole; }
/**
* Return true if this is an embedded object.
*/
bool IsEmbeddedObject() const
{
role role = Role();
return role != roles::TEXT_LEAF &&
role != roles::WHITESPACE &&
role != roles::STATICTEXT;
}
/*
@ -314,10 +396,56 @@ public:
*/
void DOMNodeID(nsString& aID);
/**
* Allow the platform to store a pointers worth of data on us.
*/
uintptr_t GetWrapper() const { return mWrapper; }
void SetWrapper(uintptr_t aWrapper) { mWrapper = aWrapper; }
/*
* Return the ID of the accessible being proxied.
*/
uint64_t ID() const { return mID; }
/**
* Return the document containing this proxy, or the proxy itself if it is a
* document.
*/
DocAccessibleParent* Document() const { return mDoc; }
/**
* Return true if this proxy is a DocAccessibleParent.
*/
bool IsDoc() const { return mIsDoc; }
DocAccessibleParent* AsDoc() const { return IsDoc() ? mDoc : nullptr; }
protected:
explicit ProxyAccessible(DocAccessibleParent* aThisAsDoc)
: ProxyAccessibleBase(aThisAsDoc)
explicit ProxyAccessible(DocAccessibleParent* aThisAsDoc) :
mParent(nullptr), mDoc(aThisAsDoc), mWrapper(0), mID(0),
mRole(roles::DOCUMENT), mOuterDoc(false), mIsDoc(true), mHasValue(false),
mIsHyperLink(false), mIsHyperText(false)
{ MOZ_COUNT_CTOR(ProxyAccessible); }
protected:
ProxyAccessible* mParent;
private:
nsTArray<ProxyAccessible*> mChildren;
DocAccessibleParent* mDoc;
uintptr_t mWrapper;
uint64_t mID;
protected:
// XXX DocAccessibleParent gets to change this to change the role of
// documents.
role mRole : 27;
private:
bool mOuterDoc : 1;
public:
const bool mIsDoc: 1;
const bool mHasValue: 1;
const bool mIsHyperLink: 1;
const bool mIsHyperText: 1;
};
}

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

@ -1,159 +0,0 @@
/* -*- 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 "DocAccessible.h"
#include "mozilla/a11y/DocAccessibleParent.h"
#include "mozilla/a11y/DocManager.h"
#include "mozilla/a11y/Platform.h"
#include "mozilla/a11y/ProxyAccessibleBase.h"
#include "mozilla/a11y/ProxyAccessible.h"
#include "mozilla/a11y/Role.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/unused.h"
#include "RelationType.h"
#include "xpcAccessibleDocument.h"
namespace mozilla {
namespace a11y {
template <class Derived>
void
ProxyAccessibleBase<Derived>::Shutdown()
{
MOZ_DIAGNOSTIC_ASSERT(!IsDoc());
NS_ASSERTION(!mOuterDoc, "Why do we still have a child doc?");
xpcAccessibleDocument* xpcDoc =
GetAccService()->GetCachedXPCDocument(Document());
if (xpcDoc) {
xpcDoc->NotifyOfShutdown(static_cast<Derived*>(this));
}
// XXX Ideally this wouldn't be necessary, but it seems OuterDoc accessibles
// can be destroyed before the doc they own.
if (!mOuterDoc) {
uint32_t childCount = mChildren.Length();
for (uint32_t idx = 0; idx < childCount; idx++)
mChildren[idx]->Shutdown();
} else {
if (mChildren.Length() != 1)
MOZ_CRASH("outer doc doesn't own adoc!");
mChildren[0]->AsDoc()->Unbind();
}
mChildren.Clear();
ProxyDestroyed(static_cast<Derived*>(this));
mDoc->RemoveAccessible(static_cast<Derived*>(this));
}
template <class Derived>
void
ProxyAccessibleBase<Derived>::SetChildDoc(DocAccessibleParent* aParent)
{
if (aParent) {
MOZ_ASSERT(mChildren.IsEmpty());
mChildren.AppendElement(aParent);
mOuterDoc = true;
} else {
MOZ_ASSERT(mChildren.Length() == 1);
mChildren.Clear();
mOuterDoc = false;
}
}
template <class Derived>
bool
ProxyAccessibleBase<Derived>::MustPruneChildren() const
{
// this is the equivalent to nsAccUtils::MustPrune for proxies and should be
// kept in sync with that.
if (mRole != roles::MENUITEM && mRole != roles::COMBOBOX_OPTION
&& mRole != roles::OPTION && mRole != roles::ENTRY
&& mRole != roles::FLAT_EQUATION && mRole != roles::PASSWORD_TEXT
&& mRole != roles::PUSHBUTTON && mRole != roles::TOGGLE_BUTTON
&& mRole != roles::GRAPHIC && mRole != roles::SLIDER
&& mRole != roles::PROGRESSBAR && mRole != roles::SEPARATOR)
return false;
if (mChildren.Length() != 1)
return false;
return mChildren[0]->Role() == roles::TEXT_LEAF
|| mChildren[0]->Role() == roles::STATICTEXT;
}
template <class Derived>
uint32_t
ProxyAccessibleBase<Derived>::EmbeddedChildCount() const
{
size_t count = 0, kids = mChildren.Length();
for (size_t i = 0; i < kids; i++) {
if (mChildren[i]->IsEmbeddedObject()) {
count++;
}
}
return count;
}
template <class Derived>
int32_t
ProxyAccessibleBase<Derived>::IndexOfEmbeddedChild(const Derived* aChild)
{
size_t index = 0, kids = mChildren.Length();
for (size_t i = 0; i < kids; i++) {
if (mChildren[i]->IsEmbeddedObject()) {
if (mChildren[i] == aChild) {
return index;
}
index++;
}
}
return -1;
}
template <class Derived>
Derived*
ProxyAccessibleBase<Derived>::EmbeddedChildAt(size_t aChildIdx)
{
size_t index = 0, kids = mChildren.Length();
for (size_t i = 0; i < kids; i++) {
if (!mChildren[i]->IsEmbeddedObject()) {
continue;
}
if (index == aChildIdx) {
return mChildren[i];
}
index++;
}
return nullptr;
}
template <class Derived>
Accessible*
ProxyAccessibleBase<Derived>::OuterDocOfRemoteBrowser() const
{
auto tab = static_cast<dom::TabParent*>(mDoc->Manager());
dom::Element* frame = tab->GetOwnerElement();
NS_ASSERTION(frame, "why isn't the tab in a frame!");
if (!frame)
return nullptr;
DocAccessible* chromeDoc = GetExistingDocAccessible(frame->OwnerDoc());
return chromeDoc ? chromeDoc->GetAccessible(frame) : nullptr;
}
template class ProxyAccessibleBase<ProxyAccessible>;
} // namespace a11y
} // namespace mozilla

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

@ -1,192 +0,0 @@
/* -*- 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_ProxyAccessibleBase_h
#define mozilla_a11y_ProxyAccessibleBase_h
#include "mozilla/a11y/Role.h"
#include "nsIAccessibleText.h"
#include "nsIAccessibleTypes.h"
#include "Accessible.h"
#include "nsString.h"
#include "nsTArray.h"
#include "nsRect.h"
#include "Accessible.h"
namespace mozilla {
namespace a11y {
class Accessible;
class Attribute;
class DocAccessibleParent;
class ProxyAccessible;
enum class RelationType;
enum Interfaces
{
HYPERTEXT = 1,
HYPERLINK = 1 << 1,
IMAGE = 1 << 2,
VALUE = 1 << 3,
TABLE = 1 << 4,
TABLECELL = 1 << 5,
DOCUMENT = 1 << 6,
SELECTION = 1 << 7,
ACTION = 1 << 8,
};
template <class Derived>
class ProxyAccessibleBase
{
public:
ProxyAccessibleBase(uint64_t aID, Derived* aParent,
DocAccessibleParent* aDoc, role aRole,
uint32_t aInterfaces)
: mParent(aParent)
, mDoc(aDoc)
, mWrapper(0)
, mID(aID)
, mRole(aRole)
, mOuterDoc(false)
, mIsDoc(false)
, mHasValue(aInterfaces & Interfaces::VALUE)
, mIsHyperLink(aInterfaces & Interfaces::HYPERLINK)
, mIsHyperText(aInterfaces & Interfaces::HYPERTEXT)
{
MOZ_COUNT_CTOR(ProxyAccessibleBase);
}
~ProxyAccessibleBase()
{
MOZ_COUNT_DTOR(ProxyAccessibleBase);
MOZ_ASSERT(!mWrapper);
}
void AddChildAt(uint32_t aIdx, Derived* aChild)
{ mChildren.InsertElementAt(aIdx, aChild); }
uint32_t ChildrenCount() const { return mChildren.Length(); }
Derived* ChildAt(uint32_t aIdx) const { return mChildren[aIdx]; }
Derived* FirstChild() const
{ return mChildren.Length() ? mChildren[0] : nullptr; }
Derived* LastChild() const
{ return mChildren.Length() ? mChildren[mChildren.Length() - 1] : nullptr; }
Derived* PrevSibling() const
{
size_t idx = IndexInParent();
return idx > 0 ? Parent()->mChildren[idx - 1] : nullptr;
}
Derived* NextSibling() const
{
size_t idx = IndexInParent();
return idx + 1 < Parent()->mChildren.Length() ? Parent()->mChildren[idx + 1]
: nullptr;
}
// XXX evaluate if this is fast enough.
size_t IndexInParent() const { return
Parent()->mChildren.IndexOf(static_cast<const Derived*>(this)); }
uint32_t EmbeddedChildCount() const;
int32_t IndexOfEmbeddedChild(const Derived* aChild);
Derived* EmbeddedChildAt(size_t aChildIdx);
bool MustPruneChildren() const;
void Shutdown();
void SetChildDoc(DocAccessibleParent*);
/**
* Remove The given child.
*/
void RemoveChild(Derived* aChild)
{ mChildren.RemoveElement(aChild); }
/**
* Return the proxy for the parent of the wrapped accessible.
*/
Derived* Parent() const { return mParent; }
Accessible* OuterDocOfRemoteBrowser() const;
/**
* Get the role of the accessible we're proxying.
*/
role Role() const { return mRole; }
/**
* Return true if this is an embedded object.
*/
bool IsEmbeddedObject() const
{
role role = Role();
return role != roles::TEXT_LEAF &&
role != roles::WHITESPACE &&
role != roles::STATICTEXT;
}
/**
* Allow the platform to store a pointers worth of data on us.
*/
uintptr_t GetWrapper() const { return mWrapper; }
void SetWrapper(uintptr_t aWrapper) { mWrapper = aWrapper; }
/*
* Return the ID of the accessible being proxied.
*/
uint64_t ID() const { return mID; }
/**
* Return the document containing this proxy, or the proxy itself if it is a
* document.
*/
DocAccessibleParent* Document() const { return mDoc; }
/**
* Return true if this proxy is a DocAccessibleParent.
*/
bool IsDoc() const { return mIsDoc; }
DocAccessibleParent* AsDoc() const { return IsDoc() ? mDoc : nullptr; }
protected:
explicit ProxyAccessibleBase(DocAccessibleParent* aThisAsDoc) :
mParent(nullptr), mDoc(aThisAsDoc), mWrapper(0), mID(0),
mRole(roles::DOCUMENT), mOuterDoc(false), mIsDoc(true), mHasValue(false),
mIsHyperLink(false), mIsHyperText(false)
{ MOZ_COUNT_CTOR(ProxyAccessibleBase); }
protected:
Derived* mParent;
private:
friend Derived;
nsTArray<Derived*> mChildren;
DocAccessibleParent* mDoc;
uintptr_t mWrapper;
uint64_t mID;
protected:
// XXX DocAccessibleParent gets to change this to change the role of
// documents.
role mRole : 27;
private:
bool mOuterDoc : 1;
public:
const bool mIsDoc: 1;
const bool mHasValue: 1;
const bool mIsHyperLink: 1;
const bool mIsHyperText: 1;
};
extern template class ProxyAccessibleBase<ProxyAccessible>;
}
}
#endif

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

@ -4,22 +4,38 @@
# 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 CONFIG['OS_ARCH'] == 'WINNT':
DIRS += ['win']
LOCAL_INCLUDES += [
'/accessible/ipc/win',
'/accessible/windows/ia2',
'/accessible/windows/msaa',
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',
'DocAccessibleParent.h',
'ProxyAccessible.h'
]
else:
DIRS += ['other']
LOCAL_INCLUDES += [
'/accessible/ipc/other',
SOURCES += [
'DocAccessibleChild.cpp',
'DocAccessibleParent.cpp',
'ProxyAccessible.cpp'
]
LOCAL_INCLUDES += [
'../base',
'../generic',
'../xpcom',
]
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
LOCAL_INCLUDES += [
'/accessible/atk',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
LOCAL_INCLUDES += [
'/accessible/windows/ia2',
'/accessible/windows/msaa',
]
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
LOCAL_INCLUDES += [
'/accessible/mac',
@ -29,30 +45,9 @@ else:
'/accessible/other',
]
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',
'ProxyAccessibleBase.h',
]
UNIFIED_SOURCES += [
'DocAccessibleChildBase.cpp',
'DocAccessibleParent.cpp',
'ProxyAccessibleBase.cpp',
]
LOCAL_INCLUDES += [
'/accessible/base',
'/accessible/generic',
'/accessible/xpcom',
]
FINAL_LIBRARY = 'xul'
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wno-error=shadow']

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

@ -1,47 +0,0 @@
# -*- 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']
FINAL_LIBRARY = 'xul'

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

@ -1,50 +0,0 @@
/* -*- 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

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

@ -1,27 +0,0 @@
/* -*- 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

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

@ -1,44 +0,0 @@
/* -*- 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"
#include "mozilla/a11y/PlatformChild.h"
#include "mozilla/ClearOnShutdown.h"
namespace mozilla {
namespace a11y {
static StaticAutoPtr<PlatformChild> sPlatformChild;
DocAccessibleChild::DocAccessibleChild(DocAccessible* aDoc)
: DocAccessibleChildBase(aDoc)
{
MOZ_COUNT_CTOR_INHERITED(DocAccessibleChild, DocAccessibleChildBase);
if (!sPlatformChild) {
sPlatformChild = new PlatformChild();
ClearOnShutdown(&sPlatformChild, ShutdownPhase::ShutdownThreads);
}
}
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

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

@ -1,37 +0,0 @@
/* -*- 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

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

@ -1,73 +0,0 @@
/* -*- 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__();
};
}
}

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

@ -1,49 +0,0 @@
/* -*- 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/PlatformChild.h"
#include "mozilla/mscom/EnsureMTA.h"
#include "mozilla/mscom/InterceptorLog.h"
#include "Accessible2.h"
namespace mozilla {
namespace a11y {
/**
* Unfortunately the COM interceptor does not intrinsically handle array
* outparams. Instead we manually define the relevant metadata here, and
* register it in a call to mozilla::mscom::RegisterArrayData.
* @see mozilla::mscom::ArrayData
*/
static const mozilla::mscom::ArrayData sPlatformChildArrayData[] = {
{IID_IEnumVARIANT, 3, 1, VT_DISPATCH, IID_IDispatch, 2},
{IID_IAccessible2, 30, 1, VT_UNKNOWN | VT_BYREF, IID_IAccessibleRelation, 2},
{IID_IAccessibleRelation, 7, 1, VT_UNKNOWN | VT_BYREF, IID_IUnknown, 2}
};
// Type libraries are thread-neutral, so we can register those from any
// apartment. OTOH, proxies must be registered from within the apartment where
// we intend to instantiate them. Therefore RegisterProxy() must be called
// via EnsureMTA.
PlatformChild::PlatformChild()
: mAccTypelib(mozilla::mscom::RegisterTypelib(L"oleacc.dll",
mozilla::mscom::RegistrationFlags::eUseSystemDirectory))
, mMiscTypelib(mozilla::mscom::RegisterTypelib(L"Accessible.tlb"))
{
mozilla::mscom::InterceptorLog::Init();
mozilla::mscom::RegisterArrayData(sPlatformChildArrayData);
UniquePtr<mozilla::mscom::RegisteredProxy> ia2Proxy;
mozilla::mscom::EnsureMTA([&ia2Proxy]() -> void {
ia2Proxy = Move(mozilla::mscom::RegisterProxy(L"ia2marshal.dll"));
});
mIA2Proxy = Move(ia2Proxy);
}
} // namespace a11y
} // namespace mozilla

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

@ -1,35 +0,0 @@
/* -*- 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_PlatformChild_h
#define mozilla_a11y_PlatformChild_h
#include "mozilla/mscom/Registration.h"
namespace mozilla {
namespace a11y {
class PlatformChild
{
public:
PlatformChild();
PlatformChild(PlatformChild&) = delete;
PlatformChild(PlatformChild&&) = delete;
PlatformChild& operator=(PlatformChild&) = delete;
PlatformChild& operator=(PlatformChild&&) = delete;
private:
UniquePtr<mozilla::mscom::RegisteredProxy> mIA2Proxy;
UniquePtr<mozilla::mscom::RegisteredProxy> mAccTypelib;
UniquePtr<mozilla::mscom::RegisteredProxy> mMiscTypelib;
};
} // namespace mozilla
} // namespace a11y
#endif // mozilla_a11y_PlatformChild_h

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

@ -1,280 +0,0 @@
/* -*- 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 "Accessible2.h"
#include "ProxyAccessible.h"
#include "mozilla/a11y/DocAccessibleParent.h"
#include "DocAccessible.h"
#include "mozilla/a11y/DocManager.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/TabParent.h"
#include "mozilla/unused.h"
#include "mozilla/a11y/Platform.h"
#include "RelationType.h"
#include "mozilla/a11y/Role.h"
#include "xpcAccessibleDocument.h"
#include <comutil.h>
namespace mozilla {
namespace a11y {
bool
ProxyAccessible::GetCOMInterface(void** aOutAccessible) const
{
if (!aOutAccessible) {
return false;
}
RefPtr<IAccessible> addRefed = mCOMProxy;
addRefed.forget(aOutAccessible);
return !!mCOMProxy;
}
void
ProxyAccessible::Name(nsString& aName) const
{
aName.Truncate();
RefPtr<IAccessible> acc;
if (!GetCOMInterface((void**)getter_AddRefs(acc))) {
return;
}
VARIANT id;
id.vt = VT_I4;
id.lVal = CHILDID_SELF;
BSTR result;
HRESULT hr = acc->get_accName(id, &result);
_bstr_t resultWrap(result, false);
if (FAILED(hr)) {
return;
}
aName = (wchar_t*)resultWrap;
}
void
ProxyAccessible::Value(nsString& aValue) const
{
aValue.Truncate();
RefPtr<IAccessible> acc;
if (!GetCOMInterface((void**)getter_AddRefs(acc))) {
return;
}
VARIANT id;
id.vt = VT_I4;
id.lVal = CHILDID_SELF;
BSTR result;
HRESULT hr = acc->get_accValue(id, &result);
_bstr_t resultWrap(result, false);
if (FAILED(hr)) {
return;
}
aValue = (wchar_t*)resultWrap;
}
void
ProxyAccessible::Description(nsString& aDesc) const
{
aDesc.Truncate();
RefPtr<IAccessible> acc;
if (!GetCOMInterface((void**)getter_AddRefs(acc))) {
return;
}
VARIANT id;
id.vt = VT_I4;
id.lVal = CHILDID_SELF;
BSTR result;
HRESULT hr = acc->get_accDescription(id, &result);
_bstr_t resultWrap(result, false);
if (FAILED(hr)) {
return;
}
aDesc = (wchar_t*)resultWrap;
}
uint64_t
ProxyAccessible::State() const
{
uint64_t state = 0;
RefPtr<IAccessible> acc;
if (!GetCOMInterface((void**)getter_AddRefs(acc))) {
return state;
}
VARIANT id;
id.vt = VT_I4;
id.lVal = CHILDID_SELF;
VARIANT varState;
HRESULT hr = acc->get_accState(id, &varState);
if (FAILED(hr)) {
return state;
}
return uint64_t(varState.lVal);
}
nsIntRect
ProxyAccessible::Bounds()
{
nsIntRect rect;
RefPtr<IAccessible> acc;
if (!GetCOMInterface((void**)getter_AddRefs(acc))) {
return rect;
}
long left;
long top;
long width;
long height;
VARIANT id;
id.vt = VT_I4;
id.lVal = CHILDID_SELF;
HRESULT hr = acc->accLocation(&left, &top, &width, &height, id);
if (FAILED(hr)) {
return rect;
}
rect.x = left;
rect.y = top;
rect.width = width;
rect.height = height;
return rect;
}
void
ProxyAccessible::Language(nsString& aLocale)
{
aLocale.Truncate();
RefPtr<IAccessible> acc;
if (!GetCOMInterface((void**)getter_AddRefs(acc))) {
return;
}
RefPtr<IAccessible2> acc2;
if (FAILED(acc->QueryInterface(IID_IAccessible2, (void**)getter_AddRefs(acc2)))) {
return;
}
IA2Locale locale;
HRESULT hr = acc2->get_locale(&locale);
_bstr_t langWrap(locale.language, false);
_bstr_t countryWrap(locale.country, false);
_bstr_t variantWrap(locale.variant, false);
if (FAILED(hr)) {
return;
}
// The remaining code should essentially be the inverse of the
// ia2Accessible::get_locale conversion to IA2Locale.
if (!!variantWrap) {
aLocale = (wchar_t*)variantWrap;
return;
}
if (!!langWrap) {
aLocale = (wchar_t*)langWrap;
if (!!countryWrap) {
aLocale += L"-";
aLocale += (wchar_t*)countryWrap;
}
}
}
static bool
IsEscapedChar(const wchar_t c)
{
return c == L'\\' || c == L':' || c == ',' || c == '=' || c == ';';
}
static bool
ConvertBSTRAttributesToArray(const nsAString& aStr,
nsTArray<Attribute>* aAttrs)
{
if (!aAttrs) {
return false;
}
enum
{
eName = 0,
eValue = 1,
eNumStates
} state;
nsAutoString tokens[eNumStates];
auto itr = aStr.BeginReading(), end = aStr.EndReading();
state = eName;
while (itr != end) {
switch (*itr) {
case L'\\':
// Skip the backslash so that we're looking at the escaped char
++itr;
if (itr == end || !IsEscapedChar(*itr)) {
// Invalid state
return false;
}
break;
case L':':
if (state != eName) {
// Bad, should be looking at name
return false;
}
state = eValue;
++itr;
continue;
case L';':
if (state != eValue) {
// Bad, should be looking at value
return false;
}
state = eName;
aAttrs->AppendElement(Attribute(NS_ConvertUTF16toUTF8(tokens[eName]),
tokens[eValue]));
tokens[eName].Truncate();
tokens[eValue].Truncate();
++itr;
continue;
default:
break;
}
tokens[state] += *itr;
}
return true;
}
void
ProxyAccessible::Attributes(nsTArray<Attribute>* aAttrs) const
{
aAttrs->Clear();
RefPtr<IAccessible> acc;
if (!GetCOMInterface((void**)getter_AddRefs(acc))) {
return;
}
RefPtr<IAccessible2> acc2;
if (FAILED(acc->QueryInterface(IID_IAccessible2, (void**)getter_AddRefs(acc2)))) {
return;
}
BSTR attrs;
HRESULT hr = acc2->get_attributes(&attrs);
_bstr_t attrsWrap(attrs, false);
if (FAILED(hr)) {
return;
}
ConvertBSTRAttributesToArray(nsDependentString((wchar_t*)attrs,
attrsWrap.length()),
aAttrs);
}
} // namespace a11y
} // namespace mozilla

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

@ -1,88 +0,0 @@
/* -*- 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_ProxyAccessible_h
#define mozilla_a11y_ProxyAccessible_h
#include "Accessible.h"
#include "mozilla/a11y/ProxyAccessibleBase.h"
#include "mozilla/a11y/Role.h"
#include "nsIAccessibleText.h"
#include "nsIAccessibleTypes.h"
#include "nsString.h"
#include "nsTArray.h"
#include "nsRect.h"
#include <oleacc.h>
namespace mozilla {
namespace a11y {
class ProxyAccessible : public ProxyAccessibleBase<ProxyAccessible>
{
public:
ProxyAccessible(uint64_t aID, ProxyAccessible* aParent,
DocAccessibleParent* aDoc, role aRole, uint32_t aInterfaces,
const RefPtr<IAccessible>& aIAccessible)
: ProxyAccessibleBase(aID, aParent, aDoc, aRole, aInterfaces)
, mCOMProxy(aIAccessible)
{
MOZ_COUNT_CTOR_INHERITED(ProxyAccessible, ProxyAccessibleBase);
}
~ProxyAccessible()
{
MOZ_COUNT_DTOR_INHERITED(ProxyAccessible, ProxyAccessibleBase);
}
/*
* Return the states for the proxied accessible.
*/
uint64_t State() const;
/*
* Set aName to the name of the proxied accessible.
*/
void Name(nsString& aName) const;
/*
* Set aValue to the value of the proxied accessible.
*/
void Value(nsString& aValue) const;
/**
* Set aDesc to the description of the proxied accessible.
*/
void Description(nsString& aDesc) const;
/**
* Get the set of attributes on the proxied accessible.
*/
void Attributes(nsTArray<Attribute> *aAttrs) const;
nsIntRect Bounds();
void Language(nsString& aLocale);
bool GetCOMInterface(void** aOutAccessible) const;
protected:
explicit ProxyAccessible(DocAccessibleParent* aThisAsDoc)
: ProxyAccessibleBase(aThisAsDoc)
{ MOZ_COUNT_CTOR(ProxyAccessibleBase); }
void SetCOMInterface(const RefPtr<IAccessible>& aIAccessible)
{ mCOMProxy = aIAccessible; }
private:
RefPtr<IAccessible> mCOMProxy;
};
}
}
#endif

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

@ -1,38 +0,0 @@
# -*- 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/.
DIRS += ['typelib']
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',
'PlatformChild.h',
'ProxyAccessible.h'
]
SOURCES += [
'COMPtrTypes.cpp',
'DocAccessibleChild.cpp',
'PlatformChild.cpp',
'ProxyAccessible.cpp',
]
LOCAL_INCLUDES += [
'/accessible/base',
'/accessible/generic',
'/accessible/windows/ia2',
'/accessible/windows/msaa',
'/accessible/xpcom',
]
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'

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

@ -1,16 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=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/. */
import "oaidl.idl";
import "servprov.idl";
[uuid(b4d37cda-0dac-45e6-b613-158a5eb94293)]
library Accessible
{
interface IEnumVARIANT;
interface IServiceProvider;
};

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

@ -1,31 +0,0 @@
# 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/.
GARBAGE += $(MIDL_GENERATED_FILES) done_gen dlldata.c
MIDL_GENERATED_FILES = \
Accessible.h \
Accessible_i.c \
Accessible_p.c \
Accessible.tlb \
$(NULL)
$(MIDL_GENERATED_FILES): done_gen
done_gen: Accessible.idl
$(MIDL) $(MIDL_FLAGS) -Oicf $(srcdir)/Accessible.idl
touch $@
export:: done_gen
midl_exports := \
Accessible.tlb \
$(NULL)
INSTALL_TARGETS += midl_exports
midl_exports_FILES := $(midl_exports)
midl_exports_DEST = $(DIST)/bin
midl_exports_TARGET := export
include $(topsrcdir)/config/rules.mk

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

@ -1,13 +0,0 @@
# -*- 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/.
FINAL_TARGET_FILES += [
'!Accessible.tlb',
]
GENERATED_FILES += [
'Accessible.tlb',
]

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

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

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

@ -15,7 +15,7 @@ namespace a11y {
class ProxyAccessibleWrap : public AccessibleWrap
{
public:
public:
ProxyAccessibleWrap(ProxyAccessible* aProxy) :
AccessibleWrap(nullptr, nullptr)
{
@ -28,11 +28,6 @@ public:
mBits.proxy = nullptr;
mStateFlags |= eIsDefunct;
}
virtual void GetNativeInterface(void** aOutAccessible) override
{
mBits.proxy->GetCOMInterface(aOutAccessible);
}
};
class HyperTextProxyAccessibleWrap : public HyperTextAccessibleWrap
@ -48,12 +43,7 @@ public:
virtual void Shutdown() override
{
mBits.proxy = nullptr;
mStateFlags |= eIsDefunct;
}
virtual void GetNativeInterface(void** aOutAccessible) override
{
mBits.proxy->GetCOMInterface(aOutAccessible);
mStateFlags |= eIsDefunct;
}
};

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

@ -73,7 +73,14 @@ ia2Accessible::get_nRelations(long* aNRelations)
if (acc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
MOZ_ASSERT(!acc->IsProxy());
if (acc->IsProxy()) {
// XXX evaluate performance of collecting all relation targets.
nsTArray<RelationType> types;
nsTArray<nsTArray<ProxyAccessible*>> targetSets;
acc->Proxy()->Relations(&types, &targetSets);
*aNRelations = types.Length();
return S_OK;
}
for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs); idx++) {
if (sRelationTypePairs[idx].second == IA2_RELATION_NULL)
@ -102,7 +109,33 @@ ia2Accessible::get_relation(long aRelationIndex,
if (acc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
MOZ_ASSERT(!acc->IsProxy());
if (acc->IsProxy()) {
nsTArray<RelationType> types;
nsTArray<nsTArray<ProxyAccessible*>> targetSets;
acc->Proxy()->Relations(&types, &targetSets);
size_t targetSetCount = targetSets.Length();
for (size_t i = 0; i < targetSetCount; i++) {
uint32_t relTypeIdx = static_cast<uint32_t>(types[i]);
MOZ_ASSERT(sRelationTypePairs[relTypeIdx].first == types[i]);
if (sRelationTypePairs[relTypeIdx].second == IA2_RELATION_NULL)
continue;
if (static_cast<size_t>(aRelationIndex) == i) {
nsTArray<RefPtr<Accessible>> targets;
size_t targetCount = targetSets[i].Length();
for (size_t j = 0; j < targetCount; j++)
targets.AppendElement(WrapperFor(targetSets[i][j]));
RefPtr<ia2AccessibleRelation> rel =
new ia2AccessibleRelation(types[i], Move(targets));
rel.forget(aRelation);
return S_OK;
}
}
return E_INVALIDARG;
}
long relIdx = 0;
for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs); idx++) {
@ -143,7 +176,33 @@ ia2Accessible::get_relations(long aMaxRelations,
if (acc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
MOZ_ASSERT(!acc->IsProxy());
if (acc->IsProxy()) {
nsTArray<RelationType> types;
nsTArray<nsTArray<ProxyAccessible*>> targetSets;
acc->Proxy()->Relations(&types, &targetSets);
size_t count = std::min(targetSets.Length(),
static_cast<size_t>(aMaxRelations));
size_t i = 0;
while (i < count) {
uint32_t relTypeIdx = static_cast<uint32_t>(types[i]);
if (sRelationTypePairs[relTypeIdx].second == IA2_RELATION_NULL)
continue;
size_t targetCount = targetSets[i].Length();
nsTArray<RefPtr<Accessible>> targets(targetCount);
for (size_t j = 0; j < targetCount; j++)
targets.AppendElement(WrapperFor(targetSets[i][j]));
RefPtr<ia2AccessibleRelation> rel =
new ia2AccessibleRelation(types[i], Move(targets));
rel.forget(aRelation + i);
i++;
}
*aNRelations = i;
return S_OK;
}
for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs) &&
*aNRelations < aMaxRelations; idx++) {
@ -184,8 +243,10 @@ ia2Accessible::role(long* aRole)
break;
a11y::role geckoRole;
MOZ_ASSERT(!acc->IsProxy());
geckoRole = acc->Role();
if (acc->IsProxy())
geckoRole = acc->Proxy()->Role();
else
geckoRole = acc->Role();
switch (geckoRole) {
#include "RoleMap.h"
default:
@ -196,11 +257,16 @@ ia2Accessible::role(long* aRole)
// Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call
// the IA2 role a ROLE_OUTLINEITEM.
MOZ_ASSERT(!acc->IsProxy());
if (geckoRole == roles::ROW) {
Accessible* xpParent = acc->Parent();
if (xpParent && xpParent->Role() == roles::TREE_TABLE)
if (acc->IsProxy()) {
if (geckoRole == roles::ROW && acc->Proxy()->Parent() &&
acc->Proxy()->Parent()->Role() == roles::TREE_TABLE)
*aRole = ROLE_SYSTEM_OUTLINEITEM;
} else {
if (geckoRole == roles::ROW) {
Accessible* xpParent = acc->Parent();
if (xpParent && xpParent->Role() == roles::TREE_TABLE)
*aRole = ROLE_SYSTEM_OUTLINEITEM;
}
}
return S_OK;
@ -217,9 +283,12 @@ ia2Accessible::scrollTo(enum IA2ScrollType aScrollType)
if (acc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
MOZ_ASSERT(!acc->IsProxy());
nsCoreUtils::ScrollTo(acc->Document()->PresShell(), acc->GetContent(),
aScrollType);
if (acc->IsProxy()) {
acc->Proxy()->ScrollTo(aScrollType);
} else {
nsCoreUtils::ScrollTo(acc->Document()->PresShell(), acc->GetContent(),
aScrollType);
}
return S_OK;
@ -240,8 +309,11 @@ ia2Accessible::scrollToPoint(enum IA2CoordinateType aCoordType,
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
MOZ_ASSERT(!acc->IsProxy());
acc->ScrollToPoint(geckoCoordType, aX, aY);
if (acc->IsProxy()) {
acc->Proxy()->ScrollToPoint(geckoCoordType, aX, aY);
} else {
acc->ScrollToPoint(geckoCoordType, aX, aY);
}
return S_OK;
@ -301,8 +373,10 @@ ia2Accessible::get_states(AccessibleStates* aStates)
}
uint64_t state;
MOZ_ASSERT(!acc->IsProxy());
state = acc->State();
if (acc->IsProxy())
state = acc->Proxy()->State();
else
state = acc->State();
if (state & states::INVALID)
*aStates |= IA2_STATE_INVALID_ENTRY;
@ -474,8 +548,10 @@ ia2Accessible::get_indexInParent(long* aIndexInParent)
if (acc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
MOZ_ASSERT(!acc->IsProxy());
*aIndexInParent = acc->IndexInParent();
if (acc->IsProxy())
*aIndexInParent = acc->Proxy()->IndexInParent();
else
*aIndexInParent = acc->IndexInParent();
if (*aIndexInParent == -1)
return S_FALSE;
@ -556,8 +632,9 @@ ia2Accessible::get_attributes(BSTR* aAttributes)
return ConvertToIA2Attributes(attributes, aAttributes);
}
MOZ_ASSERT(!acc->IsProxy());
return E_UNEXPECTED;
nsTArray<Attribute> attrs;
acc->Proxy()->Attributes(&attrs);
return ConvertToIA2Attributes(&attrs, aAttributes);
A11Y_TRYBLOCK_END
}
@ -642,12 +719,21 @@ ia2Accessible::get_relationTargetsOfType(BSTR aType,
return CO_E_OBJNOTCONNECTED;
nsTArray<Accessible*> targets;
MOZ_ASSERT(!acc->IsProxy());
Relation rel = acc->RelationByType(*relationType);
Accessible* target = nullptr;
while ((target = rel.Next()) &&
static_cast<long>(targets.Length()) <= aMaxTargets) {
targets.AppendElement(target);
if (acc->IsProxy()) {
nsTArray<ProxyAccessible*> targetProxies =
acc->Proxy()->RelationByType(*relationType);
size_t targetCount = aMaxTargets;
if (targetProxies.Length() < targetCount)
targetCount = targetProxies.Length();
for (size_t i = 0; i < targetCount; i++)
targets.AppendElement(WrapperFor(targetProxies[i]));
} else {
Relation rel = acc->RelationByType(*relationType);
Accessible* target = nullptr;
while ((target = rel.Next()) &&
static_cast<long>(targets.Length()) <= aMaxTargets)
targets.AppendElement(target);
}
*aNTargets = targets.Length();

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

@ -24,7 +24,9 @@ ia2AccessibleEditableText::copyText(long aStartOffset, long aEndOffset)
{
A11Y_TRYBLOCK_BEGIN
MOZ_ASSERT(!HyperTextProxyFor(this));
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->CopyText(aStartOffset, aEndOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
@ -44,7 +46,9 @@ ia2AccessibleEditableText::deleteText(long aStartOffset, long aEndOffset)
{
A11Y_TRYBLOCK_BEGIN
MOZ_ASSERT(!HyperTextProxyFor(this));
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->DeleteText(aStartOffset, aEndOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
@ -66,7 +70,9 @@ ia2AccessibleEditableText::insertText(long aOffset, BSTR *aText)
uint32_t length = ::SysStringLen(*aText);
nsAutoString text(*aText, length);
MOZ_ASSERT(!HyperTextProxyFor(this));
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->InsertText(text, aOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
@ -86,7 +92,9 @@ ia2AccessibleEditableText::cutText(long aStartOffset, long aEndOffset)
{
A11Y_TRYBLOCK_BEGIN
MOZ_ASSERT(!HyperTextProxyFor(this));
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->CutText(aStartOffset, aEndOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
@ -106,7 +114,9 @@ ia2AccessibleEditableText::pasteText(long aOffset)
{
A11Y_TRYBLOCK_BEGIN
MOZ_ASSERT(!HyperTextProxyFor(this));
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->PasteText(aOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())

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

@ -53,7 +53,17 @@ ia2AccessibleHyperlink::get_anchor(long aIndex, VARIANT* aAnchor)
VariantInit(aAnchor);
Accessible* thisObj = static_cast<AccessibleWrap*>(this);
MOZ_ASSERT(!thisObj->IsProxy());
if (thisObj->IsProxy()) {
ProxyAccessible* anchor = thisObj->Proxy()->AnchorAt(aIndex);
if (!anchor)
return S_FALSE;
IUnknown* tmp = static_cast<IAccessibleHyperlink*>(WrapperFor(anchor));
tmp->AddRef();
aAnchor->punkVal = tmp;
aAnchor->vt = VT_UNKNOWN;
return S_OK;
}
if (thisObj->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -87,35 +97,36 @@ ia2AccessibleHyperlink::get_anchorTarget(long aIndex, VARIANT* aAnchorTarget)
{
A11Y_TRYBLOCK_BEGIN
if (!aAnchorTarget) {
if (!aAnchorTarget)
return E_INVALIDARG;
}
VariantInit(aAnchorTarget);
Accessible* thisObj = static_cast<AccessibleWrap*>(this);
nsAutoCString uriStr;
MOZ_ASSERT(!thisObj->IsProxy());
if (thisObj->IsDefunct()) {
return CO_E_OBJNOTCONNECTED;
}
if (thisObj->IsProxy()) {
bool ok;
thisObj->Proxy()->AnchorURIAt(aIndex, uriStr, &ok);
if (!ok)
return S_FALSE;
if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount())) {
return E_INVALIDARG;
}
} else {
if (thisObj->IsDefunct())
return CO_E_OBJNOTCONNECTED;
if (!thisObj->IsLink()) {
return S_FALSE;
}
if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount()))
return E_INVALIDARG;
nsCOMPtr<nsIURI> uri = thisObj->AnchorURIAt(aIndex);
if (!uri) {
return S_FALSE;
}
if (!thisObj->IsLink())
return S_FALSE;
nsresult rv = uri->GetSpec(uriStr);
if (NS_FAILED(rv)) {
return GetHRESULT(rv);
nsCOMPtr<nsIURI> uri = thisObj->AnchorURIAt(aIndex);
if (!uri)
return S_FALSE;
nsresult rv = uri->GetSpec(uriStr);
if (NS_FAILED(rv))
return GetHRESULT(rv);
}
nsAutoString stringURI;
@ -139,7 +150,11 @@ ia2AccessibleHyperlink::get_startIndex(long* aIndex)
*aIndex = 0;
MOZ_ASSERT(!HyperTextProxyFor(this));
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
bool valid;
*aIndex = proxy->StartOffset(&valid);
return valid ? S_OK : S_FALSE;
}
Accessible* thisObj = static_cast<AccessibleWrap*>(this);
if (thisObj->IsDefunct())
@ -164,7 +179,11 @@ ia2AccessibleHyperlink::get_endIndex(long* aIndex)
*aIndex = 0;
MOZ_ASSERT(!HyperTextProxyFor(this));
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
bool valid;
*aIndex = proxy->EndOffset(&valid);
return valid ? S_OK : S_FALSE;
}
Accessible* thisObj = static_cast<AccessibleWrap*>(this);
if (thisObj->IsDefunct())
@ -189,7 +208,10 @@ ia2AccessibleHyperlink::get_valid(boolean* aValid)
*aValid = false;
MOZ_ASSERT(!HyperTextProxyFor(this));
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
*aValid = proxy->IsLinkValid();
return S_OK;
}
Accessible* thisObj = static_cast<AccessibleWrap*>(this);
if (thisObj->IsDefunct())

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

@ -26,7 +26,10 @@ ia2AccessibleHypertext::get_nHyperlinks(long* aHyperlinkCount)
*aHyperlinkCount = 0;
MOZ_ASSERT(!HyperTextProxyFor(this));
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
*aHyperlinkCount = proxy->LinkCount();
return S_OK;
}
HyperTextAccessibleWrap* hyperText = static_cast<HyperTextAccessibleWrap*>(this);
if (hyperText->IsDefunct())
@ -50,13 +53,19 @@ ia2AccessibleHypertext::get_hyperlink(long aLinkIndex,
*aHyperlink = nullptr;
AccessibleWrap* hyperLink;
MOZ_ASSERT(!HyperTextProxyFor(this));
HyperTextAccessibleWrap* hyperText = static_cast<HyperTextAccessibleWrap*>(this);
if (hyperText->IsDefunct()) {
return CO_E_OBJNOTCONNECTED;
}
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
ProxyAccessible* link = proxy->LinkAt(aLinkIndex);
if (!link)
return E_FAIL;
hyperLink = static_cast<AccessibleWrap*>(hyperText->LinkAt(aLinkIndex));
hyperLink = WrapperFor(link);
} else {
HyperTextAccessibleWrap* hyperText = static_cast<HyperTextAccessibleWrap*>(this);
if (hyperText->IsDefunct())
return CO_E_OBJNOTCONNECTED;
hyperLink = static_cast<AccessibleWrap*>(hyperText->LinkAt(aLinkIndex));
}
if (!hyperLink)
return E_FAIL;
@ -79,7 +88,10 @@ ia2AccessibleHypertext::get_hyperlinkIndex(long aCharIndex, long* aHyperlinkInde
*aHyperlinkIndex = 0;
MOZ_ASSERT(!HyperTextProxyFor(this));
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
*aHyperlinkIndex = proxy->LinkIndexAtOffset(aCharIndex);
return S_OK;
}
HyperTextAccessibleWrap* hyperAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (hyperAcc->IsDefunct())

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

@ -30,7 +30,10 @@ ia2AccessibleText::addSelection(long aStartOffset, long aEndOffset)
{
A11Y_TRYBLOCK_BEGIN
MOZ_ASSERT(!HyperTextProxyFor(this));
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->AddToSelection(aStartOffset, aEndOffset) ?
S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
@ -57,16 +60,21 @@ ia2AccessibleText::get_attributes(long aOffset, long *aStartOffset,
int32_t startOffset = 0, endOffset = 0;
HRESULT hr;
MOZ_ASSERT(!HyperTextProxyFor(this));
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) {
return CO_E_OBJNOTCONNECTED;
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
AutoTArray<Attribute, 10> attrs;
proxy->TextAttributes(true, aOffset, &attrs, &startOffset, &endOffset);
hr = AccessibleWrap::ConvertToIA2Attributes(&attrs, aTextAttributes);
} else {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
nsCOMPtr<nsIPersistentProperties> attributes =
textAcc->TextAttributes(true, aOffset, &startOffset, &endOffset);
hr = AccessibleWrap::ConvertToIA2Attributes(attributes, aTextAttributes);
}
nsCOMPtr<nsIPersistentProperties> attributes =
textAcc->TextAttributes(true, aOffset, &startOffset, &endOffset);
hr = AccessibleWrap::ConvertToIA2Attributes(attributes, aTextAttributes);
if (FAILED(hr))
return hr;
@ -88,13 +96,15 @@ ia2AccessibleText::get_caretOffset(long *aOffset)
*aOffset = -1;
MOZ_ASSERT(!HyperTextProxyFor(this));
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) {
return CO_E_OBJNOTCONNECTED;
}
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
*aOffset = proxy->CaretOffset();
} else {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
*aOffset = textAcc->CaretOffset();
*aOffset = textAcc->CaretOffset();
}
return *aOffset != -1 ? S_OK : S_FALSE;
@ -117,12 +127,15 @@ ia2AccessibleText::get_characterExtents(long aOffset,
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
nsIntRect rect;
MOZ_ASSERT(!HyperTextProxyFor(this));
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
rect = proxy->CharBounds(aOffset, geckoCoordType);
} else {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
rect = textAcc->CharBounds(aOffset, geckoCoordType);
rect = textAcc->CharBounds(aOffset, geckoCoordType);
}
*aX = rect.x;
*aY = rect.y;
@ -142,13 +155,15 @@ ia2AccessibleText::get_nSelections(long* aNSelections)
return E_INVALIDARG;
*aNSelections = 0;
MOZ_ASSERT(!HyperTextProxyFor(this));
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) {
return CO_E_OBJNOTCONNECTED;
}
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
*aNSelections = proxy->SelectionCount();
} else {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
*aNSelections = textAcc->SelectionCount();
*aNSelections = textAcc->SelectionCount();
}
return S_OK;
@ -170,13 +185,15 @@ ia2AccessibleText::get_offsetAtPoint(long aX, long aY,
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
MOZ_ASSERT(!HyperTextProxyFor(this));
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) {
return CO_E_OBJNOTCONNECTED;
}
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
*aOffset = proxy->OffsetAtPoint(aX, aY, geckoCoordType);
} else {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
*aOffset = textAcc->OffsetAtPoint(aX, aY, geckoCoordType);
*aOffset = textAcc->OffsetAtPoint(aX, aY, geckoCoordType);
}
return *aOffset == -1 ? S_FALSE : S_OK;
@ -194,14 +211,18 @@ ia2AccessibleText::get_selection(long aSelectionIndex, long* aStartOffset,
*aStartOffset = *aEndOffset = 0;
int32_t startOffset = 0, endOffset = 0;
MOZ_ASSERT(!HyperTextProxyFor(this));
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) {
return CO_E_OBJNOTCONNECTED;
}
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
nsString unused;
if (!proxy->SelectionBoundsAt(aSelectionIndex, unused, &startOffset,
&endOffset))
return E_INVALIDARG;
} else {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
if (!textAcc->SelectionBoundsAt(aSelectionIndex, &startOffset, &endOffset)) {
return E_INVALIDARG;
if (!textAcc->SelectionBoundsAt(aSelectionIndex, &startOffset, &endOffset))
return E_INVALIDARG;
}
*aStartOffset = startOffset;
@ -222,17 +243,20 @@ ia2AccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR* aText)
*aText = nullptr;
nsAutoString text;
MOZ_ASSERT(!HyperTextProxyFor(this));
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct()) {
return CO_E_OBJNOTCONNECTED;
}
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
if (!proxy->TextSubstring(aStartOffset, aEndOffset, text)) {
return E_INVALIDARG;
}
} else {
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
if (!textAcc->IsValidRange(aStartOffset, aEndOffset)) {
return E_INVALIDARG;
}
if (!textAcc->IsValidRange(aStartOffset, aEndOffset))
return E_INVALIDARG;
textAcc->TextSubstring(aStartOffset, aEndOffset, text);
textAcc->TextSubstring(aStartOffset, aEndOffset, text);
}
if (text.IsEmpty())
return S_FALSE;
@ -390,7 +414,9 @@ ia2AccessibleText::removeSelection(long aSelectionIndex)
{
A11Y_TRYBLOCK_BEGIN
MOZ_ASSERT(!HyperTextProxyFor(this));
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->RemoveFromSelection(aSelectionIndex) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
@ -407,7 +433,10 @@ ia2AccessibleText::setCaretOffset(long aOffset)
{
A11Y_TRYBLOCK_BEGIN
MOZ_ASSERT(!HyperTextProxyFor(this));
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
proxy->SetCaretOffset(aOffset);
return S_OK;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
@ -428,7 +457,10 @@ ia2AccessibleText::setSelection(long aSelectionIndex, long aStartOffset,
{
A11Y_TRYBLOCK_BEGIN
MOZ_ASSERT(!HyperTextProxyFor(this));
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
return proxy->SetSelectionBoundsAt(aSelectionIndex, aStartOffset,
aEndOffset) ? S_OK : E_INVALIDARG;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
@ -449,7 +481,10 @@ ia2AccessibleText::get_nCharacters(long* aNCharacters)
return E_INVALIDARG;
*aNCharacters = 0;
MOZ_ASSERT(!HyperTextProxyFor(this));
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
*aNCharacters = proxy->CharacterCount();
return S_OK;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
@ -467,7 +502,10 @@ ia2AccessibleText::scrollSubstringTo(long aStartIndex, long aEndIndex,
{
A11Y_TRYBLOCK_BEGIN
MOZ_ASSERT(!HyperTextProxyFor(this));
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
proxy->ScrollSubstringTo(aStartIndex, aEndIndex, aScrollType);
return S_OK;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())
@ -493,7 +531,11 @@ ia2AccessibleText::scrollSubstringToPoint(long aStartIndex, long aEndIndex,
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
MOZ_ASSERT(!HyperTextProxyFor(this));
if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
proxy->ScrollSubstringToPoint(aStartIndex, aEndIndex, geckoCoordType, aX,
aY);
return S_OK;
}
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (textAcc->IsDefunct())

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

@ -55,12 +55,14 @@ ia2AccessibleValue::get_currentValue(VARIANT* aCurrentValue)
AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this);
double currentValue;
MOZ_ASSERT(!valueAcc->IsProxy());
if (valueAcc->IsDefunct()) {
return CO_E_OBJNOTCONNECTED;
}
if (valueAcc->IsProxy()) {
currentValue = valueAcc->Proxy()->CurValue();
} else {
if (valueAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
currentValue = valueAcc->CurValue();
currentValue = valueAcc->CurValue();
}
if (IsNaN(currentValue))
return S_FALSE;
@ -81,7 +83,8 @@ ia2AccessibleValue::setCurrentValue(VARIANT aValue)
return E_INVALIDARG;
AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this);
MOZ_ASSERT(!valueAcc->IsProxy());
if (valueAcc->IsProxy())
return valueAcc->Proxy()->SetCurValue(aValue.dblVal) ? S_OK : E_FAIL;
if (valueAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -103,12 +106,14 @@ ia2AccessibleValue::get_maximumValue(VARIANT* aMaximumValue)
AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this);
double maximumValue;
MOZ_ASSERT(!valueAcc->IsProxy());
if (valueAcc->IsDefunct()) {
return CO_E_OBJNOTCONNECTED;
}
if (valueAcc->IsProxy()) {
maximumValue = valueAcc->Proxy()->MaxValue();
} else {
if (valueAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
maximumValue = valueAcc->MaxValue();
maximumValue = valueAcc->MaxValue();
}
if (IsNaN(maximumValue))
return S_FALSE;
@ -132,12 +137,14 @@ ia2AccessibleValue::get_minimumValue(VARIANT* aMinimumValue)
AccessibleWrap* valueAcc = static_cast<AccessibleWrap*>(this);
double minimumValue;
MOZ_ASSERT(!valueAcc->IsProxy());
if (valueAcc->IsDefunct()) {
return CO_E_OBJNOTCONNECTED;
}
if (valueAcc->IsProxy()) {
minimumValue = valueAcc->Proxy()->MinValue();
} else {
if (valueAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
minimumValue = valueAcc->MinValue();
minimumValue = valueAcc->MinValue();
}
if (IsNaN(minimumValue))
return S_FALSE;

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

@ -187,6 +187,16 @@ AccessibleWrap::get_accParent( IDispatch __RPC_FAR *__RPC_FAR *ppdispParent)
if (IsDefunct())
return CO_E_OBJNOTCONNECTED;
if (IsProxy()) {
ProxyAccessible* proxy = Proxy();
ProxyAccessible* parent = proxy->Parent();
if (!parent)
return S_FALSE;
*ppdispParent = NativeAccessible(WrapperFor(parent));
return S_OK;
}
DocAccessible* doc = AsDoc();
if (doc) {
// Return window system accessible object for root document and tab document
@ -226,6 +236,15 @@ AccessibleWrap::get_accChildCount( long __RPC_FAR *pcountChildren)
if (IsDefunct())
return CO_E_OBJNOTCONNECTED;
if (IsProxy()) {
ProxyAccessible* proxy = Proxy();
if (proxy->MustPruneChildren())
return S_OK;
*pcountChildren = proxy->ChildrenCount();
return S_OK;
}
if (nsAccUtils::MustPrune(this))
return S_OK;
@ -290,7 +309,10 @@ AccessibleWrap::get_accName(
return CO_E_OBJNOTCONNECTED;
nsAutoString name;
xpAccessible->Name(name);
if (xpAccessible->IsProxy())
xpAccessible->Proxy()->Name(name);
else
xpAccessible->Name(name);
// The name was not provided, e.g. no alt attribute for an image. A screen
// reader may choose to invent its own accessible name, e.g. from an image src
@ -329,6 +351,10 @@ AccessibleWrap::get_accValue(
if (xpAccessible->IsDefunct())
return CO_E_OBJNOTCONNECTED;
// TODO make this work with proxies.
if (IsProxy())
return E_NOTIMPL;
nsAutoString value;
xpAccessible->Value(value);
@ -368,7 +394,10 @@ AccessibleWrap::get_accDescription(VARIANT varChild,
return CO_E_OBJNOTCONNECTED;
nsAutoString description;
xpAccessible->Description(description);
if (IsProxy())
xpAccessible->Proxy()->Description(description);
else
xpAccessible->Description(description);
*pszDescription = ::SysAllocStringLen(description.get(),
description.Length());
@ -400,12 +429,16 @@ AccessibleWrap::get_accRole(
return CO_E_OBJNOTCONNECTED;
a11y::role geckoRole;
if (xpAccessible->IsProxy()) {
geckoRole = xpAccessible->Proxy()->Role();
} else {
#ifdef DEBUG
NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(xpAccessible),
"Does not support Text when it should");
NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(xpAccessible),
"Does not support Text when it should");
#endif
geckoRole = xpAccessible->Role();
geckoRole = xpAccessible->Role();
}
uint32_t msaaRole = 0;
@ -426,12 +459,18 @@ AccessibleWrap::get_accRole(
// Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call the MSAA role
// a ROLE_OUTLINEITEM for consistency and compatibility.
// We need this because ARIA has a role of "row" for both grid and treegrid
if (geckoRole == roles::ROW) {
Accessible* xpParent = Parent();
if (xpParent && xpParent->Role() == roles::TREE_TABLE)
msaaRole = ROLE_SYSTEM_OUTLINEITEM;
if (xpAccessible->IsProxy()) {
if (geckoRole == roles::ROW
&& xpAccessible->Proxy()->Parent()->Role() == roles::TREE_TABLE)
msaaRole = ROLE_SYSTEM_OUTLINEITEM;
} else {
if (geckoRole == roles::ROW) {
Accessible* xpParent = Parent();
if (xpParent && xpParent->Role() == roles::TREE_TABLE)
msaaRole = ROLE_SYSTEM_OUTLINEITEM;
}
}
// -- Try enumerated role
if (msaaRole != USE_ROLE_STRING) {
pvarRole->vt = VT_I4;
@ -439,6 +478,10 @@ AccessibleWrap::get_accRole(
return S_OK;
}
// XXX bug 798492 make this work with proxies?
if (IsProxy())
return E_FAIL;
// -- Try BSTR role
// Could not map to known enumerated MSAA role like ROLE_BUTTON
// Use BSTR role to expose role attribute or tag name + namespace
@ -509,7 +552,11 @@ AccessibleWrap::get_accState(
// INVALID -> ALERT_HIGH
// CHECKABLE -> MARQUEED
uint64_t state = State();
uint64_t state;
if (xpAccessible->IsProxy())
state = xpAccessible->Proxy()->State();
else
state = State();
uint32_t msaaState = 0;
nsAccUtils::To32States(state, &msaaState, nullptr);
@ -575,6 +622,10 @@ AccessibleWrap::get_accKeyboardShortcut(
if (acc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
// TODO make this work with proxies.
if (acc->IsProxy())
return E_NOTIMPL;
KeyBinding keyBinding = acc->AccessKey();
if (keyBinding.IsEmpty())
keyBinding = acc->KeyboardShortcut();
@ -610,7 +661,13 @@ AccessibleWrap::get_accFocus(
return CO_E_OBJNOTCONNECTED;
// Return the current IAccessible child that has focus
Accessible* focusedAccessible = FocusedChild();
Accessible* focusedAccessible;
if (IsProxy()) {
ProxyAccessible* proxy = Proxy()->FocusedChild();
focusedAccessible = proxy ? WrapperFor(proxy) : nullptr;
} else {
focusedAccessible = FocusedChild();
}
if (focusedAccessible == this) {
pvarChild->vt = VT_I4;
@ -772,9 +829,23 @@ AccessibleWrap::get_accSelection(VARIANT __RPC_FAR *pvarChildren)
if (IsDefunct())
return CO_E_OBJNOTCONNECTED;
// TODO make this work with proxies.
if (IsProxy())
return E_NOTIMPL;
if (IsSelect()) {
AutoTArray<Accessible*, 10> selectedItems;
SelectedItems(&selectedItems);
if (IsProxy()) {
nsTArray<ProxyAccessible*> proxies;
Proxy()->SelectedItems(&proxies);
uint32_t selectedCount = proxies.Length();
for (uint32_t i = 0; i < selectedCount; i++) {
selectedItems.AppendElement(WrapperFor(proxies[i]));
}
} else {
SelectedItems(&selectedItems);
}
// 1) Create and initialize the enumeration
RefPtr<AccessibleEnumerator> pEnum = new AccessibleEnumerator(selectedItems);
@ -809,7 +880,11 @@ AccessibleWrap::get_accDefaultAction(
return CO_E_OBJNOTCONNECTED;
nsAutoString defaultAction;
xpAccessible->ActionNameAt(0, defaultAction);
if (xpAccessible->IsProxy()) {
xpAccessible->Proxy()->ActionNameAt(0, defaultAction);
} else {
xpAccessible->ActionNameAt(0, defaultAction);
}
*pszDefaultAction = ::SysAllocStringLen(defaultAction.get(),
defaultAction.Length());
@ -837,22 +912,42 @@ AccessibleWrap::accSelect(
return CO_E_OBJNOTCONNECTED;
if (flagsSelect & SELFLAG_TAKEFOCUS) {
xpAccessible->TakeFocus();
if (xpAccessible->IsProxy()) {
xpAccessible->Proxy()->TakeFocus();
} else {
xpAccessible->TakeFocus();
}
return S_OK;
}
if (flagsSelect & SELFLAG_TAKESELECTION) {
xpAccessible->TakeSelection();
if (xpAccessible->IsProxy()) {
xpAccessible->Proxy()->TakeSelection();
} else {
xpAccessible->TakeSelection();
}
return S_OK;
}
if (flagsSelect & SELFLAG_ADDSELECTION) {
xpAccessible->SetSelected(true);
if (xpAccessible->IsProxy()) {
xpAccessible->Proxy()->SetSelected(true);
} else {
xpAccessible->SetSelected(true);
}
return S_OK;
}
if (flagsSelect & SELFLAG_REMOVESELECTION) {
xpAccessible->SetSelected(false);
if (xpAccessible->IsProxy()) {
xpAccessible->Proxy()->SetSelected(false);
} else {
xpAccessible->SetSelected(false);
}
return S_OK;
}
@ -889,7 +984,12 @@ AccessibleWrap::accLocation(
if (xpAccessible->IsDefunct())
return CO_E_OBJNOTCONNECTED;
nsIntRect rect = xpAccessible->Bounds();
nsIntRect rect;
if (xpAccessible->IsProxy()) {
rect = xpAccessible->Proxy()->Bounds();
} else {
rect = xpAccessible->Bounds();
}
*pxLeft = rect.x;
*pyTop = rect.y;
@ -923,22 +1023,6 @@ AccessibleWrap::accNavigate(
if (accessible->IsDefunct())
return CO_E_OBJNOTCONNECTED;
// Make sure that varStart != CHILDID_SELF so we don't infinitely recurse
if (accessible->IsProxy() && varStart.vt == VT_I4 &&
varStart.lVal != CHILDID_SELF) {
// Now that we have the starting object, delegate this request to that
// object as a self-relative request...
RefPtr<IAccessible> comProxy;
accessible->GetNativeInterface((void**) getter_AddRefs(comProxy));
if (!comProxy) {
return E_UNEXPECTED;
}
VARIANT selfChildId;
selfChildId.vt = VT_I4;
selfChildId.lVal = CHILDID_SELF;
return comProxy->accNavigate(navDir, selfChildId, pvarEndUpAt);
}
Accessible* navAccessible = nullptr;
Maybe<RelationType> xpRelation;
@ -996,8 +1080,16 @@ AccessibleWrap::accNavigate(
pvarEndUpAt->vt = VT_EMPTY;
if (xpRelation) {
Relation rel = RelationByType(*xpRelation);
navAccessible = rel.Next();
if (accessible->IsProxy()) {
nsTArray<ProxyAccessible*> targets =
accessible->Proxy()->RelationByType(*xpRelation);
if (targets.Length()) {
navAccessible = WrapperFor(targets[0]);
}
} else {
Relation rel = RelationByType(*xpRelation);
navAccessible = rel.Next();
}
}
if (!navAccessible)
@ -1026,7 +1118,15 @@ AccessibleWrap::accHitTest(
if (IsDefunct())
return CO_E_OBJNOTCONNECTED;
Accessible* accessible = ChildAtPoint(xLeft, yTop, eDirectChild);
Accessible* accessible = nullptr;
if (IsProxy()) {
ProxyAccessible* proxy = Proxy()->ChildAtPoint(xLeft, yTop, eDirectChild);
if (proxy) {
accessible = WrapperFor(proxy);
}
} else {
accessible = ChildAtPoint(xLeft, yTop, eDirectChild);
}
// if we got a child
if (accessible) {
@ -1064,6 +1164,10 @@ AccessibleWrap::accDoDefaultAction(
if (xpAccessible->IsDefunct())
return CO_E_OBJNOTCONNECTED;
// TODO make this work with proxies.
if (xpAccessible->IsProxy())
return xpAccessible->Proxy()->DoAction(0) ? S_OK : E_INVALIDARG;
return xpAccessible->DoAction(0) ? S_OK : E_INVALIDARG;
A11Y_TRYBLOCK_END

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

@ -7,7 +7,6 @@
#include "DocAccessibleWrap.h"
#include "Compatibility.h"
#include "DocAccessibleChild.h"
#include "nsWinUtils.h"
#include "mozilla/dom/TabChild.h"
#include "Role.h"
@ -44,31 +43,6 @@ IMPL_IUNKNOWN_QUERY_HEAD(DocAccessibleWrap)
}
IMPL_IUNKNOWN_QUERY_TAIL_INHERITED(HyperTextAccessibleWrap)
STDMETHODIMP
DocAccessibleWrap::get_accParent(
/* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispParent)
{
HRESULT hr = DocAccessible::get_accParent(ppdispParent);
if (*ppdispParent) {
return hr;
}
// We might be a top-level document in a content process.
DocAccessibleChild* ipcDoc = IPCDoc();
if (!ipcDoc) {
return S_FALSE;
}
IAccessible* dispParent = ipcDoc->GetParentIAccessible();
MOZ_ASSERT(dispParent);
if (!dispParent) {
return E_UNEXPECTED;
}
dispParent->AddRef();
*ppdispParent = static_cast<IDispatch*>(dispParent);
return S_OK;
}
STDMETHODIMP
DocAccessibleWrap::get_accValue(VARIANT aVarChild, BSTR __RPC_FAR* aValue)
{

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

@ -22,14 +22,10 @@ public:
// IAccessible
// Override get_accParent for e10s
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accParent(
/* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispParent) override;
// Override get_accValue to provide URL when no other value is available
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accValue(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ BSTR __RPC_FAR *pszValue) override;
// Override get_accValue to provide URL when no other value is available
virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accValue(
/* [optional][in] */ VARIANT varChild,
/* [retval][out] */ BSTR __RPC_FAR *pszValue);
// Accessible
virtual void Shutdown();

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

@ -10,21 +10,12 @@
#include "Compatibility.h"
#include "HyperTextAccessibleWrap.h"
#include "ia2AccessibleText.h"
#include "nsIXULRuntime.h"
#include "nsWinUtils.h"
#include "mozilla/a11y/ProxyAccessible.h"
#include "mozilla/mscom/InterceptorLog.h"
#include "mozilla/mscom/Registration.h"
#include "mozilla/StaticPtr.h"
#include "ProxyWrappers.h"
using namespace mozilla;
using namespace mozilla::a11y;
using namespace mozilla::mscom;
static StaticAutoPtr<RegisteredProxy> gRegProxy;
static StaticAutoPtr<RegisteredProxy> gRegAccTlb;
static StaticAutoPtr<RegisteredProxy> gRegMiscTlb;
void
a11y::PlatformInit()
@ -33,19 +24,6 @@ a11y::PlatformInit()
nsWinUtils::MaybeStartWindowEmulation();
ia2AccessibleText::InitTextChangeData();
if (BrowserTabsRemoteAutostart()) {
mscom::InterceptorLog::Init();
UniquePtr<RegisteredProxy> regProxy(
mscom::RegisterProxy(L"ia2marshal.dll"));
gRegProxy = regProxy.release();
UniquePtr<RegisteredProxy> regAccTlb(
mscom::RegisterTypelib(L"oleacc.dll",
RegistrationFlags::eUseSystemDirectory));
gRegAccTlb = regAccTlb.release();
UniquePtr<RegisteredProxy> regMiscTlb(
mscom::RegisterTypelib(L"Accessible.tlb"));
gRegMiscTlb = regMiscTlb.release();
}
}
void
@ -54,9 +32,6 @@ a11y::PlatformShutdown()
::DestroyCaret();
nsWinUtils::ShutdownWindowEmulation();
gRegProxy = nullptr;
gRegAccTlb = nullptr;
gRegMiscTlb = nullptr;
}
void

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

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

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

@ -195,9 +195,6 @@ xpcAccessible::GetDOMNode(nsIDOMNode** aDOMNode)
NS_IMETHODIMP
xpcAccessible::GetId(nsAString& aID)
{
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
ProxyAccessible* proxy = IntlGeneric().AsProxy();
if (!proxy) {
return NS_ERROR_FAILURE;
@ -208,7 +205,6 @@ xpcAccessible::GetId(nsAString& aID)
aID.Assign(id);
return NS_OK;
#endif
}
NS_IMETHODIMP
@ -482,16 +478,12 @@ xpcAccessible::GetRelationByType(uint32_t aType,
return NS_OK;
}
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
ProxyAccessible* proxy = IntlGeneric().AsProxy();
nsTArray<ProxyAccessible*> targets =
proxy->RelationByType(static_cast<RelationType>(aType));
NS_ADDREF(*aRelation = new nsAccessibleRelation(aType, &targets));
return NS_OK;
#endif
}
NS_IMETHODIMP

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

@ -96,7 +96,6 @@ private:
friend class DocManager;
friend class DocAccessible;
friend class ProxyAccessible;
friend class ProxyAccessibleBase<ProxyAccessible>;
xpcAccessibleDocument(const xpcAccessibleDocument&) = delete;
xpcAccessibleDocument& operator =(const xpcAccessibleDocument&) = delete;

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

@ -21,17 +21,13 @@ xpcAccessibleHyperLink::GetStartIndex(int32_t* aStartIndex)
if (Intl().IsAccessible()) {
*aStartIndex = Intl().AsAccessible()->StartOffset();
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
} else {
bool isIndexValid = false;
uint32_t startOffset = Intl().AsProxy()->StartOffset(&isIndexValid);
if (!isIndexValid)
return NS_ERROR_FAILURE;
*aStartIndex = startOffset;
#endif
}
return NS_OK;
@ -48,17 +44,13 @@ xpcAccessibleHyperLink::GetEndIndex(int32_t* aEndIndex)
if (Intl().IsAccessible()) {
*aEndIndex = Intl().AsAccessible()->EndOffset();
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
} else {
bool isIndexValid = false;
uint32_t endOffset = Intl().AsProxy()->EndOffset(&isIndexValid);
if (!isIndexValid)
return NS_ERROR_FAILURE;
*aEndIndex = endOffset;
#endif
}
return NS_OK;
@ -75,17 +67,13 @@ xpcAccessibleHyperLink::GetAnchorCount(int32_t* aAnchorCount)
if (Intl().IsAccessible()) {
*aAnchorCount = Intl().AsAccessible()->AnchorCount();
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
} else {
bool isCountValid = false;
uint32_t anchorCount = Intl().AsProxy()->AnchorCount(&isCountValid);
if (!isCountValid)
return NS_ERROR_FAILURE;
*aAnchorCount = anchorCount;
#endif
}
return NS_OK;
@ -108,9 +96,6 @@ xpcAccessibleHyperLink::GetURI(int32_t aIndex, nsIURI** aURI)
RefPtr<nsIURI>(Intl().AsAccessible()->AnchorURIAt(aIndex)).forget(aURI);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
nsCString spec;
bool isURIValid = false;
Intl().AsProxy()->AnchorURIAt(aIndex, spec, &isURIValid);
@ -122,7 +107,6 @@ xpcAccessibleHyperLink::GetURI(int32_t aIndex, nsIURI** aURI)
NS_ENSURE_SUCCESS(rv, rv);
uri.forget(aURI);
#endif
}
return NS_OK;
@ -147,11 +131,7 @@ xpcAccessibleHyperLink::GetAnchor(int32_t aIndex, nsIAccessible** aAccessible)
NS_IF_ADDREF(*aAccessible = ToXPC(Intl().AsAccessible()->AnchorAt(aIndex)));
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
NS_IF_ADDREF(*aAccessible = ToXPC(Intl().AsProxy()->AnchorAt(aIndex)));
#endif
}
return NS_OK;
@ -169,11 +149,7 @@ xpcAccessibleHyperLink::GetValid(bool* aValid)
if (Intl().IsAccessible()) {
*aValid = Intl().AsAccessible()->IsLinkValid();
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
*aValid = Intl().AsProxy()->IsLinkValid();
#endif
}
return NS_OK;

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

@ -47,11 +47,7 @@ xpcAccessibleHyperText::GetCharacterCount(int32_t* aCharacterCount)
if (mIntl.IsAccessible()) {
*aCharacterCount = Intl()->CharacterCount();
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
*aCharacterCount = mIntl.AsProxy()->CharacterCount();
#endif
}
return NS_OK;
}
@ -68,13 +64,9 @@ xpcAccessibleHyperText::GetText(int32_t aStartOffset, int32_t aEndOffset,
if (mIntl.IsAccessible()) {
Intl()->TextSubstring(aStartOffset, aEndOffset, aText);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
nsString text;
mIntl.AsProxy()->TextSubstring(aStartOffset, aEndOffset, text);
aText = text;
#endif
}
return NS_OK;
}
@ -98,14 +90,10 @@ xpcAccessibleHyperText::GetTextBeforeOffset(int32_t aOffset,
Intl()->TextBeforeOffset(aOffset, aBoundaryType, aStartOffset, aEndOffset,
aText);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
nsString text;
mIntl.AsProxy()->GetTextBeforeOffset(aOffset, aBoundaryType, text,
aStartOffset, aEndOffset);
aText = text;
#endif
}
return NS_OK;
}
@ -128,14 +116,10 @@ xpcAccessibleHyperText::GetTextAtOffset(int32_t aOffset,
Intl()->TextAtOffset(aOffset, aBoundaryType, aStartOffset, aEndOffset,
aText);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
nsString text;
mIntl.AsProxy()->GetTextAtOffset(aOffset, aBoundaryType, text,
aStartOffset, aEndOffset);
aText = text;
#endif
}
return NS_OK;
}
@ -158,14 +142,10 @@ xpcAccessibleHyperText::GetTextAfterOffset(int32_t aOffset,
Intl()->TextAfterOffset(aOffset, aBoundaryType, aStartOffset, aEndOffset,
aText);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
nsString text;
mIntl.AsProxy()->GetTextAfterOffset(aOffset, aBoundaryType, text,
aStartOffset, aEndOffset);
aText = text;
#endif
}
return NS_OK;
}
@ -183,11 +163,7 @@ xpcAccessibleHyperText::GetCharacterAtOffset(int32_t aOffset,
if (mIntl.IsAccessible()) {
*aCharacter = Intl()->CharAt(aOffset);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
*aCharacter = mIntl.AsProxy()->CharAt(aOffset);
#endif
}
return NS_OK;
}
@ -213,9 +189,6 @@ xpcAccessibleHyperText::GetTextAttributes(bool aIncludeDefAttrs,
props = Intl()->TextAttributes(aIncludeDefAttrs, aOffset, aStartOffset,
aEndOffset);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
AutoTArray<Attribute, 10> attrs;
mIntl.AsProxy()->TextAttributes(aIncludeDefAttrs, aOffset, &attrs,
aStartOffset, aEndOffset);
@ -224,7 +197,6 @@ xpcAccessibleHyperText::GetTextAttributes(bool aIncludeDefAttrs,
for (uint32_t i = 0; i < attrCount; i++) {
props->SetStringProperty(attrs[i].Name(), attrs[i].Value(), unused);
}
#endif
}
props.forget(aAttributes);
@ -244,9 +216,6 @@ xpcAccessibleHyperText::GetDefaultTextAttributes(nsIPersistentProperties** aAttr
if (mIntl.IsAccessible()) {
props = Intl()->DefaultTextAttributes();
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
AutoTArray<Attribute, 10> attrs;
mIntl.AsProxy()->DefaultTextAttributes(&attrs);
uint32_t attrCount = attrs.Length();
@ -254,7 +223,6 @@ xpcAccessibleHyperText::GetDefaultTextAttributes(nsIPersistentProperties** aAttr
for (uint32_t i = 0; i < attrCount; i++) {
props->SetStringProperty(attrs[i].Name(), attrs[i].Value(), unused);
}
#endif
}
props.forget(aAttributes);
@ -280,11 +248,7 @@ xpcAccessibleHyperText::GetCharacterExtents(int32_t aOffset,
if (mIntl.IsAccessible()) {
rect = Intl()->CharBounds(aOffset, aCoordType);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
rect = mIntl.AsProxy()->CharBounds(aOffset, aCoordType);
#endif
}
*aX = rect.x; *aY = rect.y;
*aWidth = rect.width; *aHeight = rect.height;
@ -310,11 +274,7 @@ xpcAccessibleHyperText::GetRangeExtents(int32_t aStartOffset, int32_t aEndOffset
if (mIntl.IsAccessible()) {
rect = Intl()->TextBounds(aStartOffset, aEndOffset, aCoordType);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
rect = mIntl.AsProxy()->TextBounds(aStartOffset, aEndOffset, aCoordType);
#endif
}
*aX = rect.x; *aY = rect.y;
*aWidth = rect.width; *aHeight = rect.height;
@ -334,11 +294,7 @@ xpcAccessibleHyperText::GetOffsetAtPoint(int32_t aX, int32_t aY,
if (mIntl.IsAccessible()) {
*aOffset = Intl()->OffsetAtPoint(aX, aY, aCoordType);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
*aOffset = mIntl.AsProxy()->OffsetAtPoint(aX, aY, aCoordType);
#endif
}
return NS_OK;
}
@ -355,11 +311,7 @@ xpcAccessibleHyperText::GetCaretOffset(int32_t* aCaretOffset)
if (mIntl.IsAccessible()) {
*aCaretOffset = Intl()->CaretOffset();
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
*aCaretOffset = mIntl.AsProxy()->CaretOffset();
#endif
}
return NS_OK;
}
@ -373,11 +325,7 @@ xpcAccessibleHyperText::SetCaretOffset(int32_t aCaretOffset)
if (mIntl.IsAccessible()) {
Intl()->SetCaretOffset(aCaretOffset);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
mIntl.AsProxy()->SetCaretOffset(aCaretOffset);
#endif
}
return NS_OK;
}
@ -394,11 +342,7 @@ xpcAccessibleHyperText::GetSelectionCount(int32_t* aSelectionCount)
if (mIntl.IsAccessible()) {
*aSelectionCount = Intl()->SelectionCount();
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
*aSelectionCount = mIntl.AsProxy()->SelectionCount();
#endif
}
return NS_OK;
}
@ -424,13 +368,9 @@ xpcAccessibleHyperText::GetSelectionBounds(int32_t aSelectionNum,
Intl()->SelectionBoundsAt(aSelectionNum, aStartOffset, aEndOffset);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
nsString unused;
mIntl.AsProxy()->SelectionBoundsAt(aSelectionNum, unused, aStartOffset,
aEndOffset);
#endif
}
return NS_OK;
}
@ -452,14 +392,10 @@ xpcAccessibleHyperText::SetSelectionBounds(int32_t aSelectionNum,
return NS_ERROR_INVALID_ARG;
}
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
if (!mIntl.AsProxy()->SetSelectionBoundsAt(aSelectionNum, aStartOffset,
aEndOffset)) {
return NS_ERROR_INVALID_ARG;
}
#endif
}
return NS_OK;
}
@ -473,11 +409,7 @@ xpcAccessibleHyperText::AddSelection(int32_t aStartOffset, int32_t aEndOffset)
if (mIntl.IsAccessible()) {
Intl()->AddToSelection(aStartOffset, aEndOffset);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
mIntl.AsProxy()->AddToSelection(aStartOffset, aEndOffset);
#endif
}
return NS_OK;
}
@ -491,11 +423,7 @@ xpcAccessibleHyperText::RemoveSelection(int32_t aSelectionNum)
if (mIntl.IsAccessible()) {
Intl()->RemoveFromSelection(aSelectionNum);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
mIntl.AsProxy()->RemoveFromSelection(aSelectionNum);
#endif
}
return NS_OK;
}
@ -511,11 +439,7 @@ xpcAccessibleHyperText::ScrollSubstringTo(int32_t aStartOffset,
if (mIntl.IsAccessible()) {
Intl()->ScrollSubstringTo(aStartOffset, aEndOffset, aScrollType);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
mIntl.AsProxy()->ScrollSubstringTo(aStartOffset, aEndOffset, aScrollType);
#endif
}
return NS_OK;
}
@ -533,12 +457,8 @@ xpcAccessibleHyperText::ScrollSubstringToPoint(int32_t aStartOffset,
Intl()->ScrollSubstringToPoint(aStartOffset, aEndOffset, aCoordinateType,
aX, aY);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
mIntl.AsProxy()->ScrollSubstringToPoint(aStartOffset, aEndOffset,
aCoordinateType, aX, aY);
#endif
}
return NS_OK;
}
@ -663,12 +583,8 @@ xpcAccessibleHyperText::SetTextContents(const nsAString& aText)
if (mIntl.IsAccessible()) {
Intl()->ReplaceText(aText);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
nsString text(aText);
mIntl.AsProxy()->ReplaceText(text);
#endif
}
return NS_OK;
}
@ -682,12 +598,8 @@ xpcAccessibleHyperText::InsertText(const nsAString& aText, int32_t aOffset)
if (mIntl.IsAccessible()) {
Intl()->InsertText(aText, aOffset);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
nsString text(aText);
mIntl.AsProxy()->InsertText(text, aOffset);
#endif
}
return NS_OK;
}
@ -701,11 +613,7 @@ xpcAccessibleHyperText::CopyText(int32_t aStartOffset, int32_t aEndOffset)
if (mIntl.IsAccessible()) {
Intl()->CopyText(aStartOffset, aEndOffset);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
mIntl.AsProxy()->CopyText(aStartOffset, aEndOffset);
#endif
}
return NS_OK;
}
@ -719,11 +627,7 @@ xpcAccessibleHyperText::CutText(int32_t aStartOffset, int32_t aEndOffset)
if (mIntl.IsAccessible()) {
Intl()->CutText(aStartOffset, aEndOffset);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
mIntl.AsProxy()->CutText(aStartOffset, aEndOffset);
#endif
}
return NS_OK;
}
@ -737,11 +641,7 @@ xpcAccessibleHyperText::DeleteText(int32_t aStartOffset, int32_t aEndOffset)
if (mIntl.IsAccessible()) {
Intl()->DeleteText(aStartOffset, aEndOffset);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
mIntl.AsProxy()->DeleteText(aStartOffset, aEndOffset);
#endif
}
return NS_OK;
}
@ -755,11 +655,7 @@ xpcAccessibleHyperText::PasteText(int32_t aOffset)
if (mIntl.IsAccessible()) {
Intl()->PasteText(aOffset);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
mIntl.AsProxy()->PasteText(aOffset);
#endif
}
return NS_OK;
}
@ -779,11 +675,7 @@ xpcAccessibleHyperText::GetLinkCount(int32_t* aLinkCount)
if (mIntl.IsAccessible()) {
*aLinkCount = Intl()->LinkCount();
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
*aLinkCount = mIntl.AsProxy()->LinkCount();
#endif
}
return NS_OK;
}
@ -800,11 +692,7 @@ xpcAccessibleHyperText::GetLinkAt(int32_t aIndex, nsIAccessibleHyperLink** aLink
if (mIntl.IsAccessible()) {
NS_IF_ADDREF(*aLink = ToXPC(Intl()->LinkAt(aIndex)));
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
NS_IF_ADDREF(*aLink = ToXPC(mIntl.AsProxy()->LinkAt(aIndex)));
#endif
}
return NS_OK;
}
@ -824,16 +712,12 @@ xpcAccessibleHyperText::GetLinkIndex(nsIAccessibleHyperLink* aLink,
if (Accessible* accLink = xpcLink->ToInternalAccessible()) {
*aIndex = Intl()->LinkIndexOf(accLink);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
xpcAccessibleHyperText* linkHyperText =
static_cast<xpcAccessibleHyperText*>(xpcLink.get());
ProxyAccessible* proxyLink = linkHyperText->mIntl.AsProxy();
if (proxyLink) {
*aIndex = mIntl.AsProxy()->LinkIndexOf(proxyLink);
}
#endif
}
return NS_OK;
@ -852,11 +736,7 @@ xpcAccessibleHyperText::GetLinkIndexAtOffset(int32_t aOffset,
if (mIntl.IsAccessible()) {
*aLinkIndex = Intl()->LinkIndexAtOffset(aOffset);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
*aLinkIndex = mIntl.AsProxy()->LinkIndexAtOffset(aOffset);
#endif
}
return NS_OK;
}

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

@ -25,12 +25,8 @@ xpcAccessibleValue::GetMaximumValue(double* aValue)
double value;
if (Intl().IsAccessible()) {
value = Intl().AsAccessible()->MaxValue();
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
} else {
value = Intl().AsProxy()->MaxValue();
#endif
}
if (!IsNaN(value))
@ -54,12 +50,8 @@ xpcAccessibleValue::GetMinimumValue(double* aValue)
double value;
if (Intl().IsAccessible()) {
value = Intl().AsAccessible()->MinValue();
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
} else {
value = Intl().AsProxy()->MinValue();
#endif
}
if (!IsNaN(value))
@ -83,12 +75,8 @@ xpcAccessibleValue::GetCurrentValue(double* aValue)
double value;
if (Intl().IsAccessible()) {
value = Intl().AsAccessible()->CurValue();
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
} else {
value = Intl().AsProxy()->CurValue();
#endif
}
if (!IsNaN(value))
@ -108,12 +96,8 @@ xpcAccessibleValue::SetCurrentValue(double aValue)
if (Intl().IsAccessible()) {
Intl().AsAccessible()->SetCurValue(aValue);
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
} else {
Intl().AsProxy()->SetCurValue(aValue);
#endif
}
return NS_OK;
@ -134,12 +118,8 @@ xpcAccessibleValue::GetMinimumIncrement(double* aValue)
double value;
if (Intl().IsAccessible()) {
value = Intl().AsAccessible()->Step();
} else {
#if defined(XP_WIN)
return NS_ERROR_NOT_IMPLEMENTED;
#else
} else {
value = Intl().AsProxy()->Step();
#endif
}
if (!IsNaN(value))

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

@ -153,7 +153,6 @@
@RESPATH@/components/alerts.xpt
#ifdef ACCESSIBILITY
#ifdef XP_WIN32
@BINPATH@/Accessible.tlb
@BINPATH@/AccessibleMarshal.dll
@BINPATH@/IA2Marshal.dll
#endif