Bug 1655398 - Don't move the client area rect for the root scroll frame. r=mats

The spec really asks us to put the rect at GetUsedBorder().{top,left} in
this case, but I don't think that really makes sense, see
https://github.com/w3c/csswg-drafts/issues/5363.

Differential Revision: https://phabricator.services.mozilla.com/D84959
This commit is contained in:
Emilio Cobos Álvarez
2020-07-27 20:07:19 +00:00
parent 1abfba8c54
commit 5ca94840ad
2 changed files with 33 additions and 2 deletions

View File

@@ -860,8 +860,10 @@ nsRect Element::GetClientAreaRect() {
MOZ_ASSERT(frame);
nsRect scrollPort = sf->GetScrollPortRect();
nsIFrame* scrollableAsFrame = do_QueryFrame(sf);
if (frame != scrollableAsFrame) {
// We want the offset to be relative to `frame`, not `sf`.
// We want the offset to be relative to `frame`, not `sf`... Except for the
// root scroll frame, which is an ancestor of frame rather than a descendant
// and thus this wouldn't particularly make sense.
if (frame != scrollableAsFrame && !sf->IsRootScrollFrameOfDocument()) {
scrollPort.MoveBy(scrollableAsFrame->GetOffsetTo(frame));
}
// The scroll port value might be expanded to the minimum scale size, we