mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1862802 part 2: Support find in page on Android using only caret events instead of converting them to virtual cursor change events. r=eeejay
Depends on D192642 Differential Revision: https://phabricator.services.mozilla.com/D192643
This commit is contained in:
parent
cfdccbd78f
commit
ea3ee1204a
@ -65,25 +65,6 @@ nsresult AccessibleWrap::HandleAccEvent(AccEvent* aEvent) {
|
||||
static_cast<DocAccessibleWrap*>(accessible->Document());
|
||||
if (doc) {
|
||||
switch (aEvent->GetEventType()) {
|
||||
case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED: {
|
||||
if (accessible != aEvent->Document() && !aEvent->IsFromUserInput()) {
|
||||
AccCaretMoveEvent* caretEvent = downcast_accEvent(aEvent);
|
||||
HyperTextAccessible* ht = AsHyperText();
|
||||
// Pivot to the caret's position if it has an expanded selection.
|
||||
// This is used mostly for find in page.
|
||||
if ((ht && ht->SelectionCount())) {
|
||||
DOMPoint point =
|
||||
AsHyperText()->OffsetToDOMPoint(caretEvent->GetCaretOffset());
|
||||
if (LocalAccessible* newPos =
|
||||
doc->GetAccessibleOrContainer(point.node)) {
|
||||
static_cast<AccessibleWrap*>(newPos)->PivotTo(
|
||||
java::SessionAccessibility::HTML_GRANULARITY_DEFAULT, true,
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case nsIAccessibleEvent::EVENT_SCROLLING_START: {
|
||||
accessible->PivotTo(
|
||||
java::SessionAccessibility::HTML_GRANULARITY_DEFAULT, true, true);
|
||||
|
@ -146,10 +146,23 @@ void a11y::PlatformCaretMoveEvent(Accessible* aTarget, int32_t aOffset,
|
||||
bool aFromUser) {
|
||||
RefPtr<SessionAccessibility> sessionAcc =
|
||||
SessionAccessibility::GetInstanceFor(aTarget);
|
||||
|
||||
if (sessionAcc) {
|
||||
sessionAcc->SendTextSelectionChangedEvent(aTarget, aOffset);
|
||||
if (!sessionAcc) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!aTarget->IsDoc() && !aFromUser && !aIsSelectionCollapsed) {
|
||||
// Pivot to the caret's position if it has an expanded selection.
|
||||
// This is used mostly for find in page.
|
||||
Accessible* leaf = TextLeafPoint::GetCaret(aTarget).ActualizeCaret().mAcc;
|
||||
MOZ_ASSERT(leaf);
|
||||
if (Accessible* result = AccessibleWrap::DoPivot(
|
||||
leaf, java::SessionAccessibility::HTML_GRANULARITY_DEFAULT, true,
|
||||
true)) {
|
||||
sessionAcc->SendAccessibilityFocusedEvent(result);
|
||||
}
|
||||
}
|
||||
|
||||
sessionAcc->SendTextSelectionChangedEvent(aTarget, aOffset);
|
||||
}
|
||||
|
||||
void a11y::PlatformTextChangeEvent(Accessible* aTarget, const nsAString& aStr,
|
||||
|
Loading…
Reference in New Issue
Block a user