Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gecko_ia2 vbuf backend: Don't unnecessarily calculate labelledByContent (and thus unnecessarily fetch labelledBy). #11205

Merged
merged 2 commits into from
Jun 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,10 +901,6 @@ VBufStorage_fieldNode_t* GeckoVBufBackend_t::fillVBuf(
}
}

//If the name isn't being rendered as the content, then add the name as a field attribute.
if (!nameIsContent && name)
parentNode->addAttribute(L"name", name);

if(nameIsContent) {
// We may render an accessible name for this node if it has been explicitly set or it has no useful content.
parentNode->alwaysRerenderDescendants=true;
Expand Down Expand Up @@ -1149,18 +1145,26 @@ VBufStorage_fieldNode_t* GeckoVBufBackend_t::fillVBuf(
}
}

auto labelId = getLabelIDCached();
if (labelId) {
auto labelControlFieldNode = buffer->getControlFieldNodeWithIdentifier(docHandle, labelId.value());
if (labelControlFieldNode) {
bool isDescendant = buffer->isDescendantNode(parentNode, labelControlFieldNode);
if (isDescendant) {
parentNode->addAttribute(L"labelledByContent", L"true");
//If the name isn't being rendered as the content, then add the name as a field attribute.
if (!nameIsContent && name) {
parentNode->addAttribute(L"name", name);
// Determine whether this node is labelled by its content. We only need to do
// this if the node has a name and the name is explicit, since this is what
// browsers expose in this case.
if (nameIsExplicit) {
auto labelId = getLabelIDCached();
if (labelId) {
auto labelControlFieldNode = buffer->getControlFieldNodeWithIdentifier(docHandle, labelId.value());
if (labelControlFieldNode) {
bool isDescendant = buffer->isDescendantNode(parentNode, labelControlFieldNode);
if (isDescendant) {
parentNode->addAttribute(L"labelledByContent", L"true");
}
}
}
}
}


// Clean up.
if(name)
SysFreeString(name);
Expand Down