From 0ef0a50137b3af7d4b2f867bc69c251a18c22d48 Mon Sep 17 00:00:00 2001 From: James Teh Date: Fri, 30 Nov 2012 11:43:53 +1000 Subject: [PATCH] In browse mode in Mozilla applications, updates to tables are now rendered correctly. For example, in updated cells, row and column coordinates are reported and table navigation works as it should. Fixes #2784. --- nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.cpp | 54 +++++++++++++++++++++---- user_docs/en/changes.t2t | 1 + 2 files changed, 47 insertions(+), 8 deletions(-) diff --git a/nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.cpp b/nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.cpp index ce6f70bb2..8ff3cc131 100755 --- a/nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.cpp +++ b/nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.cpp @@ -82,6 +82,38 @@ template inline void fillTableCounts(VBufStorage_controlFiel } } +inline int updateTableCounts(IAccessibleTableCell* tableCell, VBufStorage_buffer_t* tableBuffer) { + IUnknown* unk = NULL; + if (tableCell->get_table(&unk) != S_OK || !unk) + return 0; + IAccessible2* acc = NULL; + HRESULT res; + res = unk->QueryInterface(IID_IAccessible2, (void**)&acc); + unk->Release(); + if (res != S_OK || !acc) + return 0; + int docHandle, id; + if (acc->get_windowHandle((HWND*)&docHandle) != S_OK + || acc->get_uniqueID((long*)&id) != S_OK) { + acc->Release(); + return 0; + } + VBufStorage_controlFieldNode_t* node = tableBuffer->getControlFieldNodeWithIdentifier(docHandle, id); + if (!node) { + acc->Release(); + return 0; + } + IAccessibleTable2* table = NULL; + if (acc->QueryInterface(IID_IAccessibleTable2, (void**)&table) != S_OK || !table) { + acc->Release(); + return 0; + } + fillTableCounts(node, acc, table); + table->Release(); + acc->Release(); + return id; +} + inline void fillTableCellInfo_IATable(VBufStorage_controlFieldNode_t* node, IAccessibleTable* paccTable, const wstring& cellIndexStr) { wostringstream s; long cellIndex = _wtoi(cellIndexStr.c_str()); @@ -489,22 +521,28 @@ VBufStorage_fieldNode_t* GeckoVBufBackend_t::fillVBuf(IAccessible2* pacc, // Handle table cell information. IAccessibleTableCell* paccTableCell = NULL; - // If paccTable is not NULL, it is the table interface for the table above this object. - if ((paccTable2 || paccTable) && ( + // For IAccessibleTable, we must always be passed the table interface by the caller. + // For IAccessibleTable2, we can always obtain the cell interface, + // which allows us to handle updates to table cells. + if ( pacc->QueryInterface(IID_IAccessibleTableCell, (void**)&paccTableCell) == S_OK || // IAccessibleTable2 - (IA2AttribsMapIt = IA2AttribsMap.find(L"table-cell-index")) != IA2AttribsMap.end() // IAccessibleTable - )) { - // tableID is the IAccessible2::uniqueID for paccTable. - s << tableID; - parentNode->addAttribute(L"table-id", s.str()); - s.str(L""); + (paccTable && (IA2AttribsMapIt = IA2AttribsMap.find(L"table-cell-index")) != IA2AttribsMap.end()) // IAccessibleTable + ) { if (paccTableCell) { // IAccessibleTable2 this->fillTableCellInfo_IATable2(parentNode, paccTableCell); + if (!paccTable2) { + // This is an update; we're not rendering the entire table. + tableID = updateTableCounts(paccTableCell, this); + } paccTableCell->Release(); paccTableCell = NULL; } else // IAccessibleTable fillTableCellInfo_IATable(parentNode, paccTable, IA2AttribsMapIt->second); + // tableID is the IAccessible2::uniqueID for paccTable. + s << tableID; + parentNode->addAttribute(L"table-id", s.str()); + s.str(L""); // We're now within a cell, so descendant nodes shouldn't refer to this table anymore. paccTable = NULL; paccTable2 = NULL; diff --git a/user_docs/en/changes.t2t b/user_docs/en/changes.t2t index ecc078c90..ea0239f4b 100644 --- a/user_docs/en/changes.t2t +++ b/user_docs/en/changes.t2t @@ -16,6 +16,7 @@ == Bug Fixes == - The quick navigation keys for jumping to the next or previous separator in Browse Mode now works in Internet Explorer and other MSHTML controls. (#2781) - If NVDA falls back to eSpeak or no speech due to a configured speech synthesizer failing when NVDA starts, the configuration is no longer updated to set the fallback synthesizer as the configured choice, meaning that now the original synthesizer will be tried again next time NVDA starts. (#2589) +- In browse mode in Mozilla applications, updates to tables are now rendered correctly. For example, in updated cells, row and column coordinates are reported and table navigation works as it should. (#2784) = 2012.3 = -- 2.11.0