Bug 1363650 - (intersection-observer) Use content area as the intersection rectangle for custom root with overflow clip. r=mattwoodrow
☠☠ backed out by dbadec2bba3b ☠ ☠
authorTobias Schneider <schneider@jancona.com>
Tue, 20 Jun 2017 16:43:17 -0700
changeset 413969 eeb0a65afa6d5535ac098b89e9b87bf0d626ca30
parent 413968 86f86f9710141b1f2689665c78e0e8917e146f2f
child 413970 37f2e9416b73aa4d3004ac5af7c047f5d12293ca
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1363650
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1363650 - (intersection-observer) Use content area as the intersection rectangle for custom root with overflow clip. r=mattwoodrow
dom/base/DOMIntersectionObserver.cpp
testing/web-platform/meta/intersection-observer/containing-block.html.ini
testing/web-platform/meta/intersection-observer/remove-element.html.ini
testing/web-platform/meta/intersection-observer/same-document-root.html.ini
--- a/dom/base/DOMIntersectionObserver.cpp
+++ b/dom/base/DOMIntersectionObserver.cpp
@@ -263,27 +263,31 @@ DOMIntersectionObserver::Update(nsIDocum
   Element* root = nullptr;
   nsIFrame* rootFrame = nullptr;
   nsRect rootRect;
 
   if (mRoot) {
     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<nsIPresShell> presShell = aDocument->GetShell();
     if (presShell) {
       rootFrame = presShell->GetRootScrollFrame();
       if (rootFrame) {
         nsPresContext* presContext = rootFrame->PresContext();
         while (!presContext->IsRootContentDocument()) {
--- 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
--- 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
--- 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