Backed out 4 changesets (bug 1322532) for windows static build failures a=backout

Backed out changeset df4e3ee037d6 (bug 1322532)
Backed out changeset 0acfde7a7a45 (bug 1322532)
Backed out changeset 34bf061d8e29 (bug 1322532)
Backed out changeset 954ea82470ed (bug 1322532)
This commit is contained in:
Wes Kocher 2017-04-14 00:02:40 -07:00
Родитель 5afdefe075
Коммит 5c3c7eb8db
17 изменённых файлов: 52 добавлений и 743 удалений

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

@ -338,21 +338,6 @@ DocAccessibleParent::RecvTextChangeEvent(const uint64_t& aID,
return IPC_OK(); return IPC_OK();
} }
#if defined(XP_WIN)
mozilla::ipc::IPCResult
DocAccessibleParent::RecvSyncTextChangeEvent(const uint64_t& aID,
const nsString& aStr,
const int32_t& aStart,
const uint32_t& aLen,
const bool& aIsInsert,
const bool& aFromUser)
{
return RecvTextChangeEvent(aID, aStr, aStart, aLen, aIsInsert, aFromUser);
}
#endif // defined(XP_WIN)
mozilla::ipc::IPCResult mozilla::ipc::IPCResult
DocAccessibleParent::RecvSelectionEvent(const uint64_t& aID, DocAccessibleParent::RecvSelectionEvent(const uint64_t& aID,
const uint64_t& aWidgetID, const uint64_t& aWidgetID,

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

@ -88,13 +88,6 @@ public:
const bool& aIsInsert, const bool& aIsInsert,
const bool& aFromUser) override; const bool& aFromUser) override;
#if defined(XP_WIN)
virtual mozilla::ipc::IPCResult RecvSyncTextChangeEvent(const uint64_t& aID, const nsString& aStr,
const int32_t& aStart, const uint32_t& aLen,
const bool& aIsInsert,
const bool& aFromUser) override;
#endif // defined(XP_WIN)
virtual mozilla::ipc::IPCResult RecvSelectionEvent(const uint64_t& aID, virtual mozilla::ipc::IPCResult RecvSelectionEvent(const uint64_t& aID,
const uint64_t& aWidgetID, const uint64_t& aWidgetID,
const uint32_t& aType) override; const uint32_t& aType) override;

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

@ -77,18 +77,6 @@ DocAccessibleChild::RecvEmulatedWindow(const WindowsHandle& aEmulatedWindowHandl
return IPC_OK(); return IPC_OK();
} }
HWND
DocAccessibleChild::GetNativeWindowHandle() const
{
if (mEmulatedWindowHandle) {
return mEmulatedWindowHandle;
}
auto tab = static_cast<dom::TabChild*>(Manager());
MOZ_ASSERT(tab);
return reinterpret_cast<HWND>(tab->GetNativeWindowHandle());
}
void void
DocAccessibleChild::PushDeferredEvent(UniquePtr<DeferredEvent> aEvent) DocAccessibleChild::PushDeferredEvent(UniquePtr<DeferredEvent> aEvent)
{ {
@ -190,13 +178,6 @@ DocAccessibleChild::SendTextChangeEvent(const uint64_t& aID,
const bool& aFromUser) const bool& aFromUser)
{ {
if (IsConstructedInParentProcess()) { if (IsConstructedInParentProcess()) {
if (aStr.Contains(L'\xfffc')) {
// The AT is going to need to reenter content while the event is being
// dispatched synchronously.
return PDocAccessibleChild::SendSyncTextChangeEvent(aID, aStr, aStart,
aLen, aIsInsert,
aFromUser);
}
return PDocAccessibleChild::SendTextChangeEvent(aID, aStr, aStart, return PDocAccessibleChild::SendTextChangeEvent(aID, aStr, aStart,
aLen, aIsInsert, aFromUser); aLen, aIsInsert, aFromUser);
} }

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

@ -33,7 +33,7 @@ public:
RecvEmulatedWindow(const WindowsHandle& aEmulatedWindowHandle, RecvEmulatedWindow(const WindowsHandle& aEmulatedWindowHandle,
const IAccessibleHolder& aEmulatedWindowCOMProxy) override; const IAccessibleHolder& aEmulatedWindowCOMProxy) override;
HWND GetNativeWindowHandle() const; HWND GetEmulatedWindowHandle() const { return mEmulatedWindowHandle; }
IAccessible* GetEmulatedWindowIAccessible() const { return mEmulatedWindowProxy.get(); } IAccessible* GetEmulatedWindowIAccessible() const { return mEmulatedWindowProxy.get(); }
IAccessible* GetParentIAccessible() const { return mParentProxy.get(); } IAccessible* GetParentIAccessible() const { return mParentProxy.get(); }

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

@ -53,8 +53,6 @@ parent:
async CaretMoveEvent(uint64_t aID, int32_t aOffset); async CaretMoveEvent(uint64_t aID, int32_t aOffset);
async TextChangeEvent(uint64_t aID, nsString aStr, int32_t aStart, uint32_t aLen, async TextChangeEvent(uint64_t aID, nsString aStr, int32_t aStart, uint32_t aLen,
bool aIsInsert, bool aFromUser); bool aIsInsert, bool aFromUser);
sync SyncTextChangeEvent(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 SelectionEvent(uint64_t aID, uint64_t aWidgetID, uint32_t aType);
async RoleChangedEvent(uint32_t aRole); async RoleChangedEvent(uint32_t aRole);

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

@ -12,7 +12,6 @@
#include "AccessibleHandler.h" #include "AccessibleHandler.h"
#include "AccessibleHandlerControl.h" #include "AccessibleHandlerControl.h"
#include "AccessibleTextTearoff.h"
#include "Factory.h" #include "Factory.h"
#include "HandlerData.h" #include "HandlerData.h"
@ -184,12 +183,6 @@ AccessibleHandler::QueryHandlerInterface(IUnknown* aProxyUnknown, REFIID aIid,
return S_OK; return S_OK;
} }
if (aIid == IID_IAccessibleText || aIid == IID_IAccessibleHypertext) {
RefPtr<IAccessibleHypertext> textTearoff(new AccessibleTextTearoff(this));
textTearoff.forget(aOutInterface);
return S_OK;
}
if (aIid == IID_IProvideClassInfo) { if (aIid == IID_IProvideClassInfo) {
RefPtr<IProvideClassInfo> clsInfo(this); RefPtr<IProvideClassInfo> clsInfo(this);
clsInfo.forget(aOutInterface); clsInfo.forget(aOutInterface);

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

@ -22,103 +22,6 @@ namespace a11y {
mscom::SingletonFactory<AccessibleHandlerControl> gControlFactory; mscom::SingletonFactory<AccessibleHandlerControl> gControlFactory;
namespace detail {
TextChange::TextChange()
: mIA2UniqueId(0)
, mIsInsert(false)
, mText()
{
}
TextChange::TextChange(long aIA2UniqueId, bool aIsInsert,
NotNull<IA2TextSegment*> aText)
: mIA2UniqueId(aIA2UniqueId)
, mIsInsert(aIsInsert)
, mText{BSTRCopy(aText->text), aText->start, aText->end}
{
}
TextChange::TextChange(TextChange&& aOther)
: mText()
{
*this = Move(aOther);
}
TextChange::TextChange(const TextChange& aOther)
: mText()
{
*this = aOther;
}
TextChange&
TextChange::operator=(TextChange&& aOther)
{
mIA2UniqueId = aOther.mIA2UniqueId;
mIsInsert = aOther.mIsInsert;
aOther.mIA2UniqueId = 0;
::SysFreeString(mText.text);
mText = aOther.mText;
aOther.mText.text = nullptr;
return *this;
}
TextChange&
TextChange::operator=(const TextChange& aOther)
{
mIA2UniqueId = aOther.mIA2UniqueId;
mIsInsert = aOther.mIsInsert;
::SysFreeString(mText.text);
mText = {BSTRCopy(aOther.mText.text), aOther.mText.start, aOther.mText.end};
return *this;
}
TextChange::~TextChange()
{
::SysFreeString(mText.text);
}
HRESULT
TextChange::GetOld(long aIA2UniqueId, NotNull<IA2TextSegment*> aOutOldSegment)
{
if (mIsInsert || aIA2UniqueId != mIA2UniqueId) {
return S_OK;
}
return SegCopy(*aOutOldSegment, mText);
}
HRESULT
TextChange::GetNew(long aIA2UniqueId, NotNull<IA2TextSegment*> aOutNewSegment)
{
if (!mIsInsert || aIA2UniqueId != mIA2UniqueId) {
return S_OK;
}
return SegCopy(*aOutNewSegment, mText);
}
/* static */ BSTR
TextChange::BSTRCopy(const BSTR& aIn)
{
return ::SysAllocStringLen(aIn, ::SysStringLen(aIn));
}
/* static */ HRESULT
TextChange::SegCopy(IA2TextSegment& aDest, const IA2TextSegment& aSrc)
{
aDest = {BSTRCopy(aSrc.text), aSrc.start, aSrc.end};
if (aSrc.text && !aDest.text) {
return E_OUTOFMEMORY;
}
if (!::SysStringLen(aDest.text)) {
return S_FALSE;
}
return S_OK;
}
} // namespace detail
HRESULT HRESULT
AccessibleHandlerControl::Create(AccessibleHandlerControl** aOutObject) AccessibleHandlerControl::Create(AccessibleHandlerControl** aOutObject)
{ {
@ -132,14 +35,46 @@ AccessibleHandlerControl::Create(AccessibleHandlerControl** aOutObject)
} }
AccessibleHandlerControl::AccessibleHandlerControl() AccessibleHandlerControl::AccessibleHandlerControl()
: mCacheGen(0) : mRefCnt(0)
, mCacheGen(0)
, mIA2Proxy(mscom::RegisterProxy(L"ia2marshal.dll")) , mIA2Proxy(mscom::RegisterProxy(L"ia2marshal.dll"))
, mHandlerProxy(mscom::RegisterProxy()) , mHandlerProxy(mscom::RegisterProxy())
{ {
MOZ_ASSERT(mIA2Proxy); MOZ_ASSERT(mIA2Proxy);
} }
IMPL_IUNKNOWN1(AccessibleHandlerControl, IHandlerControl) HRESULT
AccessibleHandlerControl::QueryInterface(REFIID aIid, void** aOutInterface)
{
if (!aOutInterface) {
return E_INVALIDARG;
}
if (aIid == IID_IUnknown || aIid == IID_IHandlerControl) {
RefPtr<IHandlerControl> ctl(this);
ctl.forget(aOutInterface);
return S_OK;
}
*aOutInterface = nullptr;
return E_NOINTERFACE;
}
ULONG
AccessibleHandlerControl::AddRef()
{
return ++mRefCnt;
}
ULONG
AccessibleHandlerControl::Release()
{
ULONG result = --mRefCnt;
if (!result) {
delete this;
}
return result;
}
HRESULT HRESULT
AccessibleHandlerControl::Invalidate() AccessibleHandlerControl::Invalidate()
@ -148,36 +83,6 @@ AccessibleHandlerControl::Invalidate()
return S_OK; return S_OK;
} }
HRESULT
AccessibleHandlerControl::OnTextChange(long aHwnd, long aIA2UniqueId,
VARIANT_BOOL aIsInsert,
IA2TextSegment* aText)
{
if (!aText) {
return E_INVALIDARG;
}
mTextChange = detail::TextChange(aIA2UniqueId, aIsInsert, WrapNotNull(aText));
NotifyWinEvent(aIsInsert ? IA2_EVENT_TEXT_INSERTED : IA2_EVENT_TEXT_REMOVED,
reinterpret_cast<HWND>(static_cast<uintptr_t>(aHwnd)),
OBJID_CLIENT, aIA2UniqueId);
return S_OK;
}
HRESULT
AccessibleHandlerControl::GetNewText(long aIA2UniqueId,
NotNull<IA2TextSegment*> aOutNewText)
{
return mTextChange.GetNew(aIA2UniqueId, aOutNewText);
}
HRESULT
AccessibleHandlerControl::GetOldText(long aIA2UniqueId,
NotNull<IA2TextSegment*> aOutOldText)
{
return mTextChange.GetOld(aIA2UniqueId, aOutOldText);
}
HRESULT HRESULT
AccessibleHandlerControl::GetHandlerTypeInfo(ITypeInfo** aOutTypeInfo) AccessibleHandlerControl::GetHandlerTypeInfo(ITypeInfo** aOutTypeInfo)
{ {

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

@ -13,70 +13,37 @@
#include "Factory.h" #include "Factory.h"
#include "HandlerData.h" #include "HandlerData.h"
#include "IUnknownImpl.h"
#include "mozilla/mscom/Registration.h" #include "mozilla/mscom/Registration.h"
#include "mozilla/NotNull.h"
namespace mozilla { namespace mozilla {
namespace a11y { namespace a11y {
namespace detail {
class TextChange final
{
public:
TextChange();
TextChange(long aIA2UniqueId, bool aIsInsert, NotNull<IA2TextSegment*> aText);
TextChange(TextChange&& aOther);
TextChange(const TextChange& aOther);
TextChange& operator=(TextChange&& aOther);
TextChange& operator=(const TextChange& aOther);
~TextChange();
HRESULT GetOld(long aIA2UniqueId, NotNull<IA2TextSegment*> aOutOldSegment);
HRESULT GetNew(long aIA2UniqueId, NotNull<IA2TextSegment*> aOutNewSegment);
private:
static BSTR BSTRCopy(const BSTR& aIn);
static HRESULT SegCopy(IA2TextSegment& aDest, const IA2TextSegment& aSrc);
long mIA2UniqueId;
bool mIsInsert;
IA2TextSegment mText;
};
} // namespace detail
class AccessibleHandlerControl final : public IHandlerControl class AccessibleHandlerControl final : public IHandlerControl
{ {
public: public:
static HRESULT Create(AccessibleHandlerControl** aOutObject); static HRESULT Create(AccessibleHandlerControl** aOutObject);
DECL_IUNKNOWN // IUnknown
STDMETHODIMP QueryInterface(REFIID riid, void** ppv) override;
STDMETHODIMP_(ULONG) AddRef() override;
STDMETHODIMP_(ULONG) Release() override;
// IHandlerControl // IHandlerControl
STDMETHODIMP Invalidate() override; STDMETHODIMP Invalidate() override;
STDMETHODIMP OnTextChange(long aHwnd, long aIA2UniqueId,
VARIANT_BOOL aIsInsert, IA2TextSegment* aText) override;
uint32_t GetCacheGen() const uint32_t GetCacheGen() const
{ {
return mCacheGen; return mCacheGen;
} }
HRESULT GetNewText(long aIA2UniqueId, NotNull<IA2TextSegment*> aOutNewText);
HRESULT GetOldText(long aIA2UniqueId, NotNull<IA2TextSegment*> aOutOldText);
HRESULT GetHandlerTypeInfo(ITypeInfo** aOutTypeInfo); HRESULT GetHandlerTypeInfo(ITypeInfo** aOutTypeInfo);
private: private:
AccessibleHandlerControl(); AccessibleHandlerControl();
~AccessibleHandlerControl() = default; ~AccessibleHandlerControl() = default;
ULONG mRefCnt;
uint32_t mCacheGen; uint32_t mCacheGen;
detail::TextChange mTextChange;
UniquePtr<mscom::RegisteredProxy> mIA2Proxy; UniquePtr<mscom::RegisteredProxy> mIA2Proxy;
UniquePtr<mscom::RegisteredProxy> mHandlerProxy; UniquePtr<mscom::RegisteredProxy> mHandlerProxy;
}; };

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

@ -1,359 +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/. */
#if defined(MOZILLA_INTERNAL_API)
#error This code is NOT for internal Gecko use!
#endif // defined(MOZILLA_INTERNAL_API)
#include "AccessibleTextTearoff.h"
#include "AccessibleHandlerControl.h"
#include "AccessibleText_i.c"
#include "AccessibleHypertext_i.c"
#include "Factory.h"
#include "mozilla/Assertions.h"
namespace mozilla {
namespace a11y {
AccessibleTextTearoff::AccessibleTextTearoff(AccessibleHandler* aHandler)
: mHandler(aHandler)
{
MOZ_ASSERT(aHandler);
}
HRESULT
AccessibleTextTearoff::ResolveAccText()
{
if (mAccTextProxy) {
return S_OK;
}
RefPtr<IUnknown> proxy(mHandler->GetProxy());
if (!proxy) {
return E_UNEXPECTED;
}
return proxy->QueryInterface(IID_IAccessibleText,
getter_AddRefs(mAccTextProxy));
}
HRESULT
AccessibleTextTearoff::ResolveAccHypertext()
{
if (mAccHypertextProxy) {
return S_OK;
}
RefPtr<IUnknown> proxy(mHandler->GetProxy());
if (!proxy) {
return E_UNEXPECTED;
}
return proxy->QueryInterface(IID_IAccessibleHypertext,
getter_AddRefs(mAccHypertextProxy));
}
IMPL_IUNKNOWN_QUERY_HEAD(AccessibleTextTearoff)
IMPL_IUNKNOWN_QUERY_IFACE(IAccessibleText)
IMPL_IUNKNOWN_QUERY_IFACE(IAccessibleHypertext)
IMPL_IUNKNOWN_QUERY_TAIL_AGGREGATED(mHandler)
HRESULT
AccessibleTextTearoff::addSelection(long startOffset, long endOffset)
{
HRESULT hr = ResolveAccText();
if (FAILED(hr)) {
return hr;
}
return mAccTextProxy->addSelection(startOffset, endOffset);
}
HRESULT
AccessibleTextTearoff::get_attributes(long offset, long *startOffset,
long *endOffset, BSTR *textAttributes)
{
HRESULT hr = ResolveAccText();
if (FAILED(hr)) {
return hr;
}
return mAccTextProxy->get_attributes(offset, startOffset, endOffset,
textAttributes);
}
HRESULT
AccessibleTextTearoff::get_caretOffset(long *offset)
{
HRESULT hr = ResolveAccText();
if (FAILED(hr)) {
return hr;
}
return mAccTextProxy->get_caretOffset(offset);
}
HRESULT
AccessibleTextTearoff::get_characterExtents(long offset,
enum IA2CoordinateType coordType,
long *x, long *y, long *width,
long *height)
{
HRESULT hr = ResolveAccText();
if (FAILED(hr)) {
return hr;
}
return mAccTextProxy->get_characterExtents(offset, coordType, x, y, width,
height);
}
HRESULT
AccessibleTextTearoff::get_nSelections(long *nSelections)
{
HRESULT hr = ResolveAccText();
if (FAILED(hr)) {
return hr;
}
return mAccTextProxy->get_nSelections(nSelections);
}
HRESULT
AccessibleTextTearoff::get_offsetAtPoint(long x, long y,
enum IA2CoordinateType coordType,
long *offset)
{
HRESULT hr = ResolveAccText();
if (FAILED(hr)) {
return hr;
}
return mAccTextProxy->get_offsetAtPoint(x, y, coordType, offset);
}
HRESULT
AccessibleTextTearoff::get_selection(long selectionIndex, long *startOffset,
long *endOffset)
{
HRESULT hr = ResolveAccText();
if (FAILED(hr)) {
return hr;
}
return mAccTextProxy->get_selection(selectionIndex, startOffset, endOffset);
}
HRESULT
AccessibleTextTearoff::get_text(long startOffset, long endOffset, BSTR *text)
{
HRESULT hr = ResolveAccText();
if (FAILED(hr)) {
return hr;
}
return mAccTextProxy->get_text(startOffset, endOffset, text);
}
HRESULT
AccessibleTextTearoff::get_textBeforeOffset(long offset,
enum IA2TextBoundaryType boundaryType,
long *startOffset, long *endOffset,
BSTR *text)
{
HRESULT hr = ResolveAccText();
if (FAILED(hr)) {
return hr;
}
return mAccTextProxy->get_textBeforeOffset(offset, boundaryType, startOffset,
endOffset, text);
}
HRESULT
AccessibleTextTearoff::get_textAfterOffset(long offset,
enum IA2TextBoundaryType boundaryType,
long *startOffset, long *endOffset,
BSTR *text)
{
HRESULT hr = ResolveAccText();
if (FAILED(hr)) {
return hr;
}
return mAccTextProxy->get_textAfterOffset(offset, boundaryType,
startOffset, endOffset, text);
}
HRESULT
AccessibleTextTearoff::get_textAtOffset(long offset,
enum IA2TextBoundaryType boundaryType,
long *startOffset, long *endOffset,
BSTR *text)
{
HRESULT hr = ResolveAccText();
if (FAILED(hr)) {
return hr;
}
return mAccTextProxy->get_textAtOffset(offset, boundaryType, startOffset,
endOffset, text);
}
HRESULT
AccessibleTextTearoff::removeSelection(long selectionIndex)
{
HRESULT hr = ResolveAccText();
if (FAILED(hr)) {
return hr;
}
return mAccTextProxy->removeSelection(selectionIndex);
}
HRESULT
AccessibleTextTearoff::setCaretOffset(long offset)
{
HRESULT hr = ResolveAccText();
if (FAILED(hr)) {
return hr;
}
return mAccTextProxy->setCaretOffset(offset);
}
HRESULT
AccessibleTextTearoff::setSelection(long selectionIndex, long startOffset,
long endOffset)
{
HRESULT hr = ResolveAccText();
if (FAILED(hr)) {
return hr;
}
return mAccTextProxy->setSelection(selectionIndex, startOffset, endOffset);
}
HRESULT
AccessibleTextTearoff::get_nCharacters(long *nCharacters)
{
HRESULT hr = ResolveAccText();
if (FAILED(hr)) {
return hr;
}
return mAccTextProxy->get_nCharacters(nCharacters);
}
HRESULT
AccessibleTextTearoff::scrollSubstringTo(long startIndex, long endIndex,
enum IA2ScrollType scrollType)
{
HRESULT hr = ResolveAccText();
if (FAILED(hr)) {
return hr;
}
return mAccTextProxy->scrollSubstringTo(startIndex, endIndex, scrollType);
}
HRESULT
AccessibleTextTearoff::scrollSubstringToPoint(long startIndex, long endIndex,
enum IA2CoordinateType coordinateType,
long x, long y)
{
HRESULT hr = ResolveAccText();
if (FAILED(hr)) {
return hr;
}
return mAccTextProxy->scrollSubstringToPoint(startIndex, endIndex,
coordinateType, x, y);
}
HRESULT
AccessibleTextTearoff::get_newText(IA2TextSegment *newText)
{
if (!newText) {
return E_INVALIDARG;
}
RefPtr<AccessibleHandlerControl> ctl(gControlFactory.GetSingleton());
MOZ_ASSERT(ctl);
if (!ctl) {
return S_OK;
}
long id;
HRESULT hr = mHandler->get_uniqueID(&id);
if (FAILED(hr)) {
return hr;
}
return ctl->GetNewText(id, WrapNotNull(newText));
}
HRESULT
AccessibleTextTearoff::get_oldText(IA2TextSegment *oldText)
{
if (!oldText) {
return E_INVALIDARG;
}
RefPtr<AccessibleHandlerControl> ctl(gControlFactory.GetSingleton());
MOZ_ASSERT(ctl);
if (!ctl) {
return S_OK;
}
long id;
HRESULT hr = mHandler->get_uniqueID(&id);
if (FAILED(hr)) {
return hr;
}
return ctl->GetOldText(id, WrapNotNull(oldText));
}
HRESULT
AccessibleTextTearoff::get_nHyperlinks(long *hyperlinkCount)
{
HRESULT hr = ResolveAccHypertext();
if (FAILED(hr)) {
return hr;
}
return mAccHypertextProxy->get_nHyperlinks(hyperlinkCount);
}
HRESULT
AccessibleTextTearoff::get_hyperlink(long index,
IAccessibleHyperlink **hyperlink)
{
HRESULT hr = ResolveAccHypertext();
if (FAILED(hr)) {
return hr;
}
return mAccHypertextProxy->get_hyperlink(index, hyperlink);
}
HRESULT
AccessibleTextTearoff::get_hyperlinkIndex(long charIndex, long *hyperlinkIndex)
{
HRESULT hr = ResolveAccHypertext();
if (FAILED(hr)) {
return hr;
}
return mAccHypertextProxy->get_hyperlinkIndex(charIndex, hyperlinkIndex);
}
} // namespace a11y
} // namespace mozilla

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

@ -1,88 +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/. */
#if defined(MOZILLA_INTERNAL_API)
#error This code is NOT for internal Gecko use!
#endif // defined(MOZILLA_INTERNAL_API)
#ifndef mozilla_a11y_AccessibleTextTearoff_h
#define mozilla_a11y_AccessibleTextTearoff_h
#include "AccessibleHandler.h"
#include "AccessibleHypertext.h"
#include "IUnknownImpl.h"
#include "mozilla/RefPtr.h"
namespace mozilla {
namespace a11y {
class AccessibleTextTearoff final : public IAccessibleHypertext
{
public:
explicit AccessibleTextTearoff(AccessibleHandler* aHandler);
DECL_IUNKNOWN
// IAccessibleText
STDMETHODIMP addSelection(long startOffset, long endOffset) override;
STDMETHODIMP get_attributes(long offset, long *startOffset, long *endOffset,
BSTR *textAttributes) override;
STDMETHODIMP get_caretOffset(long *offset) override;
STDMETHODIMP get_characterExtents(long offset,
enum IA2CoordinateType coordType, long *x,
long *y, long *width, long *height) override;
STDMETHODIMP get_nSelections(long *nSelections) override;
STDMETHODIMP get_offsetAtPoint(long x, long y,
enum IA2CoordinateType coordType,
long *offset) override;
STDMETHODIMP get_selection(long selectionIndex, long *startOffset,
long *endOffset) override;
STDMETHODIMP get_text(long startOffset, long endOffset, BSTR *text) override;
STDMETHODIMP get_textBeforeOffset(long offset,
enum IA2TextBoundaryType boundaryType,
long *startOffset, long *endOffset,
BSTR *text) override;
STDMETHODIMP get_textAfterOffset(long offset,
enum IA2TextBoundaryType boundaryType,
long *startOffset, long *endOffset,
BSTR *text) override;
STDMETHODIMP get_textAtOffset(long offset,
enum IA2TextBoundaryType boundaryType,
long *startOffset, long *endOffset,
BSTR *text) override;
STDMETHODIMP removeSelection(long selectionIndex) override;
STDMETHODIMP setCaretOffset(long offset) override;
STDMETHODIMP setSelection(long selectionIndex, long startOffset,
long endOffset) override;
STDMETHODIMP get_nCharacters(long *nCharacters) override;
STDMETHODIMP scrollSubstringTo(long startIndex, long endIndex,
enum IA2ScrollType scrollType) override;
STDMETHODIMP scrollSubstringToPoint(long startIndex, long endIndex,
enum IA2CoordinateType coordinateType,
long x, long y) override;
STDMETHODIMP get_newText(IA2TextSegment *newText) override;
STDMETHODIMP get_oldText(IA2TextSegment *oldText) override;
// IAccessibleHypertext
STDMETHODIMP get_nHyperlinks(long *hyperlinkCount) override;
STDMETHODIMP get_hyperlink(long index,
IAccessibleHyperlink **hyperlink) override;
STDMETHODIMP get_hyperlinkIndex(long charIndex, long *hyperlinkIndex) override;
private:
~AccessibleTextTearoff() = default;
HRESULT ResolveAccText();
HRESULT ResolveAccHypertext();
RefPtr<AccessibleHandler> mHandler;
RefPtr<IAccessibleText> mAccTextProxy;
RefPtr<IAccessibleHypertext> mAccHypertextProxy;
};
} // namespace a11y
} // namespace mozilla
#endif // mozilla_a11y_AccessibleTextTearoff_h

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

@ -9,8 +9,6 @@
import "ocidl.idl"; import "ocidl.idl";
import "ServProv.idl"; import "ServProv.idl";
import "AccessibleText.idl";
typedef struct _IA2Data typedef struct _IA2Data
{ {
long mUniqueId; long mUniqueId;
@ -86,9 +84,6 @@ interface HandlerData
interface IHandlerControl : IUnknown interface IHandlerControl : IUnknown
{ {
HRESULT Invalidate(); HRESULT Invalidate();
HRESULT OnTextChange([in] long aHwnd, [in] long aIA2UniqueId,
[in] VARIANT_BOOL aIsInsert,
[in] IA2TextSegment* aText);
} }
[object, [object,

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

@ -20,7 +20,6 @@ SOURCES += [
'!HandlerData_p.c', '!HandlerData_p.c',
'AccessibleHandler.cpp', 'AccessibleHandler.cpp',
'AccessibleHandlerControl.cpp', 'AccessibleHandlerControl.cpp',
'AccessibleTextTearoff.cpp',
] ]
GENERATED_FILES += [ GENERATED_FILES += [

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

@ -43,7 +43,6 @@
#include "nsArrayUtils.h" #include "nsArrayUtils.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "nsIXULRuntime.h" #include "nsIXULRuntime.h"
#include "mozilla/mscom/AsyncInvoker.h"
#include "oleacc.h" #include "oleacc.h"
@ -1628,60 +1627,3 @@ AccessibleWrap::SetHandlerControl(DWORD aPid, RefPtr<IHandlerControl> aCtrl)
sHandlerControllers->AppendElement(Move(ctrlData)); sHandlerControllers->AppendElement(Move(ctrlData));
} }
bool
AccessibleWrap::DispatchTextChangeToHandler(bool aIsInsert,
const nsString& aText,
int32_t aStart, uint32_t aLen)
{
MOZ_ASSERT(XRE_IsParentProcess());
MOZ_ASSERT(NS_IsMainThread());
if (!sHandlerControllers || sHandlerControllers->IsEmpty()) {
return false;
}
HWND hwnd = GetHWNDFor(this);
MOZ_ASSERT(hwnd);
if (!hwnd) {
return false;
}
long msaaId = GetChildIDFor(this);
DWORD ourPid = ::GetCurrentProcessId();
// The handler ends up calling NotifyWinEvent, which should only be done once
// since it broadcasts the same event to every process who is subscribed.
// OTOH, if our chrome process contains a handler, we should prefer to
// broadcast the event from that process, as we want any DLLs injected by ATs
// to receive the event synchronously. Otherwise we simply choose the first
// handler in the list, for the lack of a better heuristic.
nsTArray<HandlerControllerData>::index_type ctrlIndex =
sHandlerControllers->IndexOf(ourPid);
if (ctrlIndex == nsTArray<HandlerControllerData>::NoIndex) {
ctrlIndex = 0;
}
HandlerControllerData& controller = sHandlerControllers->ElementAt(ctrlIndex);
MOZ_ASSERT(controller.mPid);
MOZ_ASSERT(controller.mCtrl);
VARIANT_BOOL isInsert = aIsInsert ? VARIANT_TRUE : VARIANT_FALSE;
IA2TextSegment textSegment{::SysAllocStringLen(aText.get(), aText.Length()),
aStart, static_cast<long>(aLen)};
ASYNC_INVOKER_FOR(IHandlerControl) invoker(controller.mCtrl,
Some(controller.mIsProxy));
HRESULT hr = ASYNC_INVOKE(invoker, OnTextChange, PtrToLong(hwnd), msaaId,
isInsert, &textSegment);
::SysFreeString(textSegment.text);
return SUCCEEDED(hr);
}

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

@ -192,8 +192,6 @@ public: // construction, destruction
static void SetHandlerControl(DWORD aPid, RefPtr<IHandlerControl> aCtrl); static void SetHandlerControl(DWORD aPid, RefPtr<IHandlerControl> aCtrl);
bool DispatchTextChangeToHandler(bool aIsInsert, const nsString& aText,
int32_t aStart, uint32_t aLen);
protected: protected:
virtual ~AccessibleWrap(); virtual ~AccessibleWrap();

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

@ -131,7 +131,18 @@ DocAccessibleWrap::GetNativeWindow() const
return nullptr; return nullptr;
} }
return ipcDoc->GetNativeWindowHandle(); HWND hWnd = ipcDoc->GetEmulatedWindowHandle();
if (hWnd) {
return hWnd;
}
auto tab = static_cast<dom::TabChild*>(ipcDoc->Manager());
MOZ_ASSERT(tab);
if (!tab) {
return nullptr;
}
return reinterpret_cast<HWND>(tab->GetNativeWindowHandle());
} else if (mHWND) { } else if (mHWND) {
return mHWND; return mHWND;
} }

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

@ -132,14 +132,6 @@ a11y::ProxyTextChangeEvent(ProxyAccessible* aText, const nsString& aStr,
return; return;
} }
static const bool useHandler =
Preferences::GetBool("accessibility.handler.enabled", false);
if (useHandler) {
wrapper->DispatchTextChangeToHandler(aInsert, aStr, aStart, aLen);
return;
}
auto text = static_cast<HyperTextAccessibleWrap*>(wrapper->AsHyperText()); auto text = static_cast<HyperTextAccessibleWrap*>(wrapper->AsHyperText());
if (text) { if (text) {
ia2AccessibleText::UpdateTextChangeData(text, aInsert, aStr, aStart, aLen); ia2AccessibleText::UpdateTextChangeData(text, aInsert, aStr, aStart, aLen);

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

@ -594,9 +594,6 @@ platform = notwin
[PDocAccessible::GetWindowedPluginIAccessible] [PDocAccessible::GetWindowedPluginIAccessible]
description = description =
platform = win platform = win
[PDocAccessible::SyncTextChangeEvent]
description =
platform = win
# CPOWs # CPOWs
[PBrowser::RpcMessage] [PBrowser::RpcMessage]