OSDN Git Service

Text alignment can now be reported in applications using IAccessible2 such as Mozilla...
authorJames Teh <jamie@jantrid.net>
Wed, 22 Aug 2012 06:24:29 +0000 (16:24 +1000)
committerJames Teh <jamie@jantrid.net>
Wed, 22 Aug 2012 06:24:29 +0000 (16:24 +1000)
Fixes #2612.

nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.cpp
source/NVDAObjects/IAccessible/__init__.py
user_docs/en/changes.t2t

index a96d997..6731080 100755 (executable)
@@ -661,6 +661,10 @@ VBufStorage_fieldNode_t* GeckoVBufBackend_t::fillVBuf(IAccessible2* pacc, VBufSt
                                                // Add text attributes.\r
                                                for(map<wstring,wstring>::const_iterator it=textAttribs.begin();it!=textAttribs.end();++it)\r
                                                        previousNode->addAttribute(it->first,it->second);\r
+                                               #define copyObjectAttribute(attr) if ((IA2AttribsMapIt = IA2AttribsMap.find(attr)) != IA2AttribsMap.end()) \\r
+                                                       previousNode->addAttribute(attr, IA2AttribsMapIt->second);\r
+                                               copyObjectAttribute(L"text-align");\r
+                                               #undef copyObjectAttribute\r
                                        }\r
                                }\r
                                if(i==IA2TextLength)\r
index 4274030..42352cd 100644 (file)
@@ -52,18 +52,13 @@ def getNVDAObjectFromPoint(x,y):
        obj=IAccessible(IAccessibleObject=pacc,IAccessibleChildID=child)\r
        return obj\r
 \r
+FORMAT_OBJECT_ATTRIBS = frozenset({"text-align"})\r
 def normalizeIA2TextFormatField(formatField):\r
        try:\r
                textAlign=formatField.pop("text-align")\r
        except KeyError:\r
                textAlign=None\r
        if textAlign:\r
-               if "right" in textAlign:\r
-                       textAlign="right"\r
-               elif "center" in textAlign:\r
-                       textAlign="center"\r
-               elif "justify" in textAlign:\r
-                       textAlign="justify"\r
                formatField["text-align"]=textAlign\r
        try:\r
                fontWeight=formatField.pop("font-weight")\r
@@ -212,6 +207,12 @@ class IA2TextTextInfo(textInfos.offsets.OffsetsTextInfo):
                                pass\r
                if attribsString:\r
                        formatField.update(IAccessibleHandler.splitIA2Attribs(attribsString))\r
+               objAttribs = self.obj.IA2Attributes\r
+               for attr in FORMAT_OBJECT_ATTRIBS:\r
+                       try:\r
+                               formatField[attr] = objAttribs[attr]\r
+                       except KeyError:\r
+                               pass\r
                normalizeIA2TextFormatField(formatField)\r
                return formatField,(startOffset,endOffset)\r
 \r
index 255cbcc..5d6167a 100644 (file)
@@ -23,7 +23,8 @@
 - Many more features are supported on Freedom Scientific Focus Braille displays such as advance bars, rocker bars and certain dot combinations for common actions. (#2516)\r
 - In applications using IAccessible2 such as Mozilla applications, table row and column headers can now be reported outside of browse mode. (#926)\r
 - Preliminary support for the document control in Microsoft Word 2013. (#2543)\r
\r
+- Text alignment can now be reported in applications using IAccessible2 such as Mozilla applications. (#2612)\r
+\r
 \r
 == Changes ==\r
 - In the NVDA Review Cursor preferences dialog, the Follow keyboard focus option has been renamed to Follow system focus for consistency with terminology used elsewhere in NVDA.\r