GNOME Bugzilla – Bug 731980
Text.GetAttributeRun method overwrites object attributes with the default ones
Last modified: 2014-06-20 18:03:46 UTC
When calling Text.GetAttributeRun method with the parameter includeDefaults set to True, the attributes of the AtkText object are overwritten by the default attributes. I noticed this behavior when checking the attributes of text got from a LibreOffice text document. Steps to reproduce the bug: 1. Run the attached listener script 2. Open the attached test document in LibreOffice/OpenOffice 3. Move the caret on the text document and check the output of the script. Expected output from the script: queried getAttributeRun with includeDefaults=True: family-name:Caladea queried getAttributeRun with includeDefaults=False: family-name:Caladea Actual output of the script: queried getAttributeRun with includeDefaults=True: family-name:Liberation Serif queried getAttributeRun with includeDefaults=False: family-name:Caladea
Created attachment 278853 [details] Test document
Created attachment 278854 [details] Test script
Checking the code of impl_GetAttributeRun inside atk-adaptor/adaptors/text-adaptor.c, one can see that the AtkAttributeSet called "attributes" is initialized with the attributes of the AtkText object. If the parameter includeDefaults is set, the list of defaults attributes of the AtkText object is concatenated at the and of "attributes". My guess is that this list is somehow compacted at a later point, removing the duplicated entries to leave only the last occurrence of each. A simple patch changing the order of the concatenated lists in impl_GetAttributeRun would fix the issue.
Created attachment 278855 [details] [review] Patch, git format
Comment on attachment 278855 [details] [review] Patch, git format Pushed to master as commit 701607. Thanks for the patch.