зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1821618 - Make norolluponanchor="true" work on Wayland moved-to-rect popups. r=stransky
Use the unstransformed anchor rect to get the right original anchor rect. Differential Revision: https://phabricator.services.mozilla.com/D172260
This commit is contained in:
Родитель
87d3776d86
Коммит
c15931d28e
|
@ -368,13 +368,23 @@ bool nsXULPopupManager::RollupInternal(RollupKind aKind,
|
|||
nsMenuPopupFrame* popupFrame = item->Frame();
|
||||
CSSIntRect anchorRect = [&] {
|
||||
if (popupFrame->IsAnchored()) {
|
||||
// Check if the popup has a screen anchor rectangle. If not, get the
|
||||
// Check if the popup has an anchor rectangle set. If not, get the
|
||||
// rectangle from the anchor element.
|
||||
auto r = popupFrame->GetScreenAnchorRect();
|
||||
if (r.x != -1 && r.y != -1) {
|
||||
// Prefer the untransformed anchor rect, so as to account for Wayland
|
||||
// properly. Note we still need to check GetScreenAnchorRect() tho, so
|
||||
// as to detect whether the anchor came from the popup opening call,
|
||||
// or from an element (in which case we want to take the code-path
|
||||
// below)..
|
||||
auto untransformed = popupFrame->GetUntransformedAnchorRect();
|
||||
if (!untransformed.IsEmpty()) {
|
||||
return CSSIntRect::FromAppUnitsRounded(untransformed);
|
||||
}
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
auto* anchor = Element::FromNodeOrNull(popupFrame->GetAnchor());
|
||||
if (!anchor) {
|
||||
return CSSIntRect();
|
||||
|
|
Загрузка…
Ссылка в новой задаче