зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1813980: Check IsDoc before Parent in RemoteAccessibleBase::ApplyCrossDocOffset. r=morgan
We call this function on every ancestor when calculating bounds. RemoteParent() currently requires a hash lookup, so it's more efficient to early return for !IsDoc() first. This is a micro-optimisation, but it might have some impact given that we call this on every ancestor, especially when hit testing, where we call Bounds() a lot. As a bit of drive-by cleanup, use RemoteParent() rather than calling Parent() and IsRemote/AsRemote(). Differential Revision: https://phabricator.services.mozilla.com/D168346
This commit is contained in:
Родитель
1278600686
Коммит
9dfda5ccb0
|
@ -464,19 +464,19 @@ Maybe<nsRect> RemoteAccessibleBase<Derived>::RetrieveCachedBounds() const {
|
|||
|
||||
template <class Derived>
|
||||
void RemoteAccessibleBase<Derived>::ApplyCrossDocOffset(nsRect& aBounds) const {
|
||||
Accessible* parentAcc = Parent();
|
||||
if (!parentAcc || !parentAcc->IsRemote() || !parentAcc->IsOuterDoc()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!IsDoc()) {
|
||||
// We should only apply cross-doc offsets to documents. If we're anything
|
||||
// else, return early here.
|
||||
return;
|
||||
}
|
||||
|
||||
RemoteAccessible* parentAcc = RemoteParent();
|
||||
if (!parentAcc || !parentAcc->IsOuterDoc()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Maybe<const nsTArray<int32_t>&> maybeOffset =
|
||||
parentAcc->AsRemote()->mCachedFields->GetAttribute<nsTArray<int32_t>>(
|
||||
parentAcc->mCachedFields->GetAttribute<nsTArray<int32_t>>(
|
||||
nsGkAtoms::crossorigin);
|
||||
if (!maybeOffset) {
|
||||
return;
|
||||
|
|
Загрузка…
Ссылка в новой задаче