Bug 1655741 - Don't assert that there's a primary frame as long as there's a scroll frame for the root scroll frame. r=mats

There's no correctness issue here, but the assertion is just wrong. For
the scrolling element we may get the root scrollable frame even though
the primary frame is null.

Differential Revision: https://phabricator.services.mozilla.com/D85160
This commit is contained in:
Emilio Cobos Álvarez
2020-07-29 17:28:09 +00:00
parent 989327d84f
commit 301fc8c85a
2 changed files with 22 additions and 7 deletions

View File

@@ -857,15 +857,19 @@ nsRect Element::GetClientAreaRect() {
nsIFrame* frame;
if (nsIScrollableFrame* sf = GetScrollFrame(&frame)) {
MOZ_ASSERT(frame);
nsRect scrollPort = sf->GetScrollPortRect();
nsIFrame* scrollableAsFrame = do_QueryFrame(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));
if (!sf->IsRootScrollFrameOfDocument()) {
MOZ_ASSERT(frame);
nsIFrame* scrollableAsFrame = do_QueryFrame(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) {
scrollPort.MoveBy(scrollableAsFrame->GetOffsetTo(frame));
}
}
// The scroll port value might be expanded to the minimum scale size, we
// should limit the size to the ICB in such cases.
scrollPort.SizeTo(sf->GetLayoutSize());