lok: Don't dump empty aria properties in every JSON element.

They simply bloat the json to no benefit if the properties are
empty, avoid serializing empty values.

Change-Id: I83c780d01820ec39acc85899d45ad9e929ad7e76
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167496
Reviewed-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
(cherry picked from commit 24876e5611abbaec9b2fe5fcbcf4be71a10ee366)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167457
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Michael Meeks
2024-05-10 20:29:32 +01:00
committed by Caolán McNamara
parent 9668c9b8fe
commit fbfeb33b38

View File

@@ -3410,13 +3410,17 @@ void Window::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter)
if(!pAccLabelFor && !pAccLabelledBy)
{
auto aAria = rJsonWriter.startNode("aria");
OUString sAccName = GetAccessibleName();
OUString sAccDesc = GetAccessibleDescription();
OUString sAccString = GetAccessibleName();
rJsonWriter.put("label", sAccString);
sAccString = GetAccessibleDescription();
rJsonWriter.put("description", sAccString);
if (!sAccName.isEmpty() || !sAccDesc.isEmpty())
{
auto aAria = rJsonWriter.startNode("aria");
if (!sAccName.isEmpty())
rJsonWriter.put("label", sAccName);
if (!sAccDesc.isEmpty())
rJsonWriter.put("description", sAccDesc);
}
}
mpWindowImpl->maDumpAsPropertyTreeHdl.Call(rJsonWriter);