зеркало из https://github.com/mozilla/pjs.git
Bug 630001, part2 - fix nsAccUtils::TextLength to not use nsIFrame::GetRenderedText, r=davidb, a=betaN
This commit is contained in:
Родитель
99feef5891
Коммит
5004acc00f
|
@ -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.
|
||||
|
|
Загрузка…
Ссылка в новой задаче