OSDN Git Service

gecko_ia2 vbuf backend: Handle the encoded accDescriptions used in Gecko 1.
authorJames Teh <jamie@jantrid.net>
Mon, 6 Jun 2011 00:12:51 +0000 (10:12 +1000)
committerJames Teh <jamie@jantrid.net>
Mon, 6 Jun 2011 00:12:51 +0000 (10:12 +1000)
Fixes reporting of encoded position info when reporting focus/quick navigation in browse mode; e.g. "l1" for heading level 1.
Fixes #1542.

nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.cpp
nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.h

index 4019bd4..a32b6c8 100755 (executable)
@@ -211,6 +211,7 @@ inline void GeckoVBufBackend_t::fillTableCellInfo_IATable2(VBufStorage_controlFi
 void GeckoVBufBackend_t::versionSpecificInit(IAccessible2* pacc) {\r
        // Defaults.\r
        this->shouldDisableTableHeaders = false;\r
+       this->hasEncodedAccDescription = false;\r
 \r
        IServiceProvider* serv = NULL;\r
        if (pacc->QueryInterface(IID_IServiceProvider, (void**)&serv) != S_OK)\r
@@ -238,16 +239,20 @@ void GeckoVBufBackend_t::versionSpecificInit(IAccessible2* pacc) {
        iaApp = NULL;\r
 \r
        if (wcscmp(toolkitName, L"Gecko") == 0) {\r
-               if (wcsncmp(toolkitVersion, L"1.9.2.", 6) == 0) {\r
-                       // Gecko 1.9.2.x.\r
-                       // Retrieve the digits for the final part of the main version number.\r
-                       wstring verPart;\r
-                       for (wchar_t* c = &toolkitVersion[6]; iswdigit(*c); c++)\r
-                               verPart += *c;\r
-                       if (_wtoi(verPart.c_str()) <= 10) {\r
-                               // Gecko <= 1.9.2.10 will crash if we try to retrieve headers on some table cells, so disable them.\r
-                               this->shouldDisableTableHeaders = true;\r
+               if (wcsncmp(toolkitVersion, L"1.", 2) == 0) {\r
+                       if (wcsncmp(toolkitVersion, L"1.9.2.", 6) == 0) {\r
+                               // Gecko 1.9.2.x.\r
+                               // Retrieve the digits for the final part of the main version number.\r
+                               wstring verPart;\r
+                               for (wchar_t* c = &toolkitVersion[6]; iswdigit(*c); c++)\r
+                                       verPart += *c;\r
+                               if (_wtoi(verPart.c_str()) <= 10) {\r
+                                       // Gecko <= 1.9.2.10 will crash if we try to retrieve headers on some table cells, so disable them.\r
+                                       this->shouldDisableTableHeaders = true;\r
+                               }\r
                        }\r
+                       // Gecko 1.x uses accDescription to encode position info as well as the description.\r
+                       this->hasEncodedAccDescription = true;\r
                }\r
        }\r
 \r
@@ -469,7 +474,11 @@ VBufStorage_fieldNode_t* GeckoVBufBackend_t::fillVBuf(IAccessible2* pacc, VBufSt
        LOG_DEBUG(L"getting accDescription");\r
        BSTR description=NULL;\r
        if((res=pacc->get_accDescription(varChild,&description))==S_OK) {\r
-               parentNode->addAttribute(L"description",description);\r
+               if(this->hasEncodedAccDescription) {\r
+                       if(wcsncmp(description,L"Description: ",13)==0)\r
+                               parentNode->addAttribute(L"description",&description[13]);\r
+               } else\r
+                       parentNode->addAttribute(L"description",description);\r
                SysFreeString(description);\r
        }\r
        // Handle table cell information.\r
index d6fcf7a..570ba4d 100755 (executable)
@@ -27,6 +27,7 @@ class GeckoVBufBackend_t: public VBufBackend_t {
        void fillTableCellInfo_IATable2(VBufStorage_controlFieldNode_t* node, IAccessibleTableCell* paccTableCell);\r
 \r
        bool shouldDisableTableHeaders;\r
+       bool hasEncodedAccDescription;\r
 \r
        protected:\r
 \r