зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1650740 - Don't allow text range retrieval when doc tree is not fully constructed. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D82410
This commit is contained in:
Родитель
07988f4e3a
Коммит
e1559a9b24
|
@ -199,6 +199,7 @@ bool GeckoTextMarkerRange::TextInternal(nsAString& aText, AccessibleOrProxy aCur
|
|||
// Find the first link that is at or after the start offset.
|
||||
for (int32_t i = 0; i < linkCount; i++) {
|
||||
AccessibleOrProxy link = LinkAt(aCurrent, i);
|
||||
MOZ_ASSERT(!link.IsNull());
|
||||
linkStartOffset = StartOffset(link);
|
||||
if (aStartIntlOffset <= linkStartOffset) {
|
||||
next = link;
|
||||
|
|
|
@ -60,6 +60,23 @@ static nsDataHashtable<nsUint64HashKey, MOXTextMarkerDelegate*> sDelegates;
|
|||
}
|
||||
|
||||
- (NSString*)moxStringForTextMarkerRange:(id)textMarkerRange {
|
||||
if (mGeckoDocAccessible.IsAccessible()) {
|
||||
if (!mGeckoDocAccessible.AsAccessible()->AsDoc()->HasLoadState(
|
||||
DocAccessible::eTreeConstructed)) {
|
||||
// If the accessible tree is still being constructed the text tree
|
||||
// is not in a traversable state yet.
|
||||
return @"";
|
||||
}
|
||||
} else {
|
||||
if (mGeckoDocAccessible.AsProxy()->State() & states::STALE) {
|
||||
// In the proxy case we don't have access to load state,
|
||||
// so we need to use the less granular generic STALE state
|
||||
// this state also includes DOM unloaded, which isn't ideal.
|
||||
// Since we really only care if the a11y tree is loaded.
|
||||
return @"";
|
||||
}
|
||||
}
|
||||
|
||||
mozilla::a11y::GeckoTextMarkerRange range(mGeckoDocAccessible, textMarkerRange);
|
||||
return range.Text();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче