Bug 1553022 - Stop descending down frame tree if we met another scrollable frame when we collect snap positions. r=botond
☠☠ backed out by 97fd39fe7f58 ☠ ☠
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Thu, 23 May 2019 09:44:58 +0000
changeset 475169 9a556ee9f0398585c6fdf2fe7193907de92e247e
parent 475168 c2327979957d727efdea1d7f87d9f044aace1da8
child 475170 d136380e4945c8081a2952760143a0bb1e36df7c
push id36057
push useraciure@mozilla.com
push dateThu, 23 May 2019 21:52:03 +0000
treeherdermozilla-central@d551d37b9ad0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1553022
milestone69.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 1553022 - Stop descending down frame tree if we met another scrollable frame when we collect snap positions. r=botond From the last sentence of "3. Scroll Snap Model" [1] in the spec; Snap positions only affect the nearest ancestor scroll container on the element's containing block chain. [1] https://drafts.csswg.org/css-scroll-snap-1/#overview Differential Revision: https://phabricator.services.mozilla.com/D31947
layout/generic/nsGfxScrollFrame.cpp
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -6742,16 +6742,22 @@ static void AppendScrollPositionsForSnap
  * ignored.
  */
 static void CollectScrollPositionsForSnap(
     nsIFrame* aFrame, nsIFrame* aScrolledFrame, const nsRect& aScrolledRect,
     const nsMargin& aScrollPadding, const Maybe<nsRect>& aSnapport,
     WritingMode aWritingModeOnScroller, ScrollSnapInfo& aSnapInfo) {
   MOZ_ASSERT(StaticPrefs::layout_css_scroll_snap_v1_enabled());
 
+  // Snap positions only affect the nearest ancestor scroll container on the
+  // element's containing block chain.
+  if (nsIScrollableFrame* sf = do_QueryFrame(aFrame)) {
+    return;
+  }
+
   nsIFrame::ChildListIterator childLists(aFrame);
   for (; !childLists.IsDone(); childLists.Next()) {
     nsFrameList::Enumerator childFrames(childLists.CurrentList());
     for (; !childFrames.AtEnd(); childFrames.Next()) {
       nsIFrame* f = childFrames.get();
 
       const nsStyleDisplay* styleDisplay = f->StyleDisplay();
       if (styleDisplay->mScrollSnapAlign.inline_ !=