From a241661862ef35774f560e4068a895dcaa6f2113 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Mon, 30 Sep 2024 13:37:14 +0100 Subject: [PATCH] wina11y: Bridge focusable state as is Drop all the special-casing of particular (parent) roles etc. when considering whether or not to set the focusable state. Instead, fully rely on the AccessibleStateType::FOCUSABLE state as reported by the underlying XAccessibleContext and report the IAccessible/MSAA STATE_SYSTEM_FOCUSABLE state whenever the former is set. I tend to think that if this this change results in unexpected behavior, it is likely that issues should best be fixed in the underlying XAccessibleContext implementations rather than worked around in the Windows a11y bridge. Change-Id: I6e2eee3a9cbe779de3b3d349f23efc6a68a8344b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174278 Tested-by: Jenkins Reviewed-by: Michael Weghorn --- winaccessibility/source/service/AccObject.cxx | 58 +------------------ 1 file changed, 3 insertions(+), 55 deletions(-) diff --git a/winaccessibility/source/service/AccObject.cxx b/winaccessibility/source/service/AccObject.cxx index acc8cfae053d..32d06729f309 100644 --- a/winaccessibility/source/service/AccObject.cxx +++ b/winaccessibility/source/service/AccObject.cxx @@ -675,7 +675,6 @@ void AccObject::UpdateState() if(!(isShowing && isVisible) ) { m_pIMAcc->IncreaseState( STATE_SYSTEM_INVISIBLE ); - m_pIMAcc->DecreaseState( STATE_SYSTEM_FOCUSABLE ); } } else @@ -720,62 +719,11 @@ void AccObject::UpdateState() break; } - if( isEnable ) - { + if (isFocusable) + IncreaseState(STATE_SYSTEM_FOCUSABLE); - if (!(m_accRole == FILLER || m_accRole == END_NOTE || m_accRole == FOOTER || m_accRole == FOOTNOTE || m_accRole == GROUP_BOX || m_accRole == RULER - || m_accRole == HEADER || m_accRole == ICON || m_accRole == INTERNAL_FRAME || m_accRole == LABEL || m_accRole == LAYERED_PANE - || m_accRole == SCROLL_BAR || m_accRole == SCROLL_PANE || m_accRole == SPLIT_PANE || m_accRole == STATIC || m_accRole == STATUS_BAR - || m_accRole == TOOL_TIP || m_accRole == NOTIFICATION)) - { - if (m_accRole == SEPARATOR) - { - if( ( m_pParentObj != nullptr ) && ( MENU == m_pParentObj->m_accRole || POPUP_MENU == m_pParentObj->m_accRole )) - IncreaseState(AccessibleStateType::FOCUSABLE); - } - - else if (m_accRole == TABLE_CELL || m_accRole == TABLE || m_accRole == PANEL || m_accRole == OPTION_PANE || - m_accRole == COLUMN_HEADER) - { - if (isFocusable) - IncreaseState(AccessibleStateType::FOCUSABLE); - } - else - { - if(bIsMenuItem) - { - if ( isShowing && isVisible) - IncreaseState(AccessibleStateType::FOCUSABLE); - } - else - { - IncreaseState(AccessibleStateType::FOCUSABLE); - } - } - } - } - else - { + if (!isEnable) m_pIMAcc->IncreaseState( STATE_SYSTEM_UNAVAILABLE ); - if( !((m_accRole == MENU_ITEM) || - (m_accRole == RADIO_MENU_ITEM) || - (m_accRole == CHECK_MENU_ITEM)) ) - { - if (m_accRole == TOGGLE_BUTTON || m_accRole == PUSH_BUTTON || m_accRole == BUTTON_DROPDOWN) - { - if(( m_pParentObj != nullptr )&& (TOOL_BAR == m_pParentObj->m_accRole ) ) - IncreaseState(AccessibleStateType::FOCUSABLE); - else - DecreaseState(AccessibleStateType::FOCUSABLE); - } - else - DecreaseState(AccessibleStateType::FOCUSABLE); - } - else if( isShowing || isVisible ) - { - IncreaseState(AccessibleStateType::FOCUSABLE); - } - } switch(m_accRole) {