mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 16:22:00 +00:00
Bug 1694573 part 4: Make PlatformTextSelectionEvent take TextRange instead of TextRangeData. r=eeejay
TextRangeData is specific to IPDL and thus RemoteAccessible. Differential Revision: https://phabricator.services.mozilla.com/D183703
This commit is contained in:
parent
ecc3d38304
commit
4458083853
@ -126,9 +126,9 @@ bool LocalizeString(const nsAString& aToken, nsAString& aLocalized);
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_COCOA
|
||||
class TextRangeData;
|
||||
void PlatformTextSelectionChangeEvent(
|
||||
Accessible* aTarget, const nsTArray<TextRangeData>& aSelection);
|
||||
class TextRange;
|
||||
void PlatformTextSelectionChangeEvent(Accessible* aTarget,
|
||||
const nsTArray<TextRange>& aSelection);
|
||||
|
||||
void PlatformRoleChangedEvent(Accessible* aTarget, const a11y::role& aRole,
|
||||
uint8_t aRoleMapEntryIndex);
|
||||
|
@ -707,7 +707,9 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvTextSelectionChangeEvent(
|
||||
mTextSelections.AppendElements(aSelection);
|
||||
|
||||
#ifdef MOZ_WIDGET_COCOA
|
||||
PlatformTextSelectionChangeEvent(target, aSelection);
|
||||
AutoTArray<TextRange, 1> ranges;
|
||||
SelectionRanges(&ranges);
|
||||
PlatformTextSelectionChangeEvent(target, ranges);
|
||||
#else
|
||||
PlatformEvent(target, nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED);
|
||||
#endif
|
||||
@ -1083,6 +1085,7 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvFocusEvent(
|
||||
}
|
||||
|
||||
void DocAccessibleParent::SelectionRanges(nsTArray<TextRange>* aRanges) const {
|
||||
aRanges->SetCapacity(mTextSelections.Length());
|
||||
for (const auto& data : mTextSelections) {
|
||||
// Selection ranges should usually be in sync with the tree. However, tree
|
||||
// and selection updates happen using separate IPDL calls, so it's possible
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "mozTextAccessible.h"
|
||||
#include "MOXWebAreaAccessible.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "TextRange.h"
|
||||
|
||||
#include "nsAppShell.h"
|
||||
#include "nsCocoaUtils.h"
|
||||
@ -168,20 +169,15 @@ void PlatformSelectionEvent(Accessible* aTarget, Accessible* aWidget,
|
||||
}
|
||||
}
|
||||
|
||||
void PlatformTextSelectionChangeEvent(
|
||||
Accessible* aTarget, const nsTArray<TextRangeData>& aSelection) {
|
||||
void PlatformTextSelectionChangeEvent(Accessible* aTarget,
|
||||
const nsTArray<TextRange>& aSelection) {
|
||||
if (aSelection.Length()) {
|
||||
// XXX Don't assume aTarget is remote.
|
||||
MOXTextMarkerDelegate* delegate = [MOXTextMarkerDelegate
|
||||
getOrCreateForDoc:aTarget->AsRemote()->Document()];
|
||||
DocAccessibleParent* doc = aTarget->AsRemote()->Document();
|
||||
RemoteAccessible* startContainer =
|
||||
doc->GetAccessible(aSelection[0].StartID());
|
||||
RemoteAccessible* endContainer = doc->GetAccessible(aSelection[0].EndID());
|
||||
getOrCreateForDoc:nsAccUtils::DocumentFor(aTarget)];
|
||||
// Cache the selection.
|
||||
[delegate setSelectionFrom:startContainer
|
||||
[delegate setSelectionFrom:aSelection[0].StartContainer()
|
||||
at:aSelection[0].StartOffset()
|
||||
to:endContainer
|
||||
to:aSelection[0].EndContainer()
|
||||
at:aSelection[0].EndOffset()];
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user