Bug 1307555 - Create a hit test info item for a scroll frame's scrolled frame that's not clipped to the displayport. r=mstange draft
authorBotond Ballo <botond@mozilla.com>
Mon, 26 Feb 2018 19:03:32 -0500
changeset 762734 eecfc53d0951112d2e6cb8bc8aa62ae27a4d9d93
parent 760101 314710c9de4ed6782e1c46e28a8852446a84bfa2
child 762735 4f2aa932af8c1c8332d49aeaace687c71a4d58bc
push id101252
push userbballo@mozilla.com
push dateFri, 02 Mar 2018 23:29:51 +0000
reviewersmstange
bugs1307555
milestone60.0a1
Bug 1307555 - Create a hit test info item for a scroll frame's scrolled frame that's not clipped to the displayport. r=mstange MozReview-Commit-ID: 5MJg4zqxSAk
layout/generic/nsGfxScrollFrame.cpp
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -3576,16 +3576,32 @@ ScrollFrameHelper::BuildDisplayList(nsDi
     if (mWillBuildScrollableLayer && aBuilder->IsPaintingToWindow()) {
       asrSetter.EnterScrollFrame(sf);
     }
 
     if (mIsScrollableLayerInRootContainer) {
       aBuilder->SetActiveScrolledRootForRootScrollframe(aBuilder->CurrentActiveScrolledRoot());
     }
 
+    if (mWillBuildScrollableLayer) {
+      // Create a hit test info item for the scrolled content that's not
+      // clipped to the displayport. This ensures that within the bounds
+      // of the scroll frame, the scrolled content is always hit, even
+      // if we are checkerboarding.
+      if (aBuilder->BuildCompositorHitTestInfo()) {
+        CompositorHitTestInfo info = mScrolledFrame->GetCompositorHitTestInfo(aBuilder);
+        if (info != CompositorHitTestInfo::eInvisibleToHitTest) {
+          nsDisplayCompositorHitTestInfo* hitInfo =
+              MakeDisplayItem<nsDisplayCompositorHitTestInfo>(aBuilder, mScrolledFrame, info, 1);
+          aBuilder->SetCompositorHitTestInfo(hitInfo);
+          scrolledContent.BorderBackground()->AppendToTop(hitInfo);
+        }
+      }
+    }
+
     {
       // Clip our contents to the unsnapped scrolled rect. This makes sure that
       // we don't have display items over the subpixel seam at the edge of the
       // scrolled area.
       DisplayListClipState::AutoSaveRestore scrolledRectClipState(aBuilder);
       nsRect scrolledRectClip =
         GetUnsnappedScrolledRectInternal(mScrolledFrame->GetScrollableOverflowRect(),
                                          mScrollPort.Size()) + mScrolledFrame->GetPosition();