We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 01f24bd commit 7d8c55eCopy full SHA for 7d8c55e
1 file changed
platforms/atspi-common/src/node.rs
@@ -847,9 +847,17 @@ impl PlatformNode {
847
}
848
849
pub fn index_in_parent(&self) -> Result<i32> {
850
- self.resolve(|node| {
851
- i32::try_from(node.preceding_filtered_siblings(&filter).count())
852
- .map_err(|_| Error::IndexOutOfRange)
+ self.resolve_with_context(|node, _tree, context| {
+ if node.filtered_parent(&filter).is_some() {
+ i32::try_from(node.preceding_filtered_siblings(&filter).count())
853
+ .map_err(|_| Error::IndexOutOfRange)
854
+ } else {
855
+ let index = context
856
+ .read_app_context()
857
+ .adapter_index(self.adapter_id)
858
+ .map_err(|_| Error::Defunct)?;
859
+ i32::try_from(index).map_err(|_| Error::IndexOutOfRange)
860
+ }
861
})
862
863
0 commit comments