зеркало из https://github.com/mozilla/gecko-dev.git
Bug 630001, part2 - fix nsAccUtils::TextLength to not use nsIFrame::GetRenderedText, r=davidb, a=betaN
This commit is contained in:
Родитель
4519fdd155
Коммит
be11aca054
|
@ -44,12 +44,12 @@
|
||||||
|
|
||||||
#include "nsAccessibilityService.h"
|
#include "nsAccessibilityService.h"
|
||||||
#include "nsAccessibilityAtoms.h"
|
#include "nsAccessibilityAtoms.h"
|
||||||
#include "nsAccessible.h"
|
|
||||||
#include "nsAccTreeWalker.h"
|
#include "nsAccTreeWalker.h"
|
||||||
#include "nsARIAMap.h"
|
#include "nsARIAMap.h"
|
||||||
#include "nsDocAccessible.h"
|
#include "nsDocAccessible.h"
|
||||||
#include "nsHyperTextAccessible.h"
|
#include "nsHyperTextAccessible.h"
|
||||||
#include "nsHTMLTableAccessible.h"
|
#include "nsHTMLTableAccessible.h"
|
||||||
|
#include "nsTextAccessible.h"
|
||||||
#include "nsXULTreeGridAccessible.h"
|
#include "nsXULTreeGridAccessible.h"
|
||||||
|
|
||||||
#include "nsIDOMXULContainerElement.h"
|
#include "nsIDOMXULContainerElement.h"
|
||||||
|
@ -638,23 +638,9 @@ nsAccUtils::TextLength(nsAccessible *aAccessible)
|
||||||
if (!IsText(aAccessible))
|
if (!IsText(aAccessible))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
nsIFrame *frame = aAccessible->GetFrame();
|
nsTextAccessible* textLeaf = aAccessible->AsTextLeaf();
|
||||||
if (frame && frame->GetType() == nsAccessibilityAtoms::textFrame) {
|
if (textLeaf)
|
||||||
// Ensure that correct text length is calculated (with non-rendered
|
return textLeaf->Text().Length();
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// For list bullets (or anything other accessible which would compute its own
|
// For list bullets (or anything other accessible which would compute its own
|
||||||
// text. They don't have their own frame.
|
// text. They don't have their own frame.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче