Bug 1862802 part 1: Provide an argument to PlatformCaretMoveEvent specifying whether the event was caused by user input. r=eeejay

This is needed in order to support find in page on Android using remote caret events instead of virtual cursor change events.

Depends on D192641

Differential Revision: https://phabricator.services.mozilla.com/D192642
This commit is contained in:
James Teh 2023-11-29 03:53:19 +00:00
parent fe1644b3dc
commit 447aa32c0e
12 changed files with 29 additions and 19 deletions

View File

@ -142,7 +142,8 @@ void a11y::PlatformFocusEvent(Accessible* aTarget,
void a11y::PlatformCaretMoveEvent(Accessible* aTarget, int32_t aOffset,
bool aIsSelectionCollapsed,
int32_t aGranularity,
const LayoutDeviceIntRect& aCaretRect) {
const LayoutDeviceIntRect& aCaretRect,
bool aFromUser) {
RefPtr<SessionAccessibility> sessionAcc =
SessionAccessibility::GetInstanceFor(aTarget);

View File

@ -1069,7 +1069,8 @@ void a11y::PlatformFocusEvent(Accessible* aTarget,
void a11y::PlatformCaretMoveEvent(Accessible* aTarget, int32_t aOffset,
bool aIsSelectionCollapsed,
int32_t aGranularity,
const LayoutDeviceIntRect& aCaretRect) {
const LayoutDeviceIntRect& aCaretRect,
bool aFromUser) {
AtkObject* wrapper = GetWrapperFor(aTarget);
g_signal_emit_by_name(wrapper, "text_caret_moved", aOffset);
}

View File

@ -99,7 +99,8 @@ void PlatformFocusEvent(Accessible* aTarget,
const LayoutDeviceIntRect& aCaretRect);
void PlatformCaretMoveEvent(Accessible* aTarget, int32_t aOffset,
bool aIsSelectionCollapsed, int32_t aGranularity,
const LayoutDeviceIntRect& aCaretRect);
const LayoutDeviceIntRect& aCaretRect,
bool aFromUser);
void PlatformTextChangeEvent(Accessible* aTarget, const nsAString& aStr,
int32_t aStart, uint32_t aLen, bool aIsInsert,
bool aFromUser);

View File

@ -915,7 +915,8 @@ nsresult LocalAccessible::HandleAccEvent(AccEvent* aEvent) {
AccCaretMoveEvent* event = downcast_accEvent(aEvent);
ipcDoc->SendCaretMoveEvent(
id, event->GetCaretOffset(), event->IsSelectionCollapsed(),
event->IsAtEndOfLine(), event->GetGranularity());
event->IsAtEndOfLine(), event->GetGranularity(),
event->IsFromUserInput());
break;
}
case nsIAccessibleEvent::EVENT_TEXT_INSERTED:
@ -1038,9 +1039,9 @@ nsresult LocalAccessible::HandleAccEvent(AccEvent* aEvent) {
// AccessibleWrap::UpdateSystemCaretFor currently needs to call
// HyperTextAccessible::GetCaretRect again to get the widget and there's
// no point calling it twice.
PlatformCaretMoveEvent(target, event->GetCaretOffset(),
event->IsSelectionCollapsed(),
event->GetGranularity(), rect);
PlatformCaretMoveEvent(
target, event->GetCaretOffset(), event->IsSelectionCollapsed(),
event->GetGranularity(), rect, event->IsFromUserInput());
break;
}
case nsIAccessibleEvent::EVENT_TEXT_INSERTED:

View File

@ -381,10 +381,11 @@ bool DocAccessibleChild::SendCaretMoveEvent(const uint64_t& aID,
const int32_t& aOffset,
const bool& aIsSelectionCollapsed,
const bool& aIsAtEndOfLine,
const int32_t& aGranularity) {
return PDocAccessibleChild::SendCaretMoveEvent(aID, GetCaretRectFor(aID),
aOffset, aIsSelectionCollapsed,
aIsAtEndOfLine, aGranularity);
const int32_t& aGranularity,
bool aFromUser) {
return PDocAccessibleChild::SendCaretMoveEvent(
aID, GetCaretRectFor(aID), aOffset, aIsSelectionCollapsed, aIsAtEndOfLine,
aGranularity, aFromUser);
}
#if !defined(XP_WIN)

View File

@ -132,7 +132,7 @@ class DocAccessibleChild : public PDocAccessibleChild {
bool SendCaretMoveEvent(const uint64_t& aID, const int32_t& aOffset,
const bool& aIsSelectionCollapsed,
const bool& aIsAtEndOfLine,
const int32_t& aGranularity);
const int32_t& aGranularity, bool aFromUser);
bool SendFocusEvent(const uint64_t& aID);
#if !defined(XP_WIN)

View File

@ -439,7 +439,8 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvStateChangeEvent(
mozilla::ipc::IPCResult DocAccessibleParent::RecvCaretMoveEvent(
const uint64_t& aID, const LayoutDeviceIntRect& aCaretRect,
const int32_t& aOffset, const bool& aIsSelectionCollapsed,
const bool& aIsAtEndOfLine, const int32_t& aGranularity) {
const bool& aIsAtEndOfLine, const int32_t& aGranularity,
const bool& aFromUser) {
ACQUIRE_ANDROID_LOCK
if (mShutdown) {
return IPC_OK();
@ -463,7 +464,7 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvCaretMoveEvent(
}
PlatformCaretMoveEvent(proxy, aOffset, aIsSelectionCollapsed, aGranularity,
aCaretRect);
aCaretRect, aFromUser);
if (!nsCoreUtils::AccEventObserversExist()) {
return IPC_OK();

View File

@ -110,7 +110,8 @@ class DocAccessibleParent : public RemoteAccessible,
mozilla::ipc::IPCResult RecvCaretMoveEvent(
const uint64_t& aID, const LayoutDeviceIntRect& aCaretRect,
const int32_t& aOffset, const bool& aIsSelectionCollapsed,
const bool& aIsAtEndOfLine, const int32_t& aGranularity) final;
const bool& aIsAtEndOfLine, const int32_t& aGranularity,
const bool& aFromUser) final;
virtual mozilla::ipc::IPCResult RecvTextChangeEvent(
const uint64_t& aID, const nsAString& aStr, const int32_t& aStart,

View File

@ -64,7 +64,7 @@ parent:
LayoutDeviceIntRect aCaretRect,
int32_t aOffset,
bool aIsSelectionCollapsed, bool aIsAtEndOfLine,
int32_t aGranularity);
int32_t aGranularity, bool aFromUser);
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);

View File

@ -121,7 +121,8 @@ void PlatformFocusEvent(Accessible* aTarget,
void PlatformCaretMoveEvent(Accessible* aTarget, int32_t aOffset,
bool aIsSelectionCollapsed, int32_t aGranularity,
const LayoutDeviceIntRect& aCaretRect) {
const LayoutDeviceIntRect& aCaretRect,
bool aFromUser) {
mozAccessible* wrapper = GetNativeFromGeckoAccessible(aTarget);
MOXTextMarkerDelegate* delegate = [MOXTextMarkerDelegate
getOrCreateForDoc:nsAccUtils::DocumentFor(aTarget)];

View File

@ -27,7 +27,8 @@ void a11y::PlatformFocusEvent(Accessible* aTarget,
void a11y::PlatformCaretMoveEvent(Accessible* aTarget, int32_t aOffset,
bool aIsSelectionCollapsed,
int32_t aGranularity,
const LayoutDeviceIntRect& aCaretRect) {}
const LayoutDeviceIntRect& aCaretRect,
bool aFromUser) {}
void a11y::PlatformTextChangeEvent(Accessible*, const nsAString&, int32_t,
uint32_t, bool, bool) {}

View File

@ -95,7 +95,8 @@ void a11y::PlatformFocusEvent(Accessible* aTarget,
void a11y::PlatformCaretMoveEvent(Accessible* aTarget, int32_t aOffset,
bool aIsSelectionCollapsed,
int32_t aGranularity,
const LayoutDeviceIntRect& aCaretRect) {
const LayoutDeviceIntRect& aCaretRect,
bool aFromUser) {
AccessibleWrap::UpdateSystemCaretFor(aTarget, aCaretRect);
MsaaAccessible::FireWinEvent(aTarget,
nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED);