summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2024-05-10 20:29:32 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-05-11 14:27:33 +0200
commitfbfeb33b38cc0a644c0315448f6a2d8637a0007e (patch)
tree9da4a88c5437b54de642c65ad4b066eaabf7341d /vcl
parent9668c9b8fe1d4afba335ab1f9d3309ad91bd56da (diff)
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
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/window/window.cxx16
1 files changed, 10 insertions, 6 deletions
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index b7f0ea58181b..3cb43a8a4a05 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -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);