Commit 0f4e8945 authored by Kartikaya Gupta's avatar Kartikaya Gupta
Browse files

Bug 1389138 - Add helper to track the topmost scroll id on the WR stack. r=mstange

Note that when PushClipAndScrollInfo is called, we are pushing an
already-defined scrolling clip onto the stack, and anything that gets
pushed inside it is going to be defined as being inside that scrolling
clip. So we need to make sure to update the scroll id stack for those
calls as well. This was an oversight previously but it never mattered.

MozReview-Commit-ID: D40Gk00HYrq

--HG--
extra : rebase_source : beee11f8694489183dbeb4edcd95d89f55656486
parent b3f900ac
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -744,12 +744,14 @@ DisplayListBuilder::PushClipAndScrollInfo(const layers::FrameMetrics::ViewID& aS
      aClipId ? Stringify(aClipId->id).c_str() : "none");
  wr_dp_push_clip_and_scroll_info(mWrState, aScrollId,
      aClipId ? &(aClipId->id) : nullptr);
  mScrollIdStack.push_back(aScrollId);
}

void
DisplayListBuilder::PopClipAndScrollInfo()
{
  WRDL_LOG("PopClipAndScroll\n");
  mScrollIdStack.pop_back();
  wr_dp_pop_clip_and_scroll_info(mWrState);
}

@@ -988,6 +990,15 @@ DisplayListBuilder::TopmostClipId()
  return Some(mClipIdStack.back());
}

Maybe<layers::FrameMetrics::ViewID>
DisplayListBuilder::TopmostScrollId()
{
  if (mScrollIdStack.empty()) {
    return Nothing();
  }
  return Some(mScrollIdStack.back());
}

Maybe<layers::FrameMetrics::ViewID>
DisplayListBuilder::ParentScrollIdFor(layers::FrameMetrics::ViewID aScrollId)
{
+2 −0
Original line number Diff line number Diff line
@@ -309,6 +309,8 @@ public:
  // has not yet been popped with PopClip. Return Nothing() if the clip stack
  // is empty.
  Maybe<wr::WrClipId> TopmostClipId();
  // Same as TopmostClipId() but for scroll layers.
  Maybe<layers::FrameMetrics::ViewID> TopmostScrollId();
  // Returns the scroll id that was pushed just before the given scroll id. This
  // function returns Nothing() if the given scrollid has not been encountered,
  // or if it is the rootmost scroll id (and therefore has no ancestor).