Bug 1637908 - Move the clickableAncestor computation further down. r=snorp

There's a few early-return conditions where we don't need to do this computation
at all. So this patch just moves the computation to after the early-returns. No
functional changes intended.

Differential Revision: https://phabricator.services.mozilla.com/D91025
This commit is contained in:
Kartikaya Gupta 2020-09-22 20:43:02 +00:00
Родитель 1de0840710
Коммит 81e7ed672a
1 изменённых файлов: 13 добавлений и 12 удалений

Просмотреть файл

@ -446,18 +446,6 @@ nsIFrame* FindFrameTargetedByInputEvent(
PET_LOG("Retargeting disabled\n");
return target;
}
nsIContent* clickableAncestor = nullptr;
if (target) {
clickableAncestor = GetClickableAncestor(target, nsGkAtoms::body);
if (clickableAncestor) {
PET_LOG("Target %p is clickable\n", target);
// If the target that was directly hit has a clickable ancestor, that
// means it too is clickable. And since it is the same as or a descendant
// of clickableAncestor, it should become the root for the GetClosest
// search.
clickableAncestor = target->GetContent();
}
}
// Do not modify targeting for actual mouse hardware; only for mouse
// events generated by touch-screen hardware.
@ -487,6 +475,19 @@ nsIFrame* FindFrameTargetedByInputEvent(
return target;
}
nsIContent* clickableAncestor = nullptr;
if (target) {
clickableAncestor = GetClickableAncestor(target, nsGkAtoms::body);
if (clickableAncestor) {
PET_LOG("Target %p is clickable\n", target);
// If the target that was directly hit has a clickable ancestor, that
// means it too is clickable. And since it is the same as or a descendant
// of clickableAncestor, it should become the root for the GetClosest
// search.
clickableAncestor = target->GetContent();
}
}
nsIFrame* closestClickable =
GetClosest(aRootFrame, aPointRelativeToRootFrame, targetRect, prefs,
restrictToDescendants, clickableAncestor, candidates);