diff --git a/accessible/src/base/nsAccUtils.cpp b/accessible/src/base/nsAccUtils.cpp index d5052ff6052..94b2bed32d4 100644 --- a/accessible/src/base/nsAccUtils.cpp +++ b/accessible/src/base/nsAccUtils.cpp @@ -44,12 +44,12 @@ #include "nsAccessibilityService.h" #include "nsAccessibilityAtoms.h" -#include "nsAccessible.h" #include "nsAccTreeWalker.h" #include "nsARIAMap.h" #include "nsDocAccessible.h" #include "nsHyperTextAccessible.h" #include "nsHTMLTableAccessible.h" +#include "nsTextAccessible.h" #include "nsXULTreeGridAccessible.h" #include "nsIDOMXULContainerElement.h" @@ -638,23 +638,9 @@ nsAccUtils::TextLength(nsAccessible *aAccessible) if (!IsText(aAccessible)) return 1; - nsIFrame *frame = aAccessible->GetFrame(); - if (frame && frame->GetType() == nsAccessibilityAtoms::textFrame) { - // Ensure that correct text length is calculated (with non-rendered - // whitespace chars not counted). - nsIContent *content = frame->GetContent(); - if (content) { - PRUint32 length; - nsresult rv = nsHyperTextAccessible:: - ContentToRenderedOffset(frame, content->TextLength(), &length); - if (NS_FAILED(rv)) { - NS_NOTREACHED("Failed to get rendered offset!"); - return 0; - } - - return length; - } - } + nsTextAccessible* textLeaf = aAccessible->AsTextLeaf(); + if (textLeaf) + return textLeaf->Text().Length(); // For list bullets (or anything other accessible which would compute its own // text. They don't have their own frame.