diff options
author | Caolán McNamara <caolanm@redhat.com> | 2022-07-29 12:18:33 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2022-07-30 13:11:16 +0200 |
commit | 0482f156a0ade16d55787ea2ca1c08404f9961e5 (patch) | |
tree | fbf8a028775124bd3ac3d2f7b6e10016eca4fd6c /vcl | |
parent | 640a6488a32e8f682788feb6cab01acfffca7fa7 (diff) |
gtk4: convert AtkObject::accessible-role to something else
we only use AtkObject::accessible-role for "static", but there doesn't
seem to be a good match to anything I can see in gtk4. convert it
to accessible-role of "alert" for lack of a better idea.
Change-Id: Ic0795fed006b827914f1319150a915187188a4db
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137617
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/gtk4/convert3to4.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/vcl/unx/gtk4/convert3to4.cxx b/vcl/unx/gtk4/convert3to4.cxx index 9032ac4692a7..3dc2eae08a11 100644 --- a/vcl/unx/gtk4/convert3to4.cxx +++ b/vcl/unx/gtk4/convert3to4.cxx @@ -762,6 +762,9 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode if (sName == "AtkObject::accessible-name") xName->setNodeValue("label"); + + if (sName == "AtkObject::accessible-role") + xName->setNodeValue("accessible-role"); } else if (xChild->getNodeName() == "child") { @@ -1357,11 +1360,41 @@ ConvertResult Convert3To4(const css::uno::Reference<css::xml::dom::XNode>& xNode xParentObject->insertBefore(xAccessibility, xNode); // move the converted old AtkObject:: properties into a new accessibility parent + css::uno::Reference<css::xml::dom::XNode> xRole; for (css::uno::Reference<css::xml::dom::XNode> xCurrent = xChild->getFirstChild(); xCurrent.is(); xCurrent = xChild->getFirstChild()) { + if (css::uno::Reference<css::xml::dom::XNamedNodeMap> xCurrentMap + = xCurrent->getAttributes()) + { + css::uno::Reference<css::xml::dom::XNode> xName + = xCurrentMap->getNamedItem("name"); + OUString sName(xName->getNodeValue()); + if (sName == "accessible-role") + { + xRole = xCurrent; + } + } + xAccessibility->appendChild(xChild->removeChild(xCurrent)); } + + if (xRole) + { + auto xRoleText = xRole->getFirstChild(); + if (xRoleText.is()) + { + OUString sText = xRoleText->getNodeValue(); + // don't really know what the right solution here should be, but "static" isn't + // a role that exists in gtk4, nothing seems to match exactly, but maybe "alert" + // is a useful place to land for now + if (sText == "static") + xRoleText->setNodeValue("alert"); + } + // move out of accessibility section to property section + xParentObject->insertBefore(xRole->getParentNode()->removeChild(xRole), + xAccessibility); + } } // only create the child box for GtkButton/GtkToggleButton |