getTextAtOffset by line fails with wrapped spans that have accessibles. r=parente
authoraaronleventhal@moonset.net
Wed, 09 May 2007 10:42:42 -0700
changeset 1318 8db2d344f6e48bbadc3fd504083e93a177651a5f
parent 1317 429feda9697b658ebe4daf528affbc27dc55ab6a
child 1319 bafed2a5982e4d951d3a51976010585ea2eafbfc
push idunknown
push userunknown
push dateunknown
reviewersparente
milestone1.9a5pre
getTextAtOffset by line fails with wrapped spans that have accessibles. r=parente
accessible/src/html/nsHyperTextAccessible.cpp
--- a/accessible/src/html/nsHyperTextAccessible.cpp
+++ b/accessible/src/html/nsHyperTextAccessible.cpp
@@ -522,19 +522,20 @@ nsresult nsHyperTextAccessible::DOMPoint
       childAccessible = descendantAccessible;
       break;
     }
     // This offset no longer applies because the passed-in text object is not a child
     // of the hypertext. This happens when there are nested hypertexts, e.g.
     // <div>abc<h1>def</h1>ghi</div>
     // If the passed-in DOM point was not on a direct child of the hypertext, we will
     // return the offset for that entire hypertext
-    // If the offset was at the end of the passed in object, we will now use 1 for
-    // addTextOffset, to put us after the embedded object char for that child hypertext
-    addTextOffset = (TextLength(descendantAccessible) == addTextOffset) ? 1 : 0;
+    // If the offset was after the first character of the passed in object, we will now use 1 for
+    // addTextOffset, to put us after the embedded object char. We'll only treat the offset as
+    // before the embedded object char if we end at the very beginning of the child.
+    addTextOffset = addTextOffset > 0;
     descendantAccessible = parentAccessible;
   }  
 
   // Loop through, adding offsets until we reach childAccessible
   // If childAccessible is null we will end up adding up the entire length of
   // the hypertext, which is good -- it just means our offset node
   // came after the last accessible child's node
   nsCOMPtr<nsIAccessible> accessible;