From cfab4c8f59fc81cbe9f0e0e7d7cc2703755448e3 Mon Sep 17 00:00:00 2001 From: Tobias Schneider Date: Tue, 20 Jun 2017 16:43:17 -0700 Subject: [PATCH] Bug 1363650 - (intersection-observer) Use content area as the intersection rectangle for custom root with overflow clip. r=mattwoodrow --HG-- extra : rebase_source : 28c2af53622e02a2e46f49cd0aed642522d86937 --- dom/base/DOMIntersectionObserver.cpp | 18 +++++++++++------- .../containing-block.html.ini | 1 - .../remove-element.html.ini | 1 - .../same-document-root.html.ini | 1 - 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/dom/base/DOMIntersectionObserver.cpp b/dom/base/DOMIntersectionObserver.cpp index 82badf709e63..3db65c3f0681 100644 --- a/dom/base/DOMIntersectionObserver.cpp +++ b/dom/base/DOMIntersectionObserver.cpp @@ -268,17 +268,21 @@ DOMIntersectionObserver::Update(nsIDocument* aDocument, DOMHighResTimeStamp time root = mRoot; rootFrame = root->GetPrimaryFrame(); if (rootFrame) { + nsRect rootRectRelativeToRootFrame; if (rootFrame->IsScrollFrame()) { + // rootRectRelativeToRootFrame should be the content rect of rootFrame, not including the scrollbars. nsIScrollableFrame* scrollFrame = do_QueryFrame(rootFrame); - rootRect = nsLayoutUtils::TransformFrameRectToAncestor( - rootFrame, - rootFrame->GetContentRectRelativeToSelf(), - scrollFrame->GetScrolledFrame()); + rootRectRelativeToRootFrame = scrollFrame->GetScrollPortRect(); } else { - rootRect = nsLayoutUtils::GetAllInFlowRectsUnion(rootFrame, - nsLayoutUtils::GetContainingBlockForClientRect(rootFrame), - nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS); + // rootRectRelativeToRootFrame should be the content rect of rootFrame. + rootRectRelativeToRootFrame = rootFrame->GetContentRectRelativeToSelf(); } + nsIFrame* containingBlock = + nsLayoutUtils::GetContainingBlockForClientRect(rootFrame); + rootRect = + nsLayoutUtils::TransformFrameRectToAncestor(rootFrame, + rootRectRelativeToRootFrame, + containingBlock); } } else { nsCOMPtr presShell = aDocument->GetShell(); diff --git a/testing/web-platform/meta/intersection-observer/containing-block.html.ini b/testing/web-platform/meta/intersection-observer/containing-block.html.ini index 8a43c8f9c51f..0c70e062bfd5 100644 --- a/testing/web-platform/meta/intersection-observer/containing-block.html.ini +++ b/testing/web-platform/meta/intersection-observer/containing-block.html.ini @@ -1,3 +1,2 @@ [containing-block.html] type: testharness - disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1363650 diff --git a/testing/web-platform/meta/intersection-observer/remove-element.html.ini b/testing/web-platform/meta/intersection-observer/remove-element.html.ini index 3f2bff467631..5ac13ed03b2c 100644 --- a/testing/web-platform/meta/intersection-observer/remove-element.html.ini +++ b/testing/web-platform/meta/intersection-observer/remove-element.html.ini @@ -1,3 +1,2 @@ [remove-element.html] type: testharness - disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1363650 diff --git a/testing/web-platform/meta/intersection-observer/same-document-root.html.ini b/testing/web-platform/meta/intersection-observer/same-document-root.html.ini index 7fa7dfbed932..f834a3c8c18e 100644 --- a/testing/web-platform/meta/intersection-observer/same-document-root.html.ini +++ b/testing/web-platform/meta/intersection-observer/same-document-root.html.ini @@ -1,3 +1,2 @@ [same-document-root.html] type: testharness - disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1363650