void
DisplayListClipState::TurnClipIntoScrollClipForContainingBlockDescendants(
    nsDisplayListBuilder* aBuilder, nsIScrollableFrame* aScrollableFrame)
{
  const DisplayItemScrollClip* parent = GetCurrentInnermostScrollClip();
  mScrollClipContainingBlockDescendants =
    aBuilder->AllocateDisplayItemScrollClip(parent,
                                      aScrollableFrame,
                                      GetCurrentCombinedClip(aBuilder), true);
  Clear();
}
void
DisplayListClipState::TurnClipIntoScrollClipForContentDescendants(
    nsDisplayListBuilder* aBuilder, nsIScrollableFrame* aScrollableFrame)
{
  const DisplayItemScrollClip* parent = GetCurrentInnermostScrollClip();
  const DisplayItemScrollClip* crossStackingContextParent = parent;
  if (!crossStackingContextParent) {
    crossStackingContextParent = mCrossStackingContextParentScrollClip;
  }
  mScrollClipContentDescendants =
    aBuilder->AllocateDisplayItemScrollClip(parent, crossStackingContextParent,
                                      aScrollableFrame,
                                      GetCurrentCombinedClip(aBuilder), true);
  Clear();
}
DisplayItemScrollClip*
DisplayListClipState::CreateInactiveScrollClip(
    nsDisplayListBuilder* aBuilder, nsIScrollableFrame* aScrollableFrame)
{
  // We ignore the rounded corners on the current clip because we don't want
  // them to be double-applied (as scroll clip and as regular clip).
  // Double-applying rectangle clips doesn't make a visual difference so it's
  // fine.
  const DisplayItemClip* rectClip =
    WithoutRoundedCorners(aBuilder, GetCurrentCombinedClip(aBuilder));

  const DisplayItemScrollClip* parent = GetCurrentInnermostScrollClip();
  DisplayItemScrollClip* scrollClip =
    aBuilder->AllocateDisplayItemScrollClip(parent,
                                            aScrollableFrame,
                                            rectClip, false);
  return scrollClip;
}