зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1838782: Add null checks in HyperTextAccessibleBase::OffsetAtPoint. r=morgan
1. nsAccUtils::DocumentFor might return null if the Accessible is being moved and a client queried it during the move. 2. ChildAtPoint might return null if the point can't be located at all. Differential Revision: https://phabricator.services.mozilla.com/D181213
This commit is contained in:
Родитель
436fca2fe4
Коммит
987c8e49d5
|
@ -298,10 +298,12 @@ int32_t HyperTextAccessibleBase::OffsetAtPoint(int32_t aX, int32_t aY,
|
|||
if (aCoordType != nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE) {
|
||||
p = nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordType, thisAcc);
|
||||
}
|
||||
Accessible* hittestMatch = nsAccUtils::DocumentFor(thisAcc)->ChildAtPoint(
|
||||
p.x, p.y, Accessible::EWhichChildAtPoint::DeepestChild);
|
||||
if (thisAcc == hittestMatch->Parent()) {
|
||||
return 0;
|
||||
if (Accessible* doc = nsAccUtils::DocumentFor(thisAcc)) {
|
||||
Accessible* hittestMatch = doc->ChildAtPoint(
|
||||
p.x, p.y, Accessible::EWhichChildAtPoint::DeepestChild);
|
||||
if (hittestMatch && thisAcc == hittestMatch->Parent()) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче