зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1657765 - Add IPDL interface for platform-specific mac API. r=morgan,Jamie,nika
Differential Revision: https://phabricator.services.mozilla.com/D86606
This commit is contained in:
Родитель
3dcf7fa7ab
Коммит
58ae94661e
|
@ -0,0 +1,127 @@
|
|||
/* -*- 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 "DocAccessiblePlatformExtChild.h"
|
||||
|
||||
#include "DocAccessibleChild.h"
|
||||
#include "HyperTextAccessibleWrap.h"
|
||||
|
||||
#define UNIQUE_ID(acc) \
|
||||
!acc || acc->Document() == acc ? 0 \
|
||||
: reinterpret_cast<uint64_t>(acc->UniqueID())
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
mozilla::ipc::IPCResult DocAccessiblePlatformExtChild::RecvLeftWordAt(
|
||||
const uint64_t& aID, const int32_t& aOffset, uint64_t* aStartContainer,
|
||||
int32_t* aStartOffset, uint64_t* aEndContainer, int32_t* aEndOffset) {
|
||||
HyperTextAccessibleWrap* acc = IdToHyperTextAccessibleWrap(aID);
|
||||
if (!acc) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
HyperTextAccessible* startContainer = nullptr;
|
||||
HyperTextAccessible* endContainer = nullptr;
|
||||
|
||||
acc->LeftWordAt(aOffset, &startContainer, aStartOffset, &endContainer,
|
||||
aEndOffset);
|
||||
|
||||
MOZ_ASSERT(!startContainer || startContainer->Document() == acc->Document());
|
||||
MOZ_ASSERT(!endContainer || endContainer->Document() == acc->Document());
|
||||
|
||||
*aStartContainer = UNIQUE_ID(startContainer);
|
||||
*aEndContainer = UNIQUE_ID(endContainer);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult DocAccessiblePlatformExtChild::RecvRightWordAt(
|
||||
const uint64_t& aID, const int32_t& aOffset, uint64_t* aStartContainer,
|
||||
int32_t* aStartOffset, uint64_t* aEndContainer, int32_t* aEndOffset) {
|
||||
HyperTextAccessibleWrap* acc = IdToHyperTextAccessibleWrap(aID);
|
||||
if (!acc) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
HyperTextAccessible* startContainer = nullptr;
|
||||
HyperTextAccessible* endContainer = nullptr;
|
||||
|
||||
acc->RightWordAt(aOffset, &startContainer, aStartOffset, &endContainer,
|
||||
aEndOffset);
|
||||
|
||||
MOZ_ASSERT(!startContainer || startContainer->Document() == acc->Document());
|
||||
MOZ_ASSERT(!endContainer || endContainer->Document() == acc->Document());
|
||||
|
||||
*aStartContainer = UNIQUE_ID(startContainer);
|
||||
*aEndContainer = UNIQUE_ID(endContainer);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult DocAccessiblePlatformExtChild::RecvNextClusterAt(
|
||||
const uint64_t& aID, const int32_t& aOffset, uint64_t* aNextContainer,
|
||||
int32_t* aNextOffset) {
|
||||
HyperTextAccessibleWrap* acc = IdToHyperTextAccessibleWrap(aID);
|
||||
if (!acc) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
HyperTextAccessible* nextContainer = nullptr;
|
||||
|
||||
acc->NextClusterAt(aOffset, &nextContainer, aNextOffset);
|
||||
|
||||
MOZ_ASSERT(!nextContainer || nextContainer->Document() == acc->Document());
|
||||
|
||||
*aNextContainer = UNIQUE_ID(nextContainer);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult DocAccessiblePlatformExtChild::RecvPreviousClusterAt(
|
||||
const uint64_t& aID, const int32_t& aOffset, uint64_t* aPrevContainer,
|
||||
int32_t* aPrevOffset) {
|
||||
HyperTextAccessibleWrap* acc = IdToHyperTextAccessibleWrap(aID);
|
||||
if (!acc) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
HyperTextAccessible* prevContainer = nullptr;
|
||||
|
||||
acc->PreviousClusterAt(aOffset, &prevContainer, aPrevOffset);
|
||||
|
||||
MOZ_ASSERT(!prevContainer || prevContainer->Document() == acc->Document());
|
||||
|
||||
*aPrevContainer = UNIQUE_ID(prevContainer);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult DocAccessiblePlatformExtChild::RecvTextForRange(
|
||||
const uint64_t& aID, const int32_t& aStartOffset,
|
||||
const uint64_t& aEndContainer, const int32_t& aEndOffset, nsString* aText) {
|
||||
HyperTextAccessibleWrap* acc = IdToHyperTextAccessibleWrap(aID);
|
||||
HyperTextAccessibleWrap* endContainer =
|
||||
IdToHyperTextAccessibleWrap(aEndContainer);
|
||||
if (!acc || !endContainer) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
acc->TextForRange(*aText, aStartOffset, endContainer, aEndOffset);
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
HyperTextAccessibleWrap*
|
||||
DocAccessiblePlatformExtChild::IdToHyperTextAccessibleWrap(
|
||||
const uint64_t& aID) const {
|
||||
return static_cast<HyperTextAccessibleWrap*>(
|
||||
static_cast<DocAccessibleChild*>(Manager())->IdToHyperTextAccessible(
|
||||
aID));
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
|
@ -0,0 +1,50 @@
|
|||
/* 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_DocAccessiblePlatformExtChild_h
|
||||
#define mozilla_a11y_DocAccessiblePlatformExtChild_h
|
||||
|
||||
#include "mozilla/a11y/PDocAccessiblePlatformExtChild.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class HyperTextAccessibleWrap;
|
||||
class DocAccessibleChild;
|
||||
|
||||
class DocAccessiblePlatformExtChild : public PDocAccessiblePlatformExtChild {
|
||||
public:
|
||||
mozilla::ipc::IPCResult RecvLeftWordAt(
|
||||
const uint64_t& aID, const int32_t& aOffset, uint64_t* aStartContainer,
|
||||
int32_t* aStartOffset, uint64_t* aEndContainer, int32_t* aEndOffset);
|
||||
|
||||
mozilla::ipc::IPCResult RecvRightWordAt(
|
||||
const uint64_t& aID, const int32_t& aOffset, uint64_t* aStartContainer,
|
||||
int32_t* aStartOffset, uint64_t* aEndContainer, int32_t* aEndOffset);
|
||||
|
||||
mozilla::ipc::IPCResult RecvNextClusterAt(const uint64_t& aID,
|
||||
const int32_t& aOffset,
|
||||
uint64_t* aNextContainer,
|
||||
int32_t* aNextOffset);
|
||||
|
||||
mozilla::ipc::IPCResult RecvPreviousClusterAt(const uint64_t& aID,
|
||||
const int32_t& aOffset,
|
||||
uint64_t* aPrevContainer,
|
||||
int32_t* aPrevOffset);
|
||||
|
||||
mozilla::ipc::IPCResult RecvTextForRange(const uint64_t& aID,
|
||||
const int32_t& aStartOffset,
|
||||
const uint64_t& aEndContainer,
|
||||
const int32_t& aEndOffset,
|
||||
nsString* aText);
|
||||
|
||||
private:
|
||||
HyperTextAccessibleWrap* IdToHyperTextAccessibleWrap(
|
||||
const uint64_t& aID) const;
|
||||
};
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
|
@ -0,0 +1,19 @@
|
|||
/* 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_DocAccessiblePlatformExtParent_h
|
||||
#define mozilla_a11y_DocAccessiblePlatformExtParent_h
|
||||
|
||||
#include "mozilla/a11y/PDocAccessiblePlatformExtParent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
class DocAccessiblePlatformExtParent : public PDocAccessiblePlatformExtParent {
|
||||
|
||||
};
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
|
@ -0,0 +1,37 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
include protocol PDocAccessible;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
nested(upto inside_sync) sync protocol PDocAccessiblePlatformExt {
|
||||
manager PDocAccessible;
|
||||
|
||||
child:
|
||||
async __delete__();
|
||||
|
||||
nested(inside_sync) sync LeftWordAt(uint64_t aID, int32_t aOffset)
|
||||
returns(uint64_t aStartContainer, int32_t aStartOffset,
|
||||
uint64_t aEndContainer, int32_t aEndOffset);
|
||||
|
||||
nested(inside_sync) sync RightWordAt(uint64_t aID, int32_t aOffset)
|
||||
returns(uint64_t aStartContainer, int32_t aStartOffset,
|
||||
uint64_t aEndContainer, int32_t aEndOffset);
|
||||
|
||||
nested(inside_sync) sync NextClusterAt(uint64_t aID, int32_t aOffset)
|
||||
returns(uint64_t aNextContainer, int32_t aNextOffset);
|
||||
|
||||
nested(inside_sync) sync PreviousClusterAt(uint64_t aID, int32_t aOffset)
|
||||
returns(uint64_t aNextContainer, int32_t aNextOffset);
|
||||
|
||||
nested(inside_sync) sync TextForRange(uint64_t aID, int32_t aStartOffset, uint64_t aEndContainer, int32_t aEndOffset)
|
||||
returns(nsString aText);
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
|
@ -0,0 +1,28 @@
|
|||
# -*- 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/.
|
||||
|
||||
if CONFIG['ACCESSIBILITY']:
|
||||
IPDL_SOURCES += ['PDocAccessiblePlatformExt.ipdl']
|
||||
|
||||
EXPORTS.mozilla.a11y += [
|
||||
'DocAccessiblePlatformExtChild.h',
|
||||
'DocAccessiblePlatformExtParent.h',
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
'DocAccessiblePlatformExtChild.cpp',
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/accessible/base',
|
||||
'/accessible/generic',
|
||||
'/accessible/ipc/other',
|
||||
'/accessible/mac',
|
||||
]
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
|
@ -4,7 +4,11 @@
|
|||
# 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['MOZ_WIDGET_TOOLKIT'] == 'android':
|
||||
toolkit = CONFIG['MOZ_WIDGET_TOOLKIT']
|
||||
|
||||
if toolkit == 'android':
|
||||
DIRS += ['android']
|
||||
elif toolkit == 'cocoa':
|
||||
DIRS += ['mac']
|
||||
else:
|
||||
DIRS += ['other']
|
||||
|
|
|
@ -614,6 +614,22 @@ platform = win
|
|||
description = Legacy a11y IPC
|
||||
platform = win
|
||||
|
||||
[PDocAccessiblePlatformExt::LeftWordAt]
|
||||
description = Retrieve left word range from offset. Platform API is synchronous, so this needs to be too.
|
||||
platform = mac
|
||||
[PDocAccessiblePlatformExt::RightWordAt]
|
||||
description = Retrieve left word range from offset. Platform API is synchronous, so this needs to be too.
|
||||
platform = mac
|
||||
[PDocAccessiblePlatformExt::NextClusterAt]
|
||||
description = Retrieve next character from offset. Platform API is synchronous, so this needs to be too.
|
||||
platform = mac
|
||||
[PDocAccessiblePlatformExt::PreviousClusterAt]
|
||||
description = Retrieve previous character from offset. Platform API is synchronous, so this needs to be too.
|
||||
platform = mac
|
||||
[PDocAccessiblePlatformExt::TextForRange]
|
||||
description = Retrieve flattened string for text range. Platform API is synchronous, so this needs to be too.
|
||||
platform = mac
|
||||
|
||||
# Plugins
|
||||
[PPluginWidget::Create]
|
||||
description = Legacy NPAPI IPC
|
||||
|
|
Загрузка…
Ссылка в новой задаче