From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- accessible/mac/GeckoTextMarker.mm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'accessible/mac/GeckoTextMarker.mm') diff --git a/accessible/mac/GeckoTextMarker.mm b/accessible/mac/GeckoTextMarker.mm index ba3a6e6231..bb787edd28 100644 --- a/accessible/mac/GeckoTextMarker.mm +++ b/accessible/mac/GeckoTextMarker.mm @@ -88,6 +88,13 @@ GeckoTextMarker GeckoTextMarker::MarkerFromIndex(Accessible* aRoot, // Iterate through all segments until we exhausted the index sum // so we can find the segment the index lives in. for (TextLeafRange segment : range) { + if (segment.Start().mAcc->IsMenuPopup() && + (segment.Start().mAcc->State() & states::COLLAPSED)) { + // XXX: Menu collapsed XUL menu popups are in our tree and we need to skip + // them. + continue; + } + if (segment.End().mAcc->Role() == roles::LISTITEM_MARKER) { // XXX: MacOS expects bullets to be in the range's text, but not in // the calculated length! @@ -392,6 +399,12 @@ NSString* GeckoTextMarkerRange::Text() const { for (TextLeafRange segment : range) { TextLeafPoint start = segment.Start(); + if (start.mAcc->IsMenuPopup() && + (start.mAcc->State() & states::COLLAPSED)) { + // XXX: Menu collapsed XUL menu popups are in our tree and we need to skip + // them. + continue; + } if (start.mAcc->IsTextField() && start.mAcc->ChildCount() == 0) { continue; } @@ -441,6 +454,12 @@ NSAttributedString* GeckoTextMarkerRange::AttributedText() const { for (TextLeafRange segment : range) { TextLeafPoint start = segment.Start(); TextLeafPoint attributesNext; + if (start.mAcc->IsMenuPopup() && + (start.mAcc->State() & states::COLLAPSED)) { + // XXX: Menu collapsed XUL menu popups are in our tree and we need to skip + // them. + continue; + } do { if (start.mAcc->IsText()) { attributesNext = start.FindTextAttrsStart(eDirNext, false); -- cgit v1.2.3