mirror of
				https://github.com/mozilla/gecko-dev.git
				synced 2025-11-01 00:38:50 +02:00 
			
		
		
		
	Bug 1896516 Part 11 - Remove nsIScrollableFrame usages under layout/, widget/, and toolkit/. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D211498
This commit is contained in:
		
							parent
							
								
									f390af5424
								
							
						
					
					
						commit
						1e80f659a2
					
				
					 51 changed files with 277 additions and 290 deletions
				
			
		|  | @ -366,7 +366,7 @@ void WebRenderLayerManager::EndTransactionWithoutLayer( | ||||||
|         *mDLBuilder, resourceUpdates, aDisplayList, aDisplayListBuilder, |         *mDLBuilder, resourceUpdates, aDisplayList, aDisplayListBuilder, | ||||||
|         mScrollData, std::move(aFilters)); |         mScrollData, std::move(aFilters)); | ||||||
| 
 | 
 | ||||||
|     aDisplayListBuilder->NotifyAndClearScrollFrames(); |     aDisplayListBuilder->NotifyAndClearScrollContainerFrames(); | ||||||
| 
 | 
 | ||||||
|     builderDumpIndex = mWebRenderCommandBuilder.GetBuilderDumpIndex(); |     builderDumpIndex = mWebRenderCommandBuilder.GetBuilderDumpIndex(); | ||||||
|     containsSVGGroup = mWebRenderCommandBuilder.GetContainsSVGGroup(); |     containsSVGGroup = mWebRenderCommandBuilder.GetContainsSVGGroup(); | ||||||
|  |  | ||||||
|  | @ -74,7 +74,8 @@ void WebRenderLayerScrollData::Initialize( | ||||||
|       Maybe<ScrollMetadata> metadata = |       Maybe<ScrollMetadata> metadata = | ||||||
|           asr->mScrollContainerFrame->ComputeScrollMetadata( |           asr->mScrollContainerFrame->ComputeScrollMetadata( | ||||||
|               aOwner.GetManager(), aItem->Frame(), aItem->ToReferenceFrame()); |               aOwner.GetManager(), aItem->Frame(), aItem->ToReferenceFrame()); | ||||||
|       aOwner.GetBuilder()->AddScrollFrameToNotify(asr->mScrollContainerFrame); |       aOwner.GetBuilder()->AddScrollContainerFrameToNotify( | ||||||
|  |           asr->mScrollContainerFrame); | ||||||
|       if (metadata) { |       if (metadata) { | ||||||
|         MOZ_ASSERT(metadata->GetMetrics().GetScrollId() == scrollId); |         MOZ_ASSERT(metadata->GetMetrics().GetScrollId() == scrollId); | ||||||
|         mScrollIds.AppendElement(aOwner.AddMetadata(metadata.ref())); |         mScrollIds.AppendElement(aOwner.AddMetadata(metadata.ref())); | ||||||
|  |  | ||||||
|  | @ -73,7 +73,8 @@ DisplayPortMargins DisplayPortMargins::ForContent( | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ScreenMargin DisplayPortMargins::GetRelativeToLayoutViewport( | ScreenMargin DisplayPortMargins::GetRelativeToLayoutViewport( | ||||||
|     ContentGeometryType aGeometryType, nsIScrollableFrame* aScrollableFrame, |     ContentGeometryType aGeometryType, | ||||||
|  |     ScrollContainerFrame* aScrollContainerFrame, | ||||||
|     const CSSToScreenScale2D& aDisplayportScale) const { |     const CSSToScreenScale2D& aDisplayportScale) const { | ||||||
|   // APZ wants |mMargins| applied relative to the visual viewport.
 |   // APZ wants |mMargins| applied relative to the visual viewport.
 | ||||||
|   // The main-thread painting code applies margins relative to
 |   // The main-thread painting code applies margins relative to
 | ||||||
|  | @ -82,7 +83,7 @@ ScreenMargin DisplayPortMargins::GetRelativeToLayoutViewport( | ||||||
|   // magnitude of the translation depends on whether we are
 |   // magnitude of the translation depends on whether we are
 | ||||||
|   // applying the displayport to scrolled or fixed content.
 |   // applying the displayport to scrolled or fixed content.
 | ||||||
|   CSSPoint scrollDeltaCss = |   CSSPoint scrollDeltaCss = | ||||||
|       ComputeAsyncTranslation(aGeometryType, aScrollableFrame); |       ComputeAsyncTranslation(aGeometryType, aScrollContainerFrame); | ||||||
|   ScreenPoint scrollDelta = scrollDeltaCss * aDisplayportScale; |   ScreenPoint scrollDelta = scrollDeltaCss * aDisplayportScale; | ||||||
|   ScreenMargin margins = mMargins; |   ScreenMargin margins = mMargins; | ||||||
|   margins.left -= scrollDelta.x; |   margins.left -= scrollDelta.x; | ||||||
|  | @ -106,7 +107,7 @@ std::ostream& operator<<(std::ostream& aOs, | ||||||
| 
 | 
 | ||||||
| CSSPoint DisplayPortMargins::ComputeAsyncTranslation( | CSSPoint DisplayPortMargins::ComputeAsyncTranslation( | ||||||
|     ContentGeometryType aGeometryType, |     ContentGeometryType aGeometryType, | ||||||
|     nsIScrollableFrame* aScrollableFrame) const { |     ScrollContainerFrame* aScrollContainerFrame) const { | ||||||
|   // If we are applying the displayport to scrolled content, the
 |   // If we are applying the displayport to scrolled content, the
 | ||||||
|   // translation is the entire difference between the visual and
 |   // translation is the entire difference between the visual and
 | ||||||
|   // layout offsets.
 |   // layout offsets.
 | ||||||
|  | @ -122,15 +123,14 @@ CSSPoint DisplayPortMargins::ComputeAsyncTranslation( | ||||||
|   // with it. We want only the remaining delta, i.e. the offset of
 |   // with it. We want only the remaining delta, i.e. the offset of
 | ||||||
|   // the visual viewport relative to the (async-scrolled) layout
 |   // the visual viewport relative to the (async-scrolled) layout
 | ||||||
|   // viewport.
 |   // viewport.
 | ||||||
|   if (!aScrollableFrame) { |   if (!aScrollContainerFrame) { | ||||||
|     // Displayport on a non-scrolling frame for some reason.
 |     // Displayport on a non-scrolling frame for some reason.
 | ||||||
|     // There will be no divergence between the two viewports.
 |     // There will be no divergence between the two viewports.
 | ||||||
|     return CSSPoint(); |     return CSSPoint(); | ||||||
|   } |   } | ||||||
|   // Fixed content is always fixed to an RSF.
 |   // Fixed content is always fixed to an RSF.
 | ||||||
|   MOZ_ASSERT(aScrollableFrame->IsRootScrollFrameOfDocument()); |   MOZ_ASSERT(aScrollContainerFrame->IsRootScrollFrameOfDocument()); | ||||||
|   nsIFrame* scrollFrame = do_QueryFrame(aScrollableFrame); |   if (!aScrollContainerFrame->PresShell()->IsVisualViewportSizeSet()) { | ||||||
|   if (!scrollFrame->PresShell()->IsVisualViewportSizeSet()) { |  | ||||||
|     // Zooming is disabled, so the layout viewport tracks the
 |     // Zooming is disabled, so the layout viewport tracks the
 | ||||||
|     // visual viewport completely.
 |     // visual viewport completely.
 | ||||||
|     return CSSPoint(); |     return CSSPoint(); | ||||||
|  | @ -145,12 +145,13 @@ CSSPoint DisplayPortMargins::ComputeAsyncTranslation( | ||||||
|       // mVisualOffset, and using it to adjust the visual viewport size here.
 |       // mVisualOffset, and using it to adjust the visual viewport size here.
 | ||||||
|       // Note that any incorrectness caused by this will only occur transiently
 |       // Note that any incorrectness caused by this will only occur transiently
 | ||||||
|       // during async zooming.
 |       // during async zooming.
 | ||||||
|       CSSSize::FromAppUnits(scrollFrame->PresShell()->GetVisualViewportSize())}; |       CSSSize::FromAppUnits( | ||||||
|  |           aScrollContainerFrame->PresShell()->GetVisualViewportSize())}; | ||||||
|   const CSSRect scrollableRect = CSSRect::FromAppUnits( |   const CSSRect scrollableRect = CSSRect::FromAppUnits( | ||||||
|       nsLayoutUtils::CalculateExpandedScrollableRect(scrollFrame)); |       nsLayoutUtils::CalculateExpandedScrollableRect(aScrollContainerFrame)); | ||||||
|   CSSRect asyncLayoutViewport{ |   CSSRect asyncLayoutViewport{ | ||||||
|       mLayoutOffset, |       mLayoutOffset, | ||||||
|       CSSSize::FromAppUnits(aScrollableFrame->GetScrollPortRect().Size())}; |       CSSSize::FromAppUnits(aScrollContainerFrame->GetScrollPortRect().Size())}; | ||||||
|   FrameMetrics::KeepLayoutViewportEnclosingVisualViewport( |   FrameMetrics::KeepLayoutViewportEnclosingVisualViewport( | ||||||
|       visualViewport, scrollableRect, /* out */ asyncLayoutViewport); |       visualViewport, scrollableRect, /* out */ asyncLayoutViewport); | ||||||
|   return mVisualOffset - asyncLayoutViewport.TopLeft(); |   return mVisualOffset - asyncLayoutViewport.TopLeft(); | ||||||
|  | @ -744,7 +745,7 @@ bool DisplayPortUtils::FrameHasDisplayPort(nsIFrame* aFrame, | ||||||
|   if (!aFrame->GetContent() || !HasDisplayPort(aFrame->GetContent())) { |   if (!aFrame->GetContent() || !HasDisplayPort(aFrame->GetContent())) { | ||||||
|     return false; |     return false; | ||||||
|   } |   } | ||||||
|   nsIScrollableFrame* sf = do_QueryFrame(aFrame); |   ScrollContainerFrame* sf = do_QueryFrame(aFrame); | ||||||
|   if (sf) { |   if (sf) { | ||||||
|     if (aScrolledFrame && aScrolledFrame != sf->GetScrolledFrame()) { |     if (aScrolledFrame && aScrolledFrame != sf->GetScrolledFrame()) { | ||||||
|       return false; |       return false; | ||||||
|  | @ -900,12 +901,12 @@ void DisplayPortUtils::ExpireDisplayPortOnAsyncScrollableAncestor( | ||||||
|     if (!frame) { |     if (!frame) { | ||||||
|       break; |       break; | ||||||
|     } |     } | ||||||
|     nsIScrollableFrame* scrollAncestor = |     ScrollContainerFrame* scrollAncestor = | ||||||
|         nsLayoutUtils::GetAsyncScrollableAncestorFrame(frame); |         nsLayoutUtils::GetAsyncScrollableAncestorFrame(frame); | ||||||
|     if (!scrollAncestor) { |     if (!scrollAncestor) { | ||||||
|       break; |       break; | ||||||
|     } |     } | ||||||
|     frame = do_QueryFrame(scrollAncestor); |     frame = scrollAncestor; | ||||||
|     MOZ_ASSERT(frame); |     MOZ_ASSERT(frame); | ||||||
|     if (!frame) { |     if (!frame) { | ||||||
|       break; |       break; | ||||||
|  |  | ||||||
|  | @ -102,15 +102,17 @@ struct DisplayPortMargins { | ||||||
|   // applied to (or, in the case of fixed content), the scroll frame wrt. which
 |   // applied to (or, in the case of fixed content), the scroll frame wrt. which
 | ||||||
|   // the content is fixed.
 |   // the content is fixed.
 | ||||||
|   ScreenMargin GetRelativeToLayoutViewport( |   ScreenMargin GetRelativeToLayoutViewport( | ||||||
|       ContentGeometryType aGeometryType, nsIScrollableFrame* aScrollableFrame, |       ContentGeometryType aGeometryType, | ||||||
|  |       ScrollContainerFrame* aScrollContainerFrame, | ||||||
|       const CSSToScreenScale2D& aDisplayportScale) const; |       const CSSToScreenScale2D& aDisplayportScale) const; | ||||||
| 
 | 
 | ||||||
|   friend std::ostream& operator<<(std::ostream& aOs, |   friend std::ostream& operator<<(std::ostream& aOs, | ||||||
|                                   const DisplayPortMargins& aMargins); |                                   const DisplayPortMargins& aMargins); | ||||||
| 
 | 
 | ||||||
|  private: |  private: | ||||||
|   CSSPoint ComputeAsyncTranslation(ContentGeometryType aGeometryType, |   CSSPoint ComputeAsyncTranslation( | ||||||
|                                    nsIScrollableFrame* aScrollableFrame) const; |       ContentGeometryType aGeometryType, | ||||||
|  |       ScrollContainerFrame* aScrollContainerFrame) const; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| struct DisplayPortMarginsPropertyData { | struct DisplayPortMarginsPropertyData { | ||||||
|  |  | ||||||
|  | @ -2200,11 +2200,10 @@ void PresShell::NotifyDestroyingFrame(nsIFrame* aFrame) { | ||||||
| 
 | 
 | ||||||
|     mFramesToDirty.Remove(aFrame); |     mFramesToDirty.Remove(aFrame); | ||||||
| 
 | 
 | ||||||
|     nsIScrollableFrame* scrollableFrame = do_QueryFrame(aFrame); |     if (ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(aFrame)) { | ||||||
|     if (scrollableFrame) { |       mPendingScrollAnchorSelection.Remove(scrollContainerFrame); | ||||||
|       mPendingScrollAnchorSelection.Remove(scrollableFrame); |       mPendingScrollAnchorAdjustment.Remove(scrollContainerFrame); | ||||||
|       mPendingScrollAnchorAdjustment.Remove(scrollableFrame); |       mPendingScrollResnap.Remove(scrollContainerFrame); | ||||||
|       mPendingScrollResnap.Remove(scrollableFrame); |  | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | @ -2358,7 +2357,7 @@ PresShell::ScrollPage(bool aForward) { | ||||||
|     scrollContainerFrame->ScrollBy(nsIntPoint(0, aForward ? 1 : -1), |     scrollContainerFrame->ScrollBy(nsIntPoint(0, aForward ? 1 : -1), | ||||||
|                                    ScrollUnit::PAGES, scrollMode, nullptr, |                                    ScrollUnit::PAGES, scrollMode, nullptr, | ||||||
|                                    mozilla::ScrollOrigin::NotSpecified, |                                    mozilla::ScrollOrigin::NotSpecified, | ||||||
|                                    nsIScrollableFrame::NOT_MOMENTUM, |                                    ScrollContainerFrame::NOT_MOMENTUM, | ||||||
|                                    ScrollSnapFlags::IntendedDirection | |                                    ScrollSnapFlags::IntendedDirection | | ||||||
|                                        ScrollSnapFlags::IntendedEndPosition); |                                        ScrollSnapFlags::IntendedEndPosition); | ||||||
|   } |   } | ||||||
|  | @ -2380,7 +2379,7 @@ PresShell::ScrollLine(bool aForward) { | ||||||
|     scrollContainerFrame->ScrollBy( |     scrollContainerFrame->ScrollBy( | ||||||
|         nsIntPoint(0, aForward ? lineCount : -lineCount), ScrollUnit::LINES, |         nsIntPoint(0, aForward ? lineCount : -lineCount), ScrollUnit::LINES, | ||||||
|         scrollMode, nullptr, mozilla::ScrollOrigin::NotSpecified, |         scrollMode, nullptr, mozilla::ScrollOrigin::NotSpecified, | ||||||
|         nsIScrollableFrame::NOT_MOMENTUM, ScrollSnapFlags::IntendedDirection); |         ScrollContainerFrame::NOT_MOMENTUM, ScrollSnapFlags::IntendedDirection); | ||||||
|   } |   } | ||||||
|   return NS_OK; |   return NS_OK; | ||||||
| } | } | ||||||
|  | @ -2394,7 +2393,7 @@ PresShell::ScrollCharacter(bool aRight) { | ||||||
|     int32_t h = StaticPrefs::toolkit_scrollbox_horizontalScrollDistance(); |     int32_t h = StaticPrefs::toolkit_scrollbox_horizontalScrollDistance(); | ||||||
|     scrollContainerFrame->ScrollBy( |     scrollContainerFrame->ScrollBy( | ||||||
|         nsIntPoint(aRight ? h : -h, 0), ScrollUnit::LINES, scrollMode, nullptr, |         nsIntPoint(aRight ? h : -h, 0), ScrollUnit::LINES, scrollMode, nullptr, | ||||||
|         mozilla::ScrollOrigin::NotSpecified, nsIScrollableFrame::NOT_MOMENTUM, |         mozilla::ScrollOrigin::NotSpecified, ScrollContainerFrame::NOT_MOMENTUM, | ||||||
|         ScrollSnapFlags::IntendedDirection); |         ScrollSnapFlags::IntendedDirection); | ||||||
|   } |   } | ||||||
|   return NS_OK; |   return NS_OK; | ||||||
|  | @ -2406,10 +2405,11 @@ PresShell::CompleteScroll(bool aForward) { | ||||||
|       GetScrollContainerFrameToScroll(VerticalScrollDirection); |       GetScrollContainerFrameToScroll(VerticalScrollDirection); | ||||||
|   ScrollMode scrollMode = apz::GetScrollModeForOrigin(ScrollOrigin::Other); |   ScrollMode scrollMode = apz::GetScrollModeForOrigin(ScrollOrigin::Other); | ||||||
|   if (scrollContainerFrame) { |   if (scrollContainerFrame) { | ||||||
|     scrollContainerFrame->ScrollBy( |     scrollContainerFrame->ScrollBy(nsIntPoint(0, aForward ? 1 : -1), | ||||||
|         nsIntPoint(0, aForward ? 1 : -1), ScrollUnit::WHOLE, scrollMode, |                                    ScrollUnit::WHOLE, scrollMode, nullptr, | ||||||
|         nullptr, mozilla::ScrollOrigin::NotSpecified, |                                    mozilla::ScrollOrigin::NotSpecified, | ||||||
|         nsIScrollableFrame::NOT_MOMENTUM, ScrollSnapFlags::IntendedEndPosition); |                                    ScrollContainerFrame::NOT_MOMENTUM, | ||||||
|  |                                    ScrollSnapFlags::IntendedEndPosition); | ||||||
|   } |   } | ||||||
|   return NS_OK; |   return NS_OK; | ||||||
| } | } | ||||||
|  | @ -2581,11 +2581,11 @@ void PresShell::VerifyHasDirtyRootAncestor(nsIFrame* aFrame) { | ||||||
| 
 | 
 | ||||||
| void PresShell::PostPendingScrollAnchorSelection( | void PresShell::PostPendingScrollAnchorSelection( | ||||||
|     mozilla::layout::ScrollAnchorContainer* aContainer) { |     mozilla::layout::ScrollAnchorContainer* aContainer) { | ||||||
|   mPendingScrollAnchorSelection.Insert(aContainer->ScrollableFrame()); |   mPendingScrollAnchorSelection.Insert(aContainer->ScrollContainer()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void PresShell::FlushPendingScrollAnchorSelections() { | void PresShell::FlushPendingScrollAnchorSelections() { | ||||||
|   for (nsIScrollableFrame* scroll : mPendingScrollAnchorSelection) { |   for (ScrollContainerFrame* scroll : mPendingScrollAnchorSelection) { | ||||||
|     scroll->Anchor()->SelectAnchor(); |     scroll->Anchor()->SelectAnchor(); | ||||||
|   } |   } | ||||||
|   mPendingScrollAnchorSelection.Clear(); |   mPendingScrollAnchorSelection.Clear(); | ||||||
|  | @ -2593,23 +2593,24 @@ void PresShell::FlushPendingScrollAnchorSelections() { | ||||||
| 
 | 
 | ||||||
| void PresShell::PostPendingScrollAnchorAdjustment( | void PresShell::PostPendingScrollAnchorAdjustment( | ||||||
|     ScrollAnchorContainer* aContainer) { |     ScrollAnchorContainer* aContainer) { | ||||||
|   mPendingScrollAnchorAdjustment.Insert(aContainer->ScrollableFrame()); |   mPendingScrollAnchorAdjustment.Insert(aContainer->ScrollContainer()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void PresShell::FlushPendingScrollAnchorAdjustments() { | void PresShell::FlushPendingScrollAnchorAdjustments() { | ||||||
|   for (nsIScrollableFrame* scroll : mPendingScrollAnchorAdjustment) { |   for (ScrollContainerFrame* scroll : mPendingScrollAnchorAdjustment) { | ||||||
|     scroll->Anchor()->ApplyAdjustments(); |     scroll->Anchor()->ApplyAdjustments(); | ||||||
|   } |   } | ||||||
|   mPendingScrollAnchorAdjustment.Clear(); |   mPendingScrollAnchorAdjustment.Clear(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void PresShell::PostPendingScrollResnap(nsIScrollableFrame* aScrollableFrame) { | void PresShell::PostPendingScrollResnap( | ||||||
|   mPendingScrollResnap.Insert(aScrollableFrame); |     ScrollContainerFrame* aScrollContainerFrame) { | ||||||
|  |   mPendingScrollResnap.Insert(aScrollContainerFrame); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void PresShell::FlushPendingScrollResnap() { | void PresShell::FlushPendingScrollResnap() { | ||||||
|   for (nsIScrollableFrame* scrollableFrame : mPendingScrollResnap) { |   for (ScrollContainerFrame* scrollContainerFrame : mPendingScrollResnap) { | ||||||
|     scrollableFrame->TryResnap(); |     scrollContainerFrame->TryResnap(); | ||||||
|   } |   } | ||||||
|   mPendingScrollResnap.Clear(); |   mPendingScrollResnap.Clear(); | ||||||
| } | } | ||||||
|  | @ -3413,18 +3414,18 @@ static nscoord ComputeWhereToScroll(WhereToScroll aWhereToScroll, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static WhereToScroll GetApplicableWhereToScroll( | static WhereToScroll GetApplicableWhereToScroll( | ||||||
|     const nsIScrollableFrame* aFrameAsScrollable, |     const ScrollContainerFrame* aScrollContainerFrame, | ||||||
|     const nsIFrame* aScrollableFrame, const nsIFrame* aTarget, |     const nsIFrame* aScrollableFrame, const nsIFrame* aTarget, | ||||||
|     ScrollDirection aScrollDirection, WhereToScroll aOriginal) { |     ScrollDirection aScrollDirection, WhereToScroll aOriginal) { | ||||||
|   MOZ_ASSERT(do_QueryFrame(aFrameAsScrollable) == aScrollableFrame); |   MOZ_ASSERT(do_QueryFrame(aScrollContainerFrame) == aScrollableFrame); | ||||||
|   if (aTarget == aScrollableFrame) { |   if (aTarget == aScrollableFrame) { | ||||||
|     return aOriginal; |     return aOriginal; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   StyleScrollSnapAlignKeyword align = |   StyleScrollSnapAlignKeyword align = | ||||||
|       aScrollDirection == ScrollDirection::eHorizontal |       aScrollDirection == ScrollDirection::eHorizontal | ||||||
|           ? aFrameAsScrollable->GetScrollSnapAlignFor(aTarget).first |           ? aScrollContainerFrame->GetScrollSnapAlignFor(aTarget).first | ||||||
|           : aFrameAsScrollable->GetScrollSnapAlignFor(aTarget).second; |           : aScrollContainerFrame->GetScrollSnapAlignFor(aTarget).second; | ||||||
| 
 | 
 | ||||||
|   switch (align) { |   switch (align) { | ||||||
|     case StyleScrollSnapAlignKeyword::None: |     case StyleScrollSnapAlignKeyword::None: | ||||||
|  | @ -3440,26 +3441,26 @@ static WhereToScroll GetApplicableWhereToScroll( | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * This function takes a scrollable frame, a rect in the coordinate system |  * This function takes a scroll container frame, a rect in the coordinate system | ||||||
|  * of the scrolled frame, and a desired percentage-based scroll |  * of the scrolled frame, and a desired percentage-based scroll | ||||||
|  * position and attempts to scroll the rect to that position in the |  * position and attempts to scroll the rect to that position in the | ||||||
|  * visual viewport. |  * visual viewport. | ||||||
|  * |  * | ||||||
|  * This needs to work even if aRect has a width or height of zero. |  * This needs to work even if aRect has a width or height of zero. | ||||||
|  */ |  */ | ||||||
| static void ScrollToShowRect(nsIScrollableFrame* aFrameAsScrollable, | static void ScrollToShowRect(ScrollContainerFrame* aScrollContainerFrame, | ||||||
|                              const nsIFrame* aScrollableFrame, |                              const nsIFrame* aScrollableFrame, | ||||||
|                              const nsIFrame* aTarget, const nsRect& aRect, |                              const nsIFrame* aTarget, const nsRect& aRect, | ||||||
|                              const Sides aScrollPaddingSkipSides, |                              const Sides aScrollPaddingSkipSides, | ||||||
|                              const nsMargin& aMargin, ScrollAxis aVertical, |                              const nsMargin& aMargin, ScrollAxis aVertical, | ||||||
|                              ScrollAxis aHorizontal, ScrollFlags aScrollFlags) { |                              ScrollAxis aHorizontal, ScrollFlags aScrollFlags) { | ||||||
|   nsPoint scrollPt = aFrameAsScrollable->GetVisualViewportOffset(); |   nsPoint scrollPt = aScrollContainerFrame->GetVisualViewportOffset(); | ||||||
|   const nsPoint originalScrollPt = scrollPt; |   const nsPoint originalScrollPt = scrollPt; | ||||||
|   const nsRect visibleRect(scrollPt, |   const nsRect visibleRect(scrollPt, | ||||||
|                            aFrameAsScrollable->GetVisualViewportSize()); |                            aScrollContainerFrame->GetVisualViewportSize()); | ||||||
| 
 | 
 | ||||||
|   const nsMargin padding = [&] { |   const nsMargin padding = [&] { | ||||||
|     nsMargin p = aFrameAsScrollable->GetScrollPadding(); |     nsMargin p = aScrollContainerFrame->GetScrollPadding(); | ||||||
|     p.ApplySkipSides(aScrollPaddingSkipSides); |     p.ApplySkipSides(aScrollPaddingSkipSides); | ||||||
|     return p + aMargin; |     return p + aMargin; | ||||||
|   }(); |   }(); | ||||||
|  | @ -3467,7 +3468,7 @@ static void ScrollToShowRect(nsIScrollableFrame* aFrameAsScrollable, | ||||||
|   const nsRect rectToScrollIntoView = [&] { |   const nsRect rectToScrollIntoView = [&] { | ||||||
|     nsRect r(aRect); |     nsRect r(aRect); | ||||||
|     r.Inflate(padding); |     r.Inflate(padding); | ||||||
|     return r.Intersect(aFrameAsScrollable->GetScrolledRect()); |     return r.Intersect(aScrollContainerFrame->GetScrolledRect()); | ||||||
|   }(); |   }(); | ||||||
| 
 | 
 | ||||||
|   nsSize lineSize; |   nsSize lineSize; | ||||||
|  | @ -3478,12 +3479,12 @@ static void ScrollToShowRect(nsIScrollableFrame* aFrameAsScrollable, | ||||||
|   // it would assert and possible give the wrong result.
 |   // it would assert and possible give the wrong result.
 | ||||||
|   if (aVertical.mWhenToScroll == WhenToScroll::IfNotVisible || |   if (aVertical.mWhenToScroll == WhenToScroll::IfNotVisible || | ||||||
|       aHorizontal.mWhenToScroll == WhenToScroll::IfNotVisible) { |       aHorizontal.mWhenToScroll == WhenToScroll::IfNotVisible) { | ||||||
|     lineSize = aFrameAsScrollable->GetLineScrollAmount(); |     lineSize = aScrollContainerFrame->GetLineScrollAmount(); | ||||||
|   } |   } | ||||||
|   ScrollStyles ss = aFrameAsScrollable->GetScrollStyles(); |   ScrollStyles ss = aScrollContainerFrame->GetScrollStyles(); | ||||||
|   nsRect allowedRange(scrollPt, nsSize(0, 0)); |   nsRect allowedRange(scrollPt, nsSize(0, 0)); | ||||||
|   ScrollDirections directions = |   ScrollDirections directions = | ||||||
|       aFrameAsScrollable->GetAvailableScrollingDirections(); |       aScrollContainerFrame->GetAvailableScrollingDirections(); | ||||||
| 
 | 
 | ||||||
|   if (((aScrollFlags & ScrollFlags::ScrollOverflowHidden) || |   if (((aScrollFlags & ScrollFlags::ScrollOverflowHidden) || | ||||||
|        ss.mVertical != StyleOverflow::Hidden) && |        ss.mVertical != StyleOverflow::Hidden) && | ||||||
|  | @ -3494,7 +3495,7 @@ static void ScrollToShowRect(nsIScrollableFrame* aFrameAsScrollable, | ||||||
|                             visibleRect.YMost() - padding.bottom)) { |                             visibleRect.YMost() - padding.bottom)) { | ||||||
|       // If the scroll-snap-align on the frame is valid, we need to respect it.
 |       // If the scroll-snap-align on the frame is valid, we need to respect it.
 | ||||||
|       WhereToScroll whereToScroll = GetApplicableWhereToScroll( |       WhereToScroll whereToScroll = GetApplicableWhereToScroll( | ||||||
|           aFrameAsScrollable, aScrollableFrame, aTarget, |           aScrollContainerFrame, aScrollableFrame, aTarget, | ||||||
|           ScrollDirection::eVertical, aVertical.mWhereToScroll); |           ScrollDirection::eVertical, aVertical.mWhereToScroll); | ||||||
| 
 | 
 | ||||||
|       nscoord maxHeight; |       nscoord maxHeight; | ||||||
|  | @ -3515,7 +3516,7 @@ static void ScrollToShowRect(nsIScrollableFrame* aFrameAsScrollable, | ||||||
|                             visibleRect.XMost() - padding.right)) { |                             visibleRect.XMost() - padding.right)) { | ||||||
|       // If the scroll-snap-align on the frame is valid, we need to respect it.
 |       // If the scroll-snap-align on the frame is valid, we need to respect it.
 | ||||||
|       WhereToScroll whereToScroll = GetApplicableWhereToScroll( |       WhereToScroll whereToScroll = GetApplicableWhereToScroll( | ||||||
|           aFrameAsScrollable, aScrollableFrame, aTarget, |           aScrollContainerFrame, aScrollableFrame, aTarget, | ||||||
|           ScrollDirection::eHorizontal, aHorizontal.mWhereToScroll); |           ScrollDirection::eHorizontal, aHorizontal.mWhereToScroll); | ||||||
| 
 | 
 | ||||||
|       nscoord maxWidth; |       nscoord maxWidth; | ||||||
|  | @ -3544,17 +3545,17 @@ static void ScrollToShowRect(nsIScrollableFrame* aFrameAsScrollable, | ||||||
|   } else if (aScrollFlags & ScrollFlags::ScrollSmoothAuto) { |   } else if (aScrollFlags & ScrollFlags::ScrollSmoothAuto) { | ||||||
|     behavior = ScrollBehavior::Auto; |     behavior = ScrollBehavior::Auto; | ||||||
|   } |   } | ||||||
|   bool smoothScroll = aFrameAsScrollable->IsSmoothScroll(behavior); |   bool smoothScroll = aScrollContainerFrame->IsSmoothScroll(behavior); | ||||||
|   if (smoothScroll) { |   if (smoothScroll) { | ||||||
|     scrollMode = ScrollMode::SmoothMsd; |     scrollMode = ScrollMode::SmoothMsd; | ||||||
|   } |   } | ||||||
|   nsIFrame* frame = do_QueryFrame(aFrameAsScrollable); |   nsIFrame* frame = do_QueryFrame(aScrollContainerFrame); | ||||||
|   AutoWeakFrame weakFrame(frame); |   AutoWeakFrame weakFrame(frame); | ||||||
|   aFrameAsScrollable->ScrollTo(scrollPt, scrollMode, &allowedRange, |   aScrollContainerFrame->ScrollTo(scrollPt, scrollMode, &allowedRange, | ||||||
|                                ScrollSnapFlags::IntendedEndPosition, |                                   ScrollSnapFlags::IntendedEndPosition, | ||||||
|                                aScrollFlags & ScrollFlags::TriggeredByScript |                                   aScrollFlags & ScrollFlags::TriggeredByScript | ||||||
|                                    ? ScrollTriggeredByScript::Yes |                                       ? ScrollTriggeredByScript::Yes | ||||||
|                                    : ScrollTriggeredByScript::No); |                                       : ScrollTriggeredByScript::No); | ||||||
|   if (!weakFrame.IsAlive()) { |   if (!weakFrame.IsAlive()) { | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|  | @ -3563,7 +3564,7 @@ static void ScrollToShowRect(nsIScrollableFrame* aFrameAsScrollable, | ||||||
|   // scroll the rect into view visually, and that may require scrolling
 |   // scroll the rect into view visually, and that may require scrolling
 | ||||||
|   // the visual viewport in scenarios where there is not enough layout
 |   // the visual viewport in scenarios where there is not enough layout
 | ||||||
|   // scroll range.
 |   // scroll range.
 | ||||||
|   if (aFrameAsScrollable->IsRootScrollFrameOfDocument() && |   if (aScrollContainerFrame->IsRootScrollFrameOfDocument() && | ||||||
|       frame->PresContext()->IsRootContentDocumentCrossProcess()) { |       frame->PresContext()->IsRootContentDocumentCrossProcess()) { | ||||||
|     frame->PresShell()->ScrollToVisual(scrollPt, FrameMetrics::eMainThread, |     frame->PresShell()->ScrollToVisual(scrollPt, FrameMetrics::eMainThread, | ||||||
|                                        scrollMode); |                                        scrollMode); | ||||||
|  | @ -3745,7 +3746,7 @@ bool PresShell::ScrollFrameIntoView( | ||||||
|     MaybeSkipPaddingSides(aTargetFrame); |     MaybeSkipPaddingSides(aTargetFrame); | ||||||
|     while (nsIFrame* parent = container->GetParent()) { |     while (nsIFrame* parent = container->GetParent()) { | ||||||
|       container = parent; |       container = parent; | ||||||
|       if (static_cast<nsIScrollableFrame*>(do_QueryFrame(container))) { |       if (container->IsScrollContainerOrSubclass()) { | ||||||
|         // We really just need a non-fragmented frame so that we can accumulate
 |         // We really just need a non-fragmented frame so that we can accumulate
 | ||||||
|         // the bounds of all our continuations relative to it. We shouldn't jump
 |         // the bounds of all our continuations relative to it. We shouldn't jump
 | ||||||
|         // out of our nearest scrollable frame, and that's an ok reference
 |         // out of our nearest scrollable frame, and that's an ok reference
 | ||||||
|  | @ -3787,7 +3788,7 @@ bool PresShell::ScrollFrameIntoView( | ||||||
|   // Walk up the frame hierarchy scrolling the rect into view and
 |   // Walk up the frame hierarchy scrolling the rect into view and
 | ||||||
|   // keeping rect relative to container
 |   // keeping rect relative to container
 | ||||||
|   do { |   do { | ||||||
|     if (nsIScrollableFrame* sf = do_QueryFrame(container)) { |     if (ScrollContainerFrame* sf = do_QueryFrame(container)) { | ||||||
|       nsPoint oldPosition = sf->GetScrollPosition(); |       nsPoint oldPosition = sf->GetScrollPosition(); | ||||||
|       nsRect targetRect = rect; |       nsRect targetRect = rect; | ||||||
|       // Inflate the scrolled rect by the container's padding in each dimension,
 |       // Inflate the scrolled rect by the container's padding in each dimension,
 | ||||||
|  | @ -6013,8 +6014,7 @@ void PresShell::MarkFramesInSubtreeApproximatelyVisible( | ||||||
| 
 | 
 | ||||||
|   nsRect rect = aRect; |   nsRect rect = aRect; | ||||||
| 
 | 
 | ||||||
|   nsIScrollableFrame* scrollFrame = do_QueryFrame(aFrame); |   if (ScrollContainerFrame* scrollFrame = do_QueryFrame(aFrame)) { | ||||||
|   if (scrollFrame) { |  | ||||||
|     bool ignoreDisplayPort = false; |     bool ignoreDisplayPort = false; | ||||||
|     if (DisplayPortUtils::IsMissingDisplayPortBaseRect(aFrame->GetContent())) { |     if (DisplayPortUtils::IsMissingDisplayPortBaseRect(aFrame->GetContent())) { | ||||||
|       // We can properly set the base rect for root scroll frames on top level
 |       // We can properly set the base rect for root scroll frames on top level
 | ||||||
|  | @ -8079,7 +8079,7 @@ PresShell::EventHandler::ComputeRootFrameToHandleEventWithCapturingContent( | ||||||
| 
 | 
 | ||||||
|   // scrollable frames should use the scrolling container as the root instead
 |   // scrollable frames should use the scrolling container as the root instead
 | ||||||
|   // of the document
 |   // of the document
 | ||||||
|   nsIScrollableFrame* scrollFrame = do_QueryFrame(captureFrame); |   ScrollContainerFrame* scrollFrame = do_QueryFrame(captureFrame); | ||||||
|   return scrollFrame ? scrollFrame->GetScrolledFrame() |   return scrollFrame ? scrollFrame->GetScrolledFrame() | ||||||
|                      : aRootFrameToHandleEvent; |                      : aRootFrameToHandleEvent; | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -68,7 +68,6 @@ class nsIFrame; | ||||||
| class nsILayoutHistoryState; | class nsILayoutHistoryState; | ||||||
| class nsINode; | class nsINode; | ||||||
| class nsIReflowCallback; | class nsIReflowCallback; | ||||||
| class nsIScrollableFrame; |  | ||||||
| class nsITimer; | class nsITimer; | ||||||
| class nsPageSequenceFrame; | class nsPageSequenceFrame; | ||||||
| class nsPIDOMWindowOuter; | class nsPIDOMWindowOuter; | ||||||
|  | @ -485,7 +484,7 @@ class PresShell final : public nsStubDocumentObserver, | ||||||
|   void PostPendingScrollAnchorAdjustment( |   void PostPendingScrollAnchorAdjustment( | ||||||
|       layout::ScrollAnchorContainer* aContainer); |       layout::ScrollAnchorContainer* aContainer); | ||||||
| 
 | 
 | ||||||
|   void PostPendingScrollResnap(nsIScrollableFrame* aScrollableFrame); |   void PostPendingScrollResnap(ScrollContainerFrame* aScrollContainerFrame); | ||||||
|   void FlushPendingScrollResnap(); |   void FlushPendingScrollResnap(); | ||||||
| 
 | 
 | ||||||
|   void CancelAllPendingReflows(); |   void CancelAllPendingReflows(); | ||||||
|  | @ -1198,7 +1197,7 @@ class PresShell final : public nsStubDocumentObserver, | ||||||
|   // content (such as via window.scrollTo() should scroll the layout viewport
 |   // content (such as via window.scrollTo() should scroll the layout viewport
 | ||||||
|   // only).
 |   // only).
 | ||||||
|   // If scrolling "far away", i.e. not just within the existing layout
 |   // If scrolling "far away", i.e. not just within the existing layout
 | ||||||
|   // viewport, it's recommended to use both nsIScrollableFrame.ScrollTo*()
 |   // viewport, it's recommended to use both ScrollContainerFrame.ScrollTo*()
 | ||||||
|   // (via window.scrollTo if calling from JS) *and* this function; otherwise,
 |   // (via window.scrollTo if calling from JS) *and* this function; otherwise,
 | ||||||
|   // temporary checkerboarding may result. If doing this:
 |   // temporary checkerboarding may result. If doing this:
 | ||||||
|   //   * Be sure to call ScrollTo*() first, as a subsequent layout scroll
 |   //   * Be sure to call ScrollTo*() first, as a subsequent layout scroll
 | ||||||
|  | @ -1286,7 +1285,7 @@ class PresShell final : public nsStubDocumentObserver, | ||||||
|    * |aOrigin| specifies who originated the resolution change. For changes |    * |aOrigin| specifies who originated the resolution change. For changes | ||||||
|    * sent by APZ, pass ResolutionChangeOrigin::Apz. For changes sent by |    * sent by APZ, pass ResolutionChangeOrigin::Apz. For changes sent by | ||||||
|    * the main thread, pass ResolutionChangeOrigin::MainThreadAdjustment (similar |    * the main thread, pass ResolutionChangeOrigin::MainThreadAdjustment (similar | ||||||
|    * to the |aOrigin| parameter of nsIScrollableFrame::ScrollToCSSPixels()). |    * to the |aOrigin| parameter of ScrollContainerFrame::ScrollToCSSPixels()). | ||||||
|    */ |    */ | ||||||
|   nsresult SetResolutionAndScaleTo(float aResolution, |   nsresult SetResolutionAndScaleTo(float aResolution, | ||||||
|                                    ResolutionChangeOrigin aOrigin); |                                    ResolutionChangeOrigin aOrigin); | ||||||
|  | @ -1642,14 +1641,14 @@ class PresShell final : public nsStubDocumentObserver, | ||||||
|    *                      iframe or the like.  If ScrollFlags::ScrollSmooth |    *                      iframe or the like.  If ScrollFlags::ScrollSmooth | ||||||
|    *                      is set and CSSOM-VIEW scroll-behavior is enabled, |    *                      is set and CSSOM-VIEW scroll-behavior is enabled, | ||||||
|    *                      we will scroll smoothly using |    *                      we will scroll smoothly using | ||||||
|    *                      nsIScrollableFrame::ScrollMode::SMOOTH_MSD; |    *                      ScrollContainerFrame::ScrollMode::SMOOTH_MSD; | ||||||
|    *                      otherwise, nsIScrollableFrame::ScrollMode::INSTANT |    *                      otherwise, ScrollContainerFrame::ScrollMode::INSTANT | ||||||
|    *                      will be used.  If ScrollFlags::ScrollSmoothAuto is |    *                      will be used.  If ScrollFlags::ScrollSmoothAuto is | ||||||
|    *                      set, the CSSOM-View scroll-behavior attribute is |    *                      set, the CSSOM-View scroll-behavior attribute is | ||||||
|    *                      set to 'smooth' on the scroll frame, and CSSOM-VIEW |    *                      set to 'smooth' on the scroll frame, and CSSOM-VIEW | ||||||
|    *                      scroll-behavior is enabled, we will scroll smoothly |    *                      scroll-behavior is enabled, we will scroll smoothly | ||||||
|    *                      using nsIScrollableFrame::ScrollMode::SMOOTH_MSD; |    *                      using ScrollContainerFrame::ScrollMode::SMOOTH_MSD; | ||||||
|    *                      otherwise, nsIScrollableFrame::ScrollMode::INSTANT |    *                      otherwise, ScrollContainerFrame::ScrollMode::INSTANT | ||||||
|    *                      will be used. |    *                      will be used. | ||||||
|    */ |    */ | ||||||
|   MOZ_CAN_RUN_SCRIPT |   MOZ_CAN_RUN_SCRIPT | ||||||
|  | @ -3014,9 +3013,9 @@ class PresShell final : public nsStubDocumentObserver, | ||||||
|   // Set of frames that we should mark with NS_FRAME_HAS_DIRTY_CHILDREN after
 |   // Set of frames that we should mark with NS_FRAME_HAS_DIRTY_CHILDREN after
 | ||||||
|   // we finish reflowing mCurrentReflowRoot.
 |   // we finish reflowing mCurrentReflowRoot.
 | ||||||
|   nsTHashSet<nsIFrame*> mFramesToDirty; |   nsTHashSet<nsIFrame*> mFramesToDirty; | ||||||
|   nsTHashSet<nsIScrollableFrame*> mPendingScrollAnchorSelection; |   nsTHashSet<ScrollContainerFrame*> mPendingScrollAnchorSelection; | ||||||
|   nsTHashSet<nsIScrollableFrame*> mPendingScrollAnchorAdjustment; |   nsTHashSet<ScrollContainerFrame*> mPendingScrollAnchorAdjustment; | ||||||
|   nsTHashSet<nsIScrollableFrame*> mPendingScrollResnap; |   nsTHashSet<ScrollContainerFrame*> mPendingScrollResnap; | ||||||
| 
 | 
 | ||||||
|   nsTHashSet<nsIContent*> mHiddenContentInForcedLayout; |   nsTHashSet<nsIContent*> mHiddenContentInForcedLayout; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -39,7 +39,6 @@ | ||||||
| #include "ScrollSnap.h" | #include "ScrollSnap.h" | ||||||
| #include "nsAnimationManager.h" | #include "nsAnimationManager.h" | ||||||
| #include "nsBlockFrame.h" | #include "nsBlockFrame.h" | ||||||
| #include "nsIScrollableFrame.h" |  | ||||||
| #include "nsContentUtils.h" | #include "nsContentUtils.h" | ||||||
| #include "nsCSSFrameConstructor.h" | #include "nsCSSFrameConstructor.h" | ||||||
| #include "nsCSSRendering.h" | #include "nsCSSRendering.h" | ||||||
|  | @ -1459,7 +1458,7 @@ static inline void TryToDealWithScrollbarChange(nsChangeHint& aHint, | ||||||
|         // Under these conditions, we're OK to assume that this "overflow"
 |         // Under these conditions, we're OK to assume that this "overflow"
 | ||||||
|         // change only impacts the root viewport's scrollframe, which
 |         // change only impacts the root viewport's scrollframe, which
 | ||||||
|         // already exists, so we can simply reflow instead of reframing.
 |         // already exists, so we can simply reflow instead of reframing.
 | ||||||
|         if (nsIScrollableFrame* sf = do_QueryFrame(aFrame)) { |         if (ScrollContainerFrame* sf = do_QueryFrame(aFrame)) { | ||||||
|           sf->MarkScrollbarsDirtyForReflow(); |           sf->MarkScrollbarsDirtyForReflow(); | ||||||
|         } else if (ScrollContainerFrame* sf = |         } else if (ScrollContainerFrame* sf = | ||||||
|                        aPc->PresShell()->GetRootScrollContainerFrame()) { |                        aPc->PresShell()->GetRootScrollContainerFrame()) { | ||||||
|  | @ -1476,7 +1475,7 @@ static inline void TryToDealWithScrollbarChange(nsChangeHint& aHint, | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   const bool scrollable = aFrame->StyleDisplay()->IsScrollableOverflow(); |   const bool scrollable = aFrame->StyleDisplay()->IsScrollableOverflow(); | ||||||
|   if (nsIScrollableFrame* sf = do_QueryFrame(aFrame)) { |   if (ScrollContainerFrame* sf = do_QueryFrame(aFrame)) { | ||||||
|     if (scrollable && sf->HasAllNeededScrollbars()) { |     if (scrollable && sf->HasAllNeededScrollbars()) { | ||||||
|       sf->MarkScrollbarsDirtyForReflow(); |       sf->MarkScrollbarsDirtyForReflow(); | ||||||
|       // Once we've created scrollbars for a frame, don't bother reconstructing
 |       // Once we've created scrollbars for a frame, don't bother reconstructing
 | ||||||
|  |  | ||||||
|  | @ -7,13 +7,13 @@ | ||||||
| 
 | 
 | ||||||
| #include "mozilla/TypedEnumBits.h" | #include "mozilla/TypedEnumBits.h" | ||||||
| 
 | 
 | ||||||
| // Types used in main-thread scrolling interfaces such as nsIScrollableFrame.
 | // Types used in main-thread scrolling interfaces such as ScrollContainerFrame.
 | ||||||
| 
 | 
 | ||||||
| namespace mozilla { | namespace mozilla { | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * Scroll modes for main-thread scroll operations. These are mostly used |  * Scroll modes for main-thread scroll operations. These are mostly used | ||||||
|  * by nsIScrollableFrame methods. |  * by ScrollContainerFrame methods. | ||||||
|  * |  * | ||||||
|  * When a scroll operation is requested, we ask for instant, smooth, |  * When a scroll operation is requested, we ask for instant, smooth, | ||||||
|  * smooth msd, or normal scrolling. |  * smooth msd, or normal scrolling. | ||||||
|  |  | ||||||
|  | @ -244,7 +244,7 @@ const nsIFrame* ViewportUtils::IsZoomedContentRoot(const nsIFrame* aFrame) { | ||||||
|   } |   } | ||||||
|   if (aFrame->Type() == LayoutFrameType::Canvas || |   if (aFrame->Type() == LayoutFrameType::Canvas || | ||||||
|       aFrame->Type() == LayoutFrameType::PageSequence) { |       aFrame->Type() == LayoutFrameType::PageSequence) { | ||||||
|     nsIScrollableFrame* sf = do_QueryFrame(aFrame->GetParent()); |     ScrollContainerFrame* sf = do_QueryFrame(aFrame->GetParent()); | ||||||
|     if (sf && sf->IsRootScrollFrameOfDocument() && |     if (sf && sf->IsRootScrollFrameOfDocument() && | ||||||
|         aFrame->PresContext()->IsRootContentDocumentCrossProcess()) { |         aFrame->PresContext()->IsRootContentDocumentCrossProcess()) { | ||||||
|       return aFrame->GetParent(); |       return aFrame->GetParent(); | ||||||
|  |  | ||||||
|  | @ -77,7 +77,6 @@ | ||||||
| #include "nsIObjectLoadingContent.h" | #include "nsIObjectLoadingContent.h" | ||||||
| #include "nsIPopupContainer.h" | #include "nsIPopupContainer.h" | ||||||
| #include "nsIScriptError.h" | #include "nsIScriptError.h" | ||||||
| #include "nsIScrollableFrame.h" |  | ||||||
| #include "nsLayoutUtils.h" | #include "nsLayoutUtils.h" | ||||||
| #include "nsListControlFrame.h" | #include "nsListControlFrame.h" | ||||||
| #include "nsMathMLParts.h" | #include "nsMathMLParts.h" | ||||||
|  | @ -5477,8 +5476,9 @@ nsContainerFrame* nsCSSFrameConstructor::GetAbsoluteContainingBlock( | ||||||
|       type = absPosCBCandidate->Type(); |       type = absPosCBCandidate->Type(); | ||||||
|     } |     } | ||||||
|     if (type == LayoutFrameType::ScrollContainer) { |     if (type == LayoutFrameType::ScrollContainer) { | ||||||
|       nsIScrollableFrame* scrollFrame = do_QueryFrame(absPosCBCandidate); |       ScrollContainerFrame* scrollContainerFrame = | ||||||
|       absPosCBCandidate = scrollFrame->GetScrolledFrame(); |           do_QueryFrame(absPosCBCandidate); | ||||||
|  |       absPosCBCandidate = scrollContainerFrame->GetScrolledFrame(); | ||||||
|       if (!absPosCBCandidate) { |       if (!absPosCBCandidate) { | ||||||
|         continue; |         continue; | ||||||
|       } |       } | ||||||
|  |  | ||||||
|  | @ -14,13 +14,13 @@ | ||||||
| #include "mozilla/CaretAssociationHint.h" | #include "mozilla/CaretAssociationHint.h" | ||||||
| #include "mozilla/gfx/2D.h" | #include "mozilla/gfx/2D.h" | ||||||
| #include "mozilla/intl/BidiEmbeddingLevel.h" | #include "mozilla/intl/BidiEmbeddingLevel.h" | ||||||
|  | #include "mozilla/ScrollContainerFrame.h" | ||||||
| #include "mozilla/StaticPrefs_bidi.h" | #include "mozilla/StaticPrefs_bidi.h" | ||||||
| #include "nsCOMPtr.h" | #include "nsCOMPtr.h" | ||||||
| #include "nsFontMetrics.h" | #include "nsFontMetrics.h" | ||||||
| #include "nsITimer.h" | #include "nsITimer.h" | ||||||
| #include "nsFrameSelection.h" | #include "nsFrameSelection.h" | ||||||
| #include "nsIFrame.h" | #include "nsIFrame.h" | ||||||
| #include "nsIScrollableFrame.h" |  | ||||||
| #include "nsIContent.h" | #include "nsIContent.h" | ||||||
| #include "nsIFrameInlines.h" | #include "nsIFrameInlines.h" | ||||||
| #include "nsLayoutUtils.h" | #include "nsLayoutUtils.h" | ||||||
|  | @ -188,7 +188,7 @@ void nsCaret::SetCaretReadOnly(bool aReadOnly) { | ||||||
| static nsPoint AdjustRectForClipping(const nsRect& aRect, nsIFrame* aFrame, | static nsPoint AdjustRectForClipping(const nsRect& aRect, nsIFrame* aFrame, | ||||||
|                                      bool aVertical) { |                                      bool aVertical) { | ||||||
|   nsRect rectRelativeToClip = aRect; |   nsRect rectRelativeToClip = aRect; | ||||||
|   nsIScrollableFrame* sf = nullptr; |   ScrollContainerFrame* sf = nullptr; | ||||||
|   nsIFrame* scrollFrame = nullptr; |   nsIFrame* scrollFrame = nullptr; | ||||||
|   for (nsIFrame* current = aFrame; current; current = current->GetParent()) { |   for (nsIFrame* current = aFrame; current; current = current->GetParent()) { | ||||||
|     if ((sf = do_QueryFrame(current))) { |     if ((sf = do_QueryFrame(current))) { | ||||||
|  |  | ||||||
|  | @ -2963,7 +2963,7 @@ static nscoord ScrollPositionForFrame( | ||||||
|     const nsIFrame* aFrame, ScrollContainerFrame* aScrollContainerFrame, |     const nsIFrame* aFrame, ScrollContainerFrame* aScrollContainerFrame, | ||||||
|     float aPreviewScale) { |     float aPreviewScale) { | ||||||
|   // Note that even if the computed scroll position is out of the range of
 |   // Note that even if the computed scroll position is out of the range of
 | ||||||
|   // the scroll port, it gets clamped in nsIScrollableFrame::ScrollTo.
 |   // the scroll port, it gets clamped in ScrollContainerFrame::ScrollTo.
 | ||||||
|   return nscoord(aPreviewScale * aFrame->GetRect().Center().y - |   return nscoord(aPreviewScale * aFrame->GetRect().Center().y - | ||||||
|                  float(aScrollContainerFrame->GetScrollPortRect().height) / |                  float(aScrollContainerFrame->GetScrollPortRect().height) / | ||||||
|                      2.0f); |                      2.0f); | ||||||
|  |  | ||||||
|  | @ -781,13 +781,11 @@ bool nsLayoutUtils::ShouldDisableApzForElement(nsIContent* aContent) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void nsLayoutUtils::NotifyPaintSkipTransaction(ViewID aScrollId) { | void nsLayoutUtils::NotifyPaintSkipTransaction(ViewID aScrollId) { | ||||||
|   if (nsIScrollableFrame* scrollFrame = |   if (ScrollContainerFrame* sf = | ||||||
|           nsLayoutUtils::FindScrollContainerFrameFor(aScrollId)) { |           nsLayoutUtils::FindScrollContainerFrameFor(aScrollId)) { | ||||||
| #ifdef DEBUG |     MOZ_ASSERT(sf && sf->PresShell() && | ||||||
|     nsIFrame* f = do_QueryFrame(scrollFrame); |                !sf->PresShell()->IsResolutionUpdated()); | ||||||
|     MOZ_ASSERT(f && f->PresShell() && !f->PresShell()->IsResolutionUpdated()); |     sf->NotifyApzTransaction(); | ||||||
| #endif |  | ||||||
|     scrollFrame->NotifyApzTransaction(); |  | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1332,13 +1330,13 @@ static nsIFrame* GetNearestScrollableOrOverflowClipFrame( | ||||||
|     if ((aFlags & nsLayoutUtils::SCROLLABLE_STOP_AT_PAGE) && f->IsPageFrame()) { |     if ((aFlags & nsLayoutUtils::SCROLLABLE_STOP_AT_PAGE) && f->IsPageFrame()) { | ||||||
|       break; |       break; | ||||||
|     } |     } | ||||||
|     if (nsIScrollableFrame* scrollableFrame = do_QueryFrame(f)) { |     if (ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(f)) { | ||||||
|       if (aFlags & nsLayoutUtils::SCROLLABLE_ONLY_ASYNC_SCROLLABLE) { |       if (aFlags & nsLayoutUtils::SCROLLABLE_ONLY_ASYNC_SCROLLABLE) { | ||||||
|         if (scrollableFrame->WantAsyncScroll()) { |         if (scrollContainerFrame->WantAsyncScroll()) { | ||||||
|           return f; |           return f; | ||||||
|         } |         } | ||||||
|       } else { |       } else { | ||||||
|         ScrollStyles ss = scrollableFrame->GetScrollStyles(); |         ScrollStyles ss = scrollContainerFrame->GetScrollStyles(); | ||||||
|         if ((aFlags & nsLayoutUtils::SCROLLABLE_INCLUDE_HIDDEN) || |         if ((aFlags & nsLayoutUtils::SCROLLABLE_INCLUDE_HIDDEN) || | ||||||
|             ss.mVertical != StyleOverflow::Hidden || |             ss.mVertical != StyleOverflow::Hidden || | ||||||
|             ss.mHorizontal != StyleOverflow::Hidden) { |             ss.mHorizontal != StyleOverflow::Hidden) { | ||||||
|  | @ -2379,7 +2377,7 @@ nsRect nsLayoutUtils::ClampRectToScrollFrames(nsIFrame* aFrame, | ||||||
|   nsRect resultRect = aRect; |   nsRect resultRect = aRect; | ||||||
| 
 | 
 | ||||||
|   while (closestScrollFrame) { |   while (closestScrollFrame) { | ||||||
|     nsIScrollableFrame* sf = do_QueryFrame(closestScrollFrame); |     ScrollContainerFrame* sf = do_QueryFrame(closestScrollFrame); | ||||||
| 
 | 
 | ||||||
|     nsRect scrollPortRect = sf->GetScrollPortRect(); |     nsRect scrollPortRect = sf->GetScrollPortRect(); | ||||||
|     nsLayoutUtils::TransformRect(closestScrollFrame, aFrame, scrollPortRect); |     nsLayoutUtils::TransformRect(closestScrollFrame, aFrame, scrollPortRect); | ||||||
|  | @ -5732,8 +5730,7 @@ bool nsLayoutUtils::GetFirstLinePosition(WritingMode aWM, | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // For first-line baselines, we have to consider scroll frames.
 |     // For first-line baselines, we have to consider scroll frames.
 | ||||||
|     if (nsIScrollableFrame* sFrame = |     if (const ScrollContainerFrame* sFrame = do_QueryFrame(aFrame)) { | ||||||
|             do_QueryFrame(const_cast<nsIFrame*>(aFrame))) { |  | ||||||
|       LinePosition kidPosition; |       LinePosition kidPosition; | ||||||
|       if (GetFirstLinePosition(aWM, sFrame->GetScrolledFrame(), &kidPosition)) { |       if (GetFirstLinePosition(aWM, sFrame->GetScrolledFrame(), &kidPosition)) { | ||||||
|         // Consider only the border (Padding is ignored, since
 |         // Consider only the border (Padding is ignored, since
 | ||||||
|  | @ -5826,7 +5823,7 @@ bool nsLayoutUtils::GetLastLineBaseline(WritingMode aWM, const nsIFrame* aFrame, | ||||||
| 
 | 
 | ||||||
|   const nsBlockFrame* block = do_QueryFrame(aFrame); |   const nsBlockFrame* block = do_QueryFrame(aFrame); | ||||||
|   if (!block) { |   if (!block) { | ||||||
|     if (nsIScrollableFrame* sFrame = do_QueryFrame(aFrame)) { |     if (const ScrollContainerFrame* sFrame = do_QueryFrame(aFrame)) { | ||||||
|       // Use the baseline position only if the last line's baseline is within
 |       // Use the baseline position only if the last line's baseline is within
 | ||||||
|       // the scrolling frame's box in the initial position.
 |       // the scrolling frame's box in the initial position.
 | ||||||
|       const auto* scrolledFrame = sFrame->GetScrolledFrame(); |       const auto* scrolledFrame = sFrame->GetScrolledFrame(); | ||||||
|  | @ -8327,7 +8324,7 @@ nsMargin nsLayoutUtils::ScrollbarAreaToExcludeFromCompositionBoundsFor( | ||||||
|     return nsMargin(); |     return nsMargin(); | ||||||
|   } |   } | ||||||
|   return scrollContainerFrame->GetActualScrollbarSizes( |   return scrollContainerFrame->GetActualScrollbarSizes( | ||||||
|       nsIScrollableFrame::ScrollbarSizesOptions:: |       ScrollContainerFrame::ScrollbarSizesOptions:: | ||||||
|           INCLUDE_VISUAL_VIEWPORT_SCROLLBARS); |           INCLUDE_VISUAL_VIEWPORT_SCROLLBARS); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -24,7 +24,6 @@ | ||||||
| #include "mozilla/dom/Event.h" | #include "mozilla/dom/Event.h" | ||||||
| #include "mozilla/dom/HTMLSelectElement.h" | #include "mozilla/dom/HTMLSelectElement.h" | ||||||
| #include "mozilla/dom/Document.h" | #include "mozilla/dom/Document.h" | ||||||
| #include "nsIScrollableFrame.h" |  | ||||||
| #include "mozilla/ServoStyleSet.h" | #include "mozilla/ServoStyleSet.h" | ||||||
| #include "nsNodeInfoManager.h" | #include "nsNodeInfoManager.h" | ||||||
| #include "nsContentCreatorFunctions.h" | #include "nsContentCreatorFunctions.h" | ||||||
|  |  | ||||||
|  | @ -12,7 +12,6 @@ | ||||||
| #include "nsGkAtoms.h" | #include "nsGkAtoms.h" | ||||||
| #include "nsComboboxControlFrame.h" | #include "nsComboboxControlFrame.h" | ||||||
| #include "nsFontMetrics.h" | #include "nsFontMetrics.h" | ||||||
| #include "nsIScrollableFrame.h" |  | ||||||
| #include "nsCSSRendering.h" | #include "nsCSSRendering.h" | ||||||
| #include "nsLayoutUtils.h" | #include "nsLayoutUtils.h" | ||||||
| #include "nsDisplayList.h" | #include "nsDisplayList.h" | ||||||
|  |  | ||||||
|  | @ -225,11 +225,11 @@ LogicalSize nsTextControlFrame::CalcIntrinsicSize(gfxContext* aRenderingContext, | ||||||
| 
 | 
 | ||||||
|   // Add in the size of the scrollbars for textarea
 |   // Add in the size of the scrollbars for textarea
 | ||||||
|   if (IsTextArea()) { |   if (IsTextArea()) { | ||||||
|     nsIScrollableFrame* scrollableFrame = GetScrollTargetFrame(); |     ScrollContainerFrame* scrollContainerFrame = GetScrollTargetFrame(); | ||||||
|     NS_ASSERTION(scrollableFrame, "Child must be scrollable"); |     NS_ASSERTION(scrollContainerFrame, "Child must be scrollable"); | ||||||
|     if (scrollableFrame) { |     if (scrollContainerFrame) { | ||||||
|       LogicalMargin scrollbarSizes(aWM, |       LogicalMargin scrollbarSizes( | ||||||
|                                    scrollableFrame->GetDesiredScrollbarSizes()); |           aWM, scrollContainerFrame->GetDesiredScrollbarSizes()); | ||||||
|       intrinsicSize.ISize(aWM) += scrollbarSizes.IStartEnd(aWM); |       intrinsicSize.ISize(aWM) += scrollbarSizes.IStartEnd(aWM); | ||||||
| 
 | 
 | ||||||
|       // We only include scrollbar-thickness in our BSize if the scrollbar on
 |       // We only include scrollbar-thickness in our BSize if the scrollbar on
 | ||||||
|  |  | ||||||
|  | @ -460,11 +460,11 @@ struct ReflowInput : public SizeComputationInput { | ||||||
|     // infinite loops.
 |     // infinite loops.
 | ||||||
|     bool mIsTopOfPage : 1; |     bool mIsTopOfPage : 1; | ||||||
| 
 | 
 | ||||||
|     // parent frame is an nsIScrollableFrame and it is assuming a horizontal
 |     // parent frame is an ScrollContainerFrame and it is assuming a horizontal
 | ||||||
|     // scrollbar
 |     // scrollbar
 | ||||||
|     bool mAssumingHScrollbar : 1; |     bool mAssumingHScrollbar : 1; | ||||||
| 
 | 
 | ||||||
|     // parent frame is an nsIScrollableFrame and it is assuming a vertical
 |     // parent frame is an ScrollContainerFrame and it is assuming a vertical
 | ||||||
|     // scrollbar
 |     // scrollbar
 | ||||||
|     bool mAssumingVScrollbar : 1; |     bool mAssumingVScrollbar : 1; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -75,7 +75,7 @@ ScrollAnchorContainer* ScrollAnchorContainer::FindFor(nsIFrame* aFrame) { | ||||||
|   return nullptr; |   return nullptr; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| nsIScrollableFrame* ScrollAnchorContainer::ScrollableFrame() const { | ScrollContainerFrame* ScrollAnchorContainer::ScrollContainer() const { | ||||||
|   return Frame()->GetScrollTargetFrame(); |   return Frame()->GetScrollTargetFrame(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -314,7 +314,7 @@ void ScrollAnchorContainer::UserScrolled() { | ||||||
|   if (!StaticPrefs:: |   if (!StaticPrefs:: | ||||||
|           layout_css_scroll_anchoring_reset_heuristic_during_animation() && |           layout_css_scroll_anchoring_reset_heuristic_during_animation() && | ||||||
|       Frame()->ScrollAnimationState().contains( |       Frame()->ScrollAnimationState().contains( | ||||||
|           nsIScrollableFrame::AnimationState::APZInProgress)) { |           ScrollContainerFrame::AnimationState::APZInProgress)) { | ||||||
|     // We'd want to skip resetting our heuristic while APZ is running an async
 |     // We'd want to skip resetting our heuristic while APZ is running an async
 | ||||||
|     // scroll because this UserScrolled function gets called on every refresh
 |     // scroll because this UserScrolled function gets called on every refresh
 | ||||||
|     // driver's tick during running the async scroll, thus it will clobber the
 |     // driver's tick during running the async scroll, thus it will clobber the
 | ||||||
|  | @ -465,7 +465,7 @@ void ScrollAnchorContainer::ApplyAdjustments() { | ||||||
|            layout_css_scroll_anchoring_reset_heuristic_during_animation() && |            layout_css_scroll_anchoring_reset_heuristic_during_animation() && | ||||||
|        Frame()->IsProcessingScrollEvent()) || |        Frame()->IsProcessingScrollEvent()) || | ||||||
|       Frame()->ScrollAnimationState().contains( |       Frame()->ScrollAnimationState().contains( | ||||||
|           nsIScrollableFrame::AnimationState::TriggeredByScript) || |           ScrollContainerFrame::AnimationState::TriggeredByScript) || | ||||||
|       Frame()->GetScrollPosition() == nsPoint()) { |       Frame()->GetScrollPosition() == nsPoint()) { | ||||||
|     ANCHOR_LOG( |     ANCHOR_LOG( | ||||||
|         "Ignoring post-reflow (anchor=%p, dirty=%d, disabled=%d, " |         "Ignoring post-reflow (anchor=%p, dirty=%d, disabled=%d, " | ||||||
|  | @ -476,7 +476,7 @@ void ScrollAnchorContainer::ApplyAdjustments() { | ||||||
|         Frame()->HasPendingScrollRestoration(), |         Frame()->HasPendingScrollRestoration(), | ||||||
|         Frame()->IsProcessingScrollEvent(), |         Frame()->IsProcessingScrollEvent(), | ||||||
|         Frame()->ScrollAnimationState().contains( |         Frame()->ScrollAnimationState().contains( | ||||||
|             nsIScrollableFrame::AnimationState::TriggeredByScript), |             ScrollContainerFrame::AnimationState::TriggeredByScript), | ||||||
|         Frame()->GetScrollPosition() == nsPoint(), mSuppressAnchorAdjustment, |         Frame()->GetScrollPosition() == nsPoint(), mSuppressAnchorAdjustment, | ||||||
|         this); |         this); | ||||||
|     if (mSuppressAnchorAdjustment) { |     if (mSuppressAnchorAdjustment) { | ||||||
|  | @ -610,11 +610,11 @@ ScrollAnchorContainer::ExamineAnchorCandidate(nsIFrame* aFrame) const { | ||||||
| 
 | 
 | ||||||
|   // See if this frame has or could maintain its own anchor node.
 |   // See if this frame has or could maintain its own anchor node.
 | ||||||
|   const bool isScrollableWithAnchor = [&] { |   const bool isScrollableWithAnchor = [&] { | ||||||
|     nsIScrollableFrame* scrollable = do_QueryFrame(aFrame); |     ScrollContainerFrame* scrollContainer = do_QueryFrame(aFrame); | ||||||
|     if (!scrollable) { |     if (!scrollContainer) { | ||||||
|       return false; |       return false; | ||||||
|     } |     } | ||||||
|     auto* anchor = scrollable->Anchor(); |     auto* anchor = scrollContainer->Anchor(); | ||||||
|     return anchor->AnchorNode() || anchor->CanMaintainAnchor(); |     return anchor->AnchorNode() || anchor->CanMaintainAnchor(); | ||||||
|   }(); |   }(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -13,7 +13,6 @@ | ||||||
| 
 | 
 | ||||||
| class nsFrameList; | class nsFrameList; | ||||||
| class nsIFrame; | class nsIFrame; | ||||||
| class nsIScrollableFrame; |  | ||||||
| 
 | 
 | ||||||
| namespace mozilla { | namespace mozilla { | ||||||
| class ScrollContainerFrame; | class ScrollContainerFrame; | ||||||
|  | @ -22,8 +21,8 @@ class ScrollContainerFrame; | ||||||
| namespace mozilla::layout { | namespace mozilla::layout { | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * A scroll anchor container finds a descendent element of a scrollable frame |  * A scroll anchor container finds a descendent element of a scroll container | ||||||
|  * to be an anchor node. After every reflow, the scroll anchor will apply |  * frame to be an anchor node. After every reflow, the scroll anchor will apply | ||||||
|  * scroll adjustments to keep the anchor node in the same relative position. |  * scroll adjustments to keep the anchor node in the same relative position. | ||||||
|  * |  * | ||||||
|  * See: https://drafts.csswg.org/css-scroll-anchoring/
 |  * See: https://drafts.csswg.org/css-scroll-anchoring/
 | ||||||
|  | @ -49,14 +48,15 @@ class ScrollAnchorContainer final { | ||||||
|   ScrollContainerFrame* Frame() const; |   ScrollContainerFrame* Frame() const; | ||||||
| 
 | 
 | ||||||
|   /**
 |   /**
 | ||||||
|    * Returns the frame that owns this scroll anchor container as a scrollable |    * Returns the scroll container frame that owns this scroll anchor container. | ||||||
|    * frame. This is always non-null. |    * This is always non-null. | ||||||
|    */ |    */ | ||||||
|   nsIScrollableFrame* ScrollableFrame() const; |   ScrollContainerFrame* ScrollContainer() const; | ||||||
| 
 | 
 | ||||||
|   /**
 |   /**
 | ||||||
|    * Find a suitable anchor node among the descendants of the scrollable frame. |    * Find a suitable anchor node among the descendants of the scroll container | ||||||
|    * This should only be called after the scroll anchor has been invalidated. |    * frame. This should only be called after the scroll anchor has been | ||||||
|  |    * invalidated. | ||||||
|    */ |    */ | ||||||
|   void SelectAnchor(); |   void SelectAnchor(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1729,7 +1729,7 @@ void ScrollContainerFrame::HandleScrollbarStyleSwitching() { | ||||||
|     mScrollbarActivity->Destroy(); |     mScrollbarActivity->Destroy(); | ||||||
|     mScrollbarActivity = nullptr; |     mScrollbarActivity = nullptr; | ||||||
|   } else if (!mScrollbarActivity && UsesOverlayScrollbars()) { |   } else if (!mScrollbarActivity && UsesOverlayScrollbars()) { | ||||||
|     mScrollbarActivity = new ScrollbarActivity(do_QueryFrame(this)); |     mScrollbarActivity = new ScrollbarActivity(this); | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1877,7 +1877,7 @@ void ScrollContainerFrame::ScrollByLine(nsScrollbarFrame* aScrollbar, | ||||||
| 
 | 
 | ||||||
|   nsIntPoint overflow; |   nsIntPoint overflow; | ||||||
|   ScrollBy(delta, ScrollUnit::LINES, ScrollMode::Smooth, &overflow, |   ScrollBy(delta, ScrollUnit::LINES, ScrollMode::Smooth, &overflow, | ||||||
|            ScrollOrigin::Other, nsIScrollableFrame::NOT_MOMENTUM, aSnapFlags); |            ScrollOrigin::Other, NOT_MOMENTUM, aSnapFlags); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ScrollContainerFrame::RepeatButtonScroll(nsScrollbarFrame* aScrollbar) { | void ScrollContainerFrame::RepeatButtonScroll(nsScrollbarFrame* aScrollbar) { | ||||||
|  | @ -1932,8 +1932,8 @@ void ScrollContainerFrame::ScrollByUnit(nsScrollbarFrame* aScrollbar, | ||||||
|     delta.y = aDirection; |     delta.y = aDirection; | ||||||
|   } |   } | ||||||
|   nsIntPoint overflow; |   nsIntPoint overflow; | ||||||
|   ScrollBy(delta, aUnit, aMode, &overflow, ScrollOrigin::Other, |   ScrollBy(delta, aUnit, aMode, &overflow, ScrollOrigin::Other, NOT_MOMENTUM, | ||||||
|            nsIScrollableFrame::NOT_MOMENTUM, aSnapFlags); |            aSnapFlags); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| //-------------------- Helper ----------------------
 | //-------------------- Helper ----------------------
 | ||||||
|  | @ -4805,20 +4805,21 @@ static void CalcRangeForScrollBy(int32_t aDelta, nscoord aPos, | ||||||
|                                   (aDelta > 0 ? aPosTolerance : aNegTolerance)); |                                   (aDelta > 0 ? aPosTolerance : aNegTolerance)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ScrollContainerFrame::ScrollBy( | void ScrollContainerFrame::ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit, | ||||||
|     nsIntPoint aDelta, ScrollUnit aUnit, ScrollMode aMode, |                                     ScrollMode aMode, nsIntPoint* aOverflow, | ||||||
|     nsIntPoint* aOverflow, ScrollOrigin aOrigin, |                                     ScrollOrigin aOrigin, | ||||||
|     nsIScrollableFrame::ScrollMomentum aMomentum, ScrollSnapFlags aSnapFlags) { |                                     ScrollMomentum aMomentum, | ||||||
|  |                                     ScrollSnapFlags aSnapFlags) { | ||||||
|   // When a smooth scroll is being processed on a frame, mouse wheel and
 |   // When a smooth scroll is being processed on a frame, mouse wheel and
 | ||||||
|   // trackpad momentum scroll event updates must notcancel the SMOOTH or
 |   // trackpad momentum scroll event updates must notcancel the SMOOTH or
 | ||||||
|   // SMOOTH_MSD scroll animations, enabling Javascript that depends on them to
 |   // SMOOTH_MSD scroll animations, enabling Javascript that depends on them to
 | ||||||
|   // be responsive without forcing the user to wait for the fling animations to
 |   // be responsive without forcing the user to wait for the fling animations to
 | ||||||
|   // completely stop.
 |   // completely stop.
 | ||||||
|   switch (aMomentum) { |   switch (aMomentum) { | ||||||
|     case nsIScrollableFrame::NOT_MOMENTUM: |     case NOT_MOMENTUM: | ||||||
|       mIgnoreMomentumScroll = false; |       mIgnoreMomentumScroll = false; | ||||||
|       break; |       break; | ||||||
|     case nsIScrollableFrame::SYNTHESIZED_MOMENTUM_EVENT: |     case SYNTHESIZED_MOMENTUM_EVENT: | ||||||
|       if (mIgnoreMomentumScroll) { |       if (mIgnoreMomentumScroll) { | ||||||
|         return; |         return; | ||||||
|       } |       } | ||||||
|  | @ -6962,16 +6963,13 @@ nsRect ScrollContainerFrame::GetUnsnappedScrolledRectInternal( | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| nsMargin ScrollContainerFrame::GetActualScrollbarSizes( | nsMargin ScrollContainerFrame::GetActualScrollbarSizes( | ||||||
|     nsIScrollableFrame::ScrollbarSizesOptions |     ScrollbarSizesOptions aOptions /* = ScrollbarSizesOptions::NONE */) const { | ||||||
|         aOptions /* = nsIScrollableFrame::ScrollbarSizesOptions::NONE */) |  | ||||||
|     const { |  | ||||||
|   nsRect r = GetPaddingRectRelativeToSelf(); |   nsRect r = GetPaddingRectRelativeToSelf(); | ||||||
| 
 | 
 | ||||||
|   nsMargin m(mScrollPort.y - r.y, r.XMost() - mScrollPort.XMost(), |   nsMargin m(mScrollPort.y - r.y, r.XMost() - mScrollPort.XMost(), | ||||||
|              r.YMost() - mScrollPort.YMost(), mScrollPort.x - r.x); |              r.YMost() - mScrollPort.YMost(), mScrollPort.x - r.x); | ||||||
| 
 | 
 | ||||||
|   if (aOptions == nsIScrollableFrame::ScrollbarSizesOptions:: |   if (aOptions == ScrollbarSizesOptions::INCLUDE_VISUAL_VIEWPORT_SCROLLBARS && | ||||||
|                       INCLUDE_VISUAL_VIEWPORT_SCROLLBARS && |  | ||||||
|       !UsesOverlayScrollbars()) { |       !UsesOverlayScrollbars()) { | ||||||
|     // If we are using layout scrollbars and they only exist to scroll the
 |     // If we are using layout scrollbars and they only exist to scroll the
 | ||||||
|     // visual viewport then they do not take up any layout space (so the
 |     // visual viewport then they do not take up any layout space (so the
 | ||||||
|  | @ -7066,8 +7064,8 @@ bool ScrollContainerFrame::IsLastScrollUpdateTriggeredByScriptAnimating() | ||||||
|   return false; |   return false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| using AnimationState = nsIScrollableFrame::AnimationState; | EnumSet<ScrollContainerFrame::AnimationState> | ||||||
| EnumSet<AnimationState> ScrollContainerFrame::ScrollAnimationState() const { | ScrollContainerFrame::ScrollAnimationState() const { | ||||||
|   EnumSet<AnimationState> retval; |   EnumSet<AnimationState> retval; | ||||||
|   if (IsApzAnimationInProgress()) { |   if (IsApzAnimationInProgress()) { | ||||||
|     retval += AnimationState::APZInProgress; |     retval += AnimationState::APZInProgress; | ||||||
|  | @ -7471,7 +7469,7 @@ static void CollectScrollPositionsForSnap( | ||||||
|     ScrollContainerFrame::SnapTargetSet* aSnapTargets) { |     ScrollContainerFrame::SnapTargetSet* aSnapTargets) { | ||||||
|   // Snap positions only affect the nearest ancestor scroll container on the
 |   // Snap positions only affect the nearest ancestor scroll container on the
 | ||||||
|   // element's containing block chain.
 |   // element's containing block chain.
 | ||||||
|   nsIScrollableFrame* sf = do_QueryFrame(aFrame); |   ScrollContainerFrame* sf = do_QueryFrame(aFrame); | ||||||
|   if (sf) { |   if (sf) { | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|  | @ -8009,7 +8007,7 @@ void ScrollContainerFrame::AppendScrollUpdate( | ||||||
| void ScrollContainerFrame::ScheduleScrollAnimations() { | void ScrollContainerFrame::ScheduleScrollAnimations() { | ||||||
|   nsIContent* content = GetContent(); |   nsIContent* content = GetContent(); | ||||||
|   MOZ_ASSERT(content && content->IsElement(), |   MOZ_ASSERT(content && content->IsElement(), | ||||||
|              "The nsIScrollableFrame should have the element."); |              "The ScrollContainerFrame should have the element."); | ||||||
| 
 | 
 | ||||||
|   const Element* elementOrPseudo = content->AsElement(); |   const Element* elementOrPseudo = content->AsElement(); | ||||||
|   PseudoStyleType pseudo = elementOrPseudo->GetPseudoElementType(); |   PseudoStyleType pseudo = elementOrPseudo->GetPseudoElementType(); | ||||||
|  |  | ||||||
|  | @ -70,7 +70,6 @@ class ScrollContainerFrame : public nsContainerFrame, | ||||||
|                              public nsIStatefulFrame { |                              public nsIStatefulFrame { | ||||||
|  public: |  public: | ||||||
|   using Element = dom::Element; |   using Element = dom::Element; | ||||||
|   using InScrollingGesture = nsIScrollableFrame::InScrollingGesture; |  | ||||||
|   using ScrollAnchorContainer = layout::ScrollAnchorContainer; |   using ScrollAnchorContainer = layout::ScrollAnchorContainer; | ||||||
|   using SnapTargetSet = nsTHashSet<RefPtr<nsIContent>>; |   using SnapTargetSet = nsTHashSet<RefPtr<nsIContent>>; | ||||||
| 
 | 
 | ||||||
|  | @ -203,8 +202,7 @@ class ScrollContainerFrame : public nsContainerFrame, | ||||||
|     return result; |     return result; | ||||||
|   } |   } | ||||||
|   nsMargin GetActualScrollbarSizes( |   nsMargin GetActualScrollbarSizes( | ||||||
|       nsIScrollableFrame::ScrollbarSizesOptions aOptions = |       ScrollbarSizesOptions aOptions = ScrollbarSizesOptions::NONE) const final; | ||||||
|           nsIScrollableFrame::ScrollbarSizesOptions::NONE) const final; |  | ||||||
|   nsMargin GetDesiredScrollbarSizes() const final; |   nsMargin GetDesiredScrollbarSizes() const final; | ||||||
|   static nscoord GetNonOverlayScrollbarSize(const nsPresContext*, |   static nscoord GetNonOverlayScrollbarSize(const nsPresContext*, | ||||||
|                                             StyleScrollbarWidth); |                                             StyleScrollbarWidth); | ||||||
|  | @ -266,8 +264,7 @@ class ScrollContainerFrame : public nsContainerFrame, | ||||||
|   void ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit, ScrollMode aMode, |   void ScrollBy(nsIntPoint aDelta, ScrollUnit aUnit, ScrollMode aMode, | ||||||
|                 nsIntPoint* aOverflow = nullptr, |                 nsIntPoint* aOverflow = nullptr, | ||||||
|                 ScrollOrigin aOrigin = ScrollOrigin::NotSpecified, |                 ScrollOrigin aOrigin = ScrollOrigin::NotSpecified, | ||||||
|                 nsIScrollableFrame::ScrollMomentum aMomentum = |                 ScrollMomentum aMomentum = NOT_MOMENTUM, | ||||||
|                     nsIScrollableFrame::NOT_MOMENTUM, |  | ||||||
|                 ScrollSnapFlags aSnapFlags = ScrollSnapFlags::Disabled) final; |                 ScrollSnapFlags aSnapFlags = ScrollSnapFlags::Disabled) final; | ||||||
|   void ScrollByCSSPixels(const CSSIntPoint& aDelta, |   void ScrollByCSSPixels(const CSSIntPoint& aDelta, | ||||||
|                          ScrollMode aMode = ScrollMode::Instant) final { |                          ScrollMode aMode = ScrollMode::Instant) final { | ||||||
|  | @ -310,7 +307,6 @@ class ScrollContainerFrame : public nsContainerFrame, | ||||||
|   bool IsRectNearlyVisible(const nsRect& aRect) const final; |   bool IsRectNearlyVisible(const nsRect& aRect) const final; | ||||||
|   nsRect ExpandRectToNearlyVisible(const nsRect& aRect) const final; |   nsRect ExpandRectToNearlyVisible(const nsRect& aRect) const final; | ||||||
|   ScrollOrigin LastScrollOrigin() const final { return mLastScrollOrigin; } |   ScrollOrigin LastScrollOrigin() const final { return mLastScrollOrigin; } | ||||||
|   using AnimationState = nsIScrollableFrame::AnimationState; |  | ||||||
|   EnumSet<AnimationState> ScrollAnimationState() const final; |   EnumSet<AnimationState> ScrollAnimationState() const final; | ||||||
|   MainThreadScrollGeneration CurrentScrollGeneration() const final { |   MainThreadScrollGeneration CurrentScrollGeneration() const final { | ||||||
|     return mScrollGeneration; |     return mScrollGeneration; | ||||||
|  | @ -392,7 +388,6 @@ class ScrollContainerFrame : public nsContainerFrame, | ||||||
|   void TryResnap() final; |   void TryResnap() final; | ||||||
|   void PostPendingResnapIfNeeded(const nsIFrame* aFrame) final; |   void PostPendingResnapIfNeeded(const nsIFrame* aFrame) final; | ||||||
|   void PostPendingResnap() final; |   void PostPendingResnap() final; | ||||||
|   using PhysicalScrollSnapAlign = nsIScrollableFrame::PhysicalScrollSnapAlign; |  | ||||||
|   PhysicalScrollSnapAlign GetScrollSnapAlignFor( |   PhysicalScrollSnapAlign GetScrollSnapAlignFor( | ||||||
|       const nsIFrame* aFrame) const final; |       const nsIFrame* aFrame) const final; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -11,7 +11,6 @@ | ||||||
| #include "nsContentUtils.h" | #include "nsContentUtils.h" | ||||||
| #include "nsITimer.h" | #include "nsITimer.h" | ||||||
| #include "nsQueryFrame.h" | #include "nsQueryFrame.h" | ||||||
| #include "nsIScrollableFrame.h" |  | ||||||
| #include "PresShell.h" | #include "PresShell.h" | ||||||
| #include "nsLayoutUtils.h" | #include "nsLayoutUtils.h" | ||||||
| #include "nsScrollbarFrame.h" | #include "nsScrollbarFrame.h" | ||||||
|  | @ -20,6 +19,7 @@ | ||||||
| #include "mozilla/dom/Event.h" | #include "mozilla/dom/Event.h" | ||||||
| #include "mozilla/dom/Document.h" | #include "mozilla/dom/Document.h" | ||||||
| #include "mozilla/LookAndFeel.h" | #include "mozilla/LookAndFeel.h" | ||||||
|  | #include "mozilla/ScrollContainerFrame.h" | ||||||
| 
 | 
 | ||||||
| namespace mozilla::layout { | namespace mozilla::layout { | ||||||
| 
 | 
 | ||||||
|  | @ -100,12 +100,14 @@ ScrollbarActivity::HandleEvent(dom::Event* aEvent) { | ||||||
|     // of our scroll frame) and we don't want those to activate us.
 |     // of our scroll frame) and we don't want those to activate us.
 | ||||||
|     nsIFrame* scrollFrame = do_QueryFrame(mScrollableFrame); |     nsIFrame* scrollFrame = do_QueryFrame(mScrollableFrame); | ||||||
|     MOZ_ASSERT(scrollFrame); |     MOZ_ASSERT(scrollFrame); | ||||||
|     nsIScrollableFrame* scrollableFrame = do_QueryFrame(mScrollableFrame); |     ScrollContainerFrame* scrollContainerFrame = | ||||||
|  |         do_QueryFrame(mScrollableFrame); | ||||||
|     nsCOMPtr<nsIContent> targetContent = |     nsCOMPtr<nsIContent> targetContent = | ||||||
|         do_QueryInterface(aEvent->GetOriginalTarget()); |         do_QueryInterface(aEvent->GetOriginalTarget()); | ||||||
|     nsIFrame* targetFrame = |     nsIFrame* targetFrame = | ||||||
|         targetContent ? targetContent->GetPrimaryFrame() : nullptr; |         targetContent ? targetContent->GetPrimaryFrame() : nullptr; | ||||||
|     if ((scrollableFrame && scrollableFrame->IsRootScrollFrameOfDocument()) || |     if ((scrollContainerFrame && | ||||||
|  |          scrollContainerFrame->IsRootScrollFrameOfDocument()) || | ||||||
|         !targetFrame || |         !targetFrame || | ||||||
|         nsLayoutUtils::IsAncestorFrameCrossDocInProcess( |         nsLayoutUtils::IsAncestorFrameCrossDocInProcess( | ||||||
|             scrollFrame, targetFrame, |             scrollFrame, targetFrame, | ||||||
|  |  | ||||||
|  | @ -15,7 +15,6 @@ | ||||||
| #include "mozilla/ScrollContainerFrame.h" | #include "mozilla/ScrollContainerFrame.h" | ||||||
| #include "nsIFrame.h" | #include "nsIFrame.h" | ||||||
| #include "nsIFrameInlines.h" | #include "nsIFrameInlines.h" | ||||||
| #include "nsIScrollableFrame.h" |  | ||||||
| #include "nsLayoutUtils.h" | #include "nsLayoutUtils.h" | ||||||
| 
 | 
 | ||||||
| namespace mozilla { | namespace mozilla { | ||||||
|  | @ -23,13 +22,14 @@ namespace mozilla { | ||||||
| NS_DECLARE_FRAME_PROPERTY_DELETABLE(StickyScrollContainerProperty, | NS_DECLARE_FRAME_PROPERTY_DELETABLE(StickyScrollContainerProperty, | ||||||
|                                     StickyScrollContainer) |                                     StickyScrollContainer) | ||||||
| 
 | 
 | ||||||
| StickyScrollContainer::StickyScrollContainer(nsIScrollableFrame* aScrollFrame) | StickyScrollContainer::StickyScrollContainer( | ||||||
|     : mScrollFrame(aScrollFrame) { |     ScrollContainerFrame* aScrollContainerFrame) | ||||||
|   mScrollFrame->AddScrollPositionListener(this); |     : mScrollContainerFrame(aScrollContainerFrame) { | ||||||
|  |   mScrollContainerFrame->AddScrollPositionListener(this); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| StickyScrollContainer::~StickyScrollContainer() { | StickyScrollContainer::~StickyScrollContainer() { | ||||||
|   mScrollFrame->RemoveScrollPositionListener(this); |   mScrollContainerFrame->RemoveScrollPositionListener(this); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // static
 | // static
 | ||||||
|  | @ -167,7 +167,7 @@ void StickyScrollContainer::ComputeStickyLimits(nsIFrame* aFrame, | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   nsIFrame* scrolledFrame = mScrollFrame->GetScrolledFrame(); |   nsIFrame* scrolledFrame = mScrollContainerFrame->GetScrolledFrame(); | ||||||
|   nsIFrame* cbFrame = aFrame->GetContainingBlock(); |   nsIFrame* cbFrame = aFrame->GetContainingBlock(); | ||||||
|   NS_ASSERTION(cbFrame == scrolledFrame || |   NS_ASSERTION(cbFrame == scrolledFrame || | ||||||
|                    nsLayoutUtils::IsProperAncestorFrame(scrolledFrame, cbFrame), |                    nsLayoutUtils::IsProperAncestorFrame(scrolledFrame, cbFrame), | ||||||
|  | @ -376,7 +376,7 @@ void StickyScrollContainer::UpdatePositions(nsPoint aScrollPosition, | ||||||
|                                             nsIFrame* aSubtreeRoot) { |                                             nsIFrame* aSubtreeRoot) { | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   { |   { | ||||||
|     nsIFrame* scrollFrameAsFrame = do_QueryFrame(mScrollFrame); |     nsIFrame* scrollFrameAsFrame = do_QueryFrame(mScrollContainerFrame); | ||||||
|     NS_ASSERTION(!aSubtreeRoot || aSubtreeRoot == scrollFrameAsFrame, |     NS_ASSERTION(!aSubtreeRoot || aSubtreeRoot == scrollFrameAsFrame, | ||||||
|                  "If reflowing, should be reflowing the scroll frame"); |                  "If reflowing, should be reflowing the scroll frame"); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | @ -19,10 +19,11 @@ | ||||||
| 
 | 
 | ||||||
| struct nsRect; | struct nsRect; | ||||||
| class nsIFrame; | class nsIFrame; | ||||||
| class nsIScrollableFrame; |  | ||||||
| 
 | 
 | ||||||
| namespace mozilla { | namespace mozilla { | ||||||
| 
 | 
 | ||||||
|  | class ScrollContainerFrame; | ||||||
|  | 
 | ||||||
| class StickyScrollContainer final : public nsIScrollPositionListener { | class StickyScrollContainer final : public nsIScrollPositionListener { | ||||||
|  public: |  public: | ||||||
|   /**
 |   /**
 | ||||||
|  | @ -48,7 +49,9 @@ class StickyScrollContainer final : public nsIScrollPositionListener { | ||||||
|   void AddFrame(nsIFrame* aFrame) { mFrames.AppendElement(aFrame); } |   void AddFrame(nsIFrame* aFrame) { mFrames.AppendElement(aFrame); } | ||||||
|   void RemoveFrame(nsIFrame* aFrame) { mFrames.RemoveElement(aFrame); } |   void RemoveFrame(nsIFrame* aFrame) { mFrames.RemoveElement(aFrame); } | ||||||
| 
 | 
 | ||||||
|   nsIScrollableFrame* ScrollFrame() const { return mScrollFrame; } |   ScrollContainerFrame* ScrollContainer() const { | ||||||
|  |     return mScrollContainerFrame; | ||||||
|  |   } | ||||||
| 
 | 
 | ||||||
|   // Compute the offsets for a sticky position element
 |   // Compute the offsets for a sticky position element
 | ||||||
|   static void ComputeStickyOffsets(nsIFrame* aFrame); |   static void ComputeStickyOffsets(nsIFrame* aFrame); | ||||||
|  | @ -94,7 +97,7 @@ class StickyScrollContainer final : public nsIScrollPositionListener { | ||||||
|   bool IsStuckInYDirection(nsIFrame* aFrame) const; |   bool IsStuckInYDirection(nsIFrame* aFrame) const; | ||||||
| 
 | 
 | ||||||
|  private: |  private: | ||||||
|   explicit StickyScrollContainer(nsIScrollableFrame* aScrollFrame); |   explicit StickyScrollContainer(ScrollContainerFrame* aScrollContainerFrame); | ||||||
| 
 | 
 | ||||||
|   /**
 |   /**
 | ||||||
|    * Compute two rectangles that determine sticky positioning: |aStick|, based |    * Compute two rectangles that determine sticky positioning: |aStick|, based | ||||||
|  | @ -105,7 +108,7 @@ class StickyScrollContainer final : public nsIScrollPositionListener { | ||||||
|   void ComputeStickyLimits(nsIFrame* aFrame, nsRect* aStick, |   void ComputeStickyLimits(nsIFrame* aFrame, nsRect* aStick, | ||||||
|                            nsRect* aContain) const; |                            nsRect* aContain) const; | ||||||
| 
 | 
 | ||||||
|   nsIScrollableFrame* const mScrollFrame; |   ScrollContainerFrame* const mScrollContainerFrame; | ||||||
|   nsTArray<nsIFrame*> mFrames; |   nsTArray<nsIFrame*> mFrames; | ||||||
|   nsPoint mScrollPosition; |   nsPoint mScrollPosition; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | @ -15,8 +15,8 @@ | ||||||
| #include "mozilla/PresShell.h" | #include "mozilla/PresShell.h" | ||||||
| #include "mozilla/ProfilerLabels.h" | #include "mozilla/ProfilerLabels.h" | ||||||
| #include "mozilla/RestyleManager.h" | #include "mozilla/RestyleManager.h" | ||||||
|  | #include "mozilla/ScrollContainerFrame.h" | ||||||
| #include "nsGkAtoms.h" | #include "nsGkAtoms.h" | ||||||
| #include "nsIScrollableFrame.h" |  | ||||||
| #include "nsAbsoluteContainingBlock.h" | #include "nsAbsoluteContainingBlock.h" | ||||||
| #include "nsCanvasFrame.h" | #include "nsCanvasFrame.h" | ||||||
| #include "nsLayoutUtils.h" | #include "nsLayoutUtils.h" | ||||||
|  | @ -287,11 +287,11 @@ nsPoint ViewportFrame::AdjustReflowInputForScrollbars( | ||||||
|     ReflowInput* aReflowInput) const { |     ReflowInput* aReflowInput) const { | ||||||
|   // Get our prinicpal child frame and see if we're scrollable
 |   // Get our prinicpal child frame and see if we're scrollable
 | ||||||
|   nsIFrame* kidFrame = mFrames.FirstChild(); |   nsIFrame* kidFrame = mFrames.FirstChild(); | ||||||
|   nsIScrollableFrame* scrollingFrame = do_QueryFrame(kidFrame); |  | ||||||
| 
 | 
 | ||||||
|   if (scrollingFrame) { |   if (ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(kidFrame)) { | ||||||
|     WritingMode wm = aReflowInput->GetWritingMode(); |     WritingMode wm = aReflowInput->GetWritingMode(); | ||||||
|     LogicalMargin scrollbars(wm, scrollingFrame->GetActualScrollbarSizes()); |     LogicalMargin scrollbars(wm, | ||||||
|  |                              scrollContainerFrame->GetActualScrollbarSizes()); | ||||||
|     aReflowInput->SetComputedISize( |     aReflowInput->SetComputedISize( | ||||||
|         aReflowInput->ComputedISize() - scrollbars.IStartEnd(wm), |         aReflowInput->ComputedISize() - scrollbars.IStartEnd(wm), | ||||||
|         ReflowInput::ResetResizeFlags::No); |         ReflowInput::ResetResizeFlags::No); | ||||||
|  |  | ||||||
|  | @ -19,6 +19,7 @@ | ||||||
| #include "mozilla/DebugOnly.h" | #include "mozilla/DebugOnly.h" | ||||||
| #include "mozilla/Maybe.h" | #include "mozilla/Maybe.h" | ||||||
| #include "mozilla/PresShell.h" | #include "mozilla/PresShell.h" | ||||||
|  | #include "mozilla/ScrollContainerFrame.h" | ||||||
| #include "mozilla/StaticPrefs_browser.h" | #include "mozilla/StaticPrefs_browser.h" | ||||||
| #include "mozilla/StaticPrefs_layout.h" | #include "mozilla/StaticPrefs_layout.h" | ||||||
| #include "mozilla/ToString.h" | #include "mozilla/ToString.h" | ||||||
|  | @ -45,7 +46,6 @@ | ||||||
| #include "nsFloatManager.h" | #include "nsFloatManager.h" | ||||||
| #include "prenv.h" | #include "prenv.h" | ||||||
| #include "nsError.h" | #include "nsError.h" | ||||||
| #include "nsIScrollableFrame.h" |  | ||||||
| #include <algorithm> | #include <algorithm> | ||||||
| #include "nsLayoutUtils.h" | #include "nsLayoutUtils.h" | ||||||
| #include "nsDisplayList.h" | #include "nsDisplayList.h" | ||||||
|  | @ -1126,11 +1126,10 @@ static LogicalSize CalculateContainingBlockSizeForAbsolutes( | ||||||
| 
 | 
 | ||||||
|   // For scroll containers, we can just use cbSize (which is the padding-box
 |   // For scroll containers, we can just use cbSize (which is the padding-box
 | ||||||
|   // size of the scrolled-content frame).
 |   // size of the scrolled-content frame).
 | ||||||
|   if (nsIScrollableFrame* scrollFrame = do_QueryFrame(lastRI->mFrame)) { |   if (lastRI->mFrame->IsScrollContainerOrSubclass()) { | ||||||
|     // Assert that we're not missing any frames between the abspos containing
 |     // Assert that we're not missing any frames between the abspos containing
 | ||||||
|     // block and the scroll container.
 |     // block and the scroll container.
 | ||||||
|     // the parent.
 |     // the parent.
 | ||||||
|     Unused << scrollFrame; |  | ||||||
|     MOZ_ASSERT(lastButOneRI == &aReflowInput); |     MOZ_ASSERT(lastButOneRI == &aReflowInput); | ||||||
|     return cbSize; |     return cbSize; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | @ -278,9 +278,8 @@ nsRect nsCanvasFrame::CanvasArea() const { | ||||||
|   // matter.
 |   // matter.
 | ||||||
|   nsRect result(InkOverflowRect()); |   nsRect result(InkOverflowRect()); | ||||||
| 
 | 
 | ||||||
|   nsIScrollableFrame* scrollableFrame = do_QueryFrame(GetParent()); |   if (ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(GetParent())) { | ||||||
|   if (scrollableFrame) { |     nsRect portRect = scrollContainerFrame->GetScrollPortRect(); | ||||||
|     nsRect portRect = scrollableFrame->GetScrollPortRect(); |  | ||||||
|     result.UnionRect(result, nsRect(nsPoint(0, 0), portRect.Size())); |     result.UnionRect(result, nsRect(nsPoint(0, 0), portRect.Size())); | ||||||
|   } |   } | ||||||
|   return result; |   return result; | ||||||
|  | @ -587,12 +586,11 @@ void nsCanvasFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, | ||||||
| void nsCanvasFrame::PaintFocus(DrawTarget* aDrawTarget, nsPoint aPt) { | void nsCanvasFrame::PaintFocus(DrawTarget* aDrawTarget, nsPoint aPt) { | ||||||
|   nsRect focusRect(aPt, GetSize()); |   nsRect focusRect(aPt, GetSize()); | ||||||
| 
 | 
 | ||||||
|   nsIScrollableFrame* scrollableFrame = do_QueryFrame(GetParent()); |   if (ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(GetParent())) { | ||||||
|   if (scrollableFrame) { |     nsRect portRect = scrollContainerFrame->GetScrollPortRect(); | ||||||
|     nsRect portRect = scrollableFrame->GetScrollPortRect(); |  | ||||||
|     focusRect.width = portRect.width; |     focusRect.width = portRect.width; | ||||||
|     focusRect.height = portRect.height; |     focusRect.height = portRect.height; | ||||||
|     focusRect.MoveBy(scrollableFrame->GetScrollPosition()); |     focusRect.MoveBy(scrollContainerFrame->GetScrollPosition()); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // XXX use the root frame foreground color, but should we find BODY frame
 |   // XXX use the root frame foreground color, but should we find BODY frame
 | ||||||
|  |  | ||||||
|  | @ -1662,16 +1662,16 @@ nsIFrame* nsFrameSelection::GetFrameToPageSelect() const { | ||||||
|     // parent under the root frame.
 |     // parent under the root frame.
 | ||||||
|     for (nsIFrame* frame = contentToSelect->GetPrimaryFrame(); |     for (nsIFrame* frame = contentToSelect->GetPrimaryFrame(); | ||||||
|          frame && frame != rootFrameToSelect; frame = frame->GetParent()) { |          frame && frame != rootFrameToSelect; frame = frame->GetParent()) { | ||||||
|       nsIScrollableFrame* scrollableFrame = do_QueryFrame(frame); |       ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(frame); | ||||||
|       if (!scrollableFrame) { |       if (!scrollContainerFrame) { | ||||||
|         continue; |         continue; | ||||||
|       } |       } | ||||||
|       ScrollStyles scrollStyles = scrollableFrame->GetScrollStyles(); |       ScrollStyles scrollStyles = scrollContainerFrame->GetScrollStyles(); | ||||||
|       if (scrollStyles.mVertical == StyleOverflow::Hidden) { |       if (scrollStyles.mVertical == StyleOverflow::Hidden) { | ||||||
|         continue; |         continue; | ||||||
|       } |       } | ||||||
|       layers::ScrollDirections directions = |       layers::ScrollDirections directions = | ||||||
|           scrollableFrame->GetAvailableScrollingDirections(); |           scrollContainerFrame->GetAvailableScrollingDirections(); | ||||||
|       if (directions.contains(layers::ScrollDirection::eVertical)) { |       if (directions.contains(layers::ScrollDirection::eVertical)) { | ||||||
|         // If there is sub scrollable frame, let's use its page size to select.
 |         // If there is sub scrollable frame, let's use its page size to select.
 | ||||||
|         return frame; |         return frame; | ||||||
|  |  | ||||||
|  | @ -217,7 +217,6 @@ enum class TableSelectionMode : uint32_t { | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| }  // namespace mozilla
 | }  // namespace mozilla
 | ||||||
| class nsIScrollableFrame; |  | ||||||
| 
 | 
 | ||||||
| class nsFrameSelection final { | class nsFrameSelection final { | ||||||
|  public: |  public: | ||||||
|  |  | ||||||
|  | @ -7542,7 +7542,7 @@ nsGridContainerFrame::GetNearestFragmentainer( | ||||||
|   WritingMode wm = aState.mWM; |   WritingMode wm = aState.mWM; | ||||||
|   const ReflowInput* cbRI = gridRI->mCBReflowInput; |   const ReflowInput* cbRI = gridRI->mCBReflowInput; | ||||||
|   for (; cbRI; cbRI = cbRI->mCBReflowInput) { |   for (; cbRI; cbRI = cbRI->mCBReflowInput) { | ||||||
|     nsIScrollableFrame* sf = do_QueryFrame(cbRI->mFrame); |     ScrollContainerFrame* sf = do_QueryFrame(cbRI->mFrame); | ||||||
|     if (sf) { |     if (sf) { | ||||||
|       break; |       break; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -1217,8 +1217,8 @@ void nsIFrame::DidSetComputedStyle(ComputedStyle* aOldComputedStyle) { | ||||||
|       if (auto* container = ScrollAnchorContainer::FindFor(this)) { |       if (auto* container = ScrollAnchorContainer::FindFor(this)) { | ||||||
|         container->InvalidateAnchor(); |         container->InvalidateAnchor(); | ||||||
|       } |       } | ||||||
|       if (nsIScrollableFrame* scrollableFrame = do_QueryFrame(this)) { |       if (ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(this)) { | ||||||
|         scrollableFrame->Anchor()->InvalidateAnchor(); |         scrollContainerFrame->Anchor()->InvalidateAnchor(); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -2185,8 +2185,7 @@ void nsIFrame::UpdateVisibilitySynchronously() { | ||||||
|   nsRect rect = GetRectRelativeToSelf(); |   nsRect rect = GetRectRelativeToSelf(); | ||||||
|   nsIFrame* rectFrame = this; |   nsIFrame* rectFrame = this; | ||||||
|   while (f && visible) { |   while (f && visible) { | ||||||
|     nsIScrollableFrame* sf = do_QueryFrame(f); |     if (ScrollContainerFrame* sf = do_QueryFrame(f)) { | ||||||
|     if (sf) { |  | ||||||
|       nsRect transformedRect = |       nsRect transformedRect = | ||||||
|           nsLayoutUtils::TransformFrameRectToAncestor(rectFrame, rect, f); |           nsLayoutUtils::TransformFrameRectToAncestor(rectFrame, rect, f); | ||||||
|       if (!sf->IsRectNearlyVisible(transformedRect)) { |       if (!sf->IsRectNearlyVisible(transformedRect)) { | ||||||
|  | @ -3785,8 +3784,8 @@ void nsIFrame::BuildDisplayListForStackingContext( | ||||||
| 
 | 
 | ||||||
|     StickyScrollContainer* stickyScrollContainer = |     StickyScrollContainer* stickyScrollContainer = | ||||||
|         StickyScrollContainer::GetStickyScrollContainerForFrame(this); |         StickyScrollContainer::GetStickyScrollContainerForFrame(this); | ||||||
|     if (stickyScrollContainer && |     if (stickyScrollContainer && stickyScrollContainer->ScrollContainer() | ||||||
|         stickyScrollContainer->ScrollFrame()->IsMaybeAsynchronouslyScrolled()) { |                                      ->IsMaybeAsynchronouslyScrolled()) { | ||||||
|       shouldFlatten = false; |       shouldFlatten = false; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -10799,17 +10798,17 @@ bool nsIFrame::IsFocusableDueToScrollFrame() { | ||||||
|   // with the mouse, because the extra focus outlines are considered
 |   // with the mouse, because the extra focus outlines are considered
 | ||||||
|   // unnecessarily ugly.  When clicked on, the selection position within the
 |   // unnecessarily ugly.  When clicked on, the selection position within the
 | ||||||
|   // element will be enough to make them keyboard scrollable.
 |   // element will be enough to make them keyboard scrollable.
 | ||||||
|   nsIScrollableFrame* scrollFrame = do_QueryFrame(this); |   ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(this); | ||||||
|   if (!scrollFrame) { |   if (!scrollContainerFrame) { | ||||||
|     return false; |     return false; | ||||||
|   } |   } | ||||||
|   if (scrollFrame->IsForTextControlWithNoScrollbars()) { |   if (scrollContainerFrame->IsForTextControlWithNoScrollbars()) { | ||||||
|     return false; |     return false; | ||||||
|   } |   } | ||||||
|   if (scrollFrame->GetScrollStyles().IsHiddenInBothDirections()) { |   if (scrollContainerFrame->GetScrollStyles().IsHiddenInBothDirections()) { | ||||||
|     return false; |     return false; | ||||||
|   } |   } | ||||||
|   if (scrollFrame->GetScrollRange().IsEqualEdges(nsRect(0, 0, 0, 0))) { |   if (scrollContainerFrame->GetScrollRange().IsEqualEdges(nsRect(0, 0, 0, 0))) { | ||||||
|     return false; |     return false; | ||||||
|   } |   } | ||||||
|   return true; |   return true; | ||||||
|  | @ -11174,8 +11173,8 @@ static bool IsFrameScrolledOutOfView(const nsIFrame* aTarget, | ||||||
|   // subtree
 |   // subtree
 | ||||||
|   for (nsIFrame* f = const_cast<nsIFrame*>(aParent); f; |   for (nsIFrame* f = const_cast<nsIFrame*>(aParent); f; | ||||||
|        f = nsLayoutUtils::GetCrossDocParentFrameInProcess(f)) { |        f = nsLayoutUtils::GetCrossDocParentFrameInProcess(f)) { | ||||||
|     nsIScrollableFrame* scrollableFrame = do_QueryFrame(f); |     ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(f); | ||||||
|     if (scrollableFrame) { |     if (scrollContainerFrame) { | ||||||
|       clipParent = f; |       clipParent = f; | ||||||
|       break; |       break; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -11,7 +11,7 @@ | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * Provides a way to learn about scroll position changes of |  * Provides a way to learn about scroll position changes of | ||||||
|  * nsIScrollableFrame's. |  * ScrollContainerFrame's. | ||||||
|  */ |  */ | ||||||
| class nsIScrollPositionListener { | class nsIScrollPositionListener { | ||||||
|  public: |  public: | ||||||
|  |  | ||||||
|  | @ -11,8 +11,6 @@ | ||||||
| #include "DisplayItemClip.h" | #include "DisplayItemClip.h" | ||||||
| #include "nsString.h" | #include "nsString.h" | ||||||
| 
 | 
 | ||||||
| class nsIScrollableFrame; |  | ||||||
| 
 |  | ||||||
| namespace mozilla { | namespace mozilla { | ||||||
| 
 | 
 | ||||||
| struct ActiveScrolledRoot; | struct ActiveScrolledRoot; | ||||||
|  |  | ||||||
|  | @ -13,7 +13,6 @@ | ||||||
| #include "mozilla/DebugOnly.h" | #include "mozilla/DebugOnly.h" | ||||||
| 
 | 
 | ||||||
| class nsIFrame; | class nsIFrame; | ||||||
| class nsIScrollableFrame; |  | ||||||
| 
 | 
 | ||||||
| namespace mozilla { | namespace mozilla { | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -973,7 +973,7 @@ static bool ProcessFrameInternal(nsIFrame* aFrame, | ||||||
| 
 | 
 | ||||||
|     // Check whether the current frame is a scrollable frame with display port.
 |     // Check whether the current frame is a scrollable frame with display port.
 | ||||||
|     nsRect displayPort; |     nsRect displayPort; | ||||||
|     nsIScrollableFrame* sf = do_QueryFrame(currentFrame); |     ScrollContainerFrame* sf = do_QueryFrame(currentFrame); | ||||||
|     nsIContent* content = sf ? currentFrame->GetContent() : nullptr; |     nsIContent* content = sf ? currentFrame->GetContent() : nullptr; | ||||||
| 
 | 
 | ||||||
|     if (content && DisplayPortUtils::GetDisplayPort(content, &displayPort)) { |     if (content && DisplayPortUtils::GetDisplayPort(content, &displayPort)) { | ||||||
|  |  | ||||||
|  | @ -2184,15 +2184,15 @@ void nsCSSRendering::GetImageLayerClip( | ||||||
|     // like the content. (See below.)
 |     // like the content. (See below.)
 | ||||||
|     // Therefore, only 'content-box' makes a difference here.
 |     // Therefore, only 'content-box' makes a difference here.
 | ||||||
|     if (layerClip == StyleGeometryBox::ContentBox) { |     if (layerClip == StyleGeometryBox::ContentBox) { | ||||||
|       nsIScrollableFrame* scrollableFrame = do_QueryFrame(aForFrame); |       ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(aForFrame); | ||||||
|       // Clip at a rectangle attached to the scrolled content.
 |       // Clip at a rectangle attached to the scrolled content.
 | ||||||
|       aClipState->mHasAdditionalBGClipArea = true; |       aClipState->mHasAdditionalBGClipArea = true; | ||||||
|       aClipState->mAdditionalBGClipArea = |       aClipState->mAdditionalBGClipArea = | ||||||
|           nsRect(aClipState->mBGClipArea.TopLeft() + |           nsRect(aClipState->mBGClipArea.TopLeft() + | ||||||
|                      scrollableFrame->GetScrolledFrame()->GetPosition() |                      scrollContainerFrame->GetScrolledFrame()->GetPosition() | ||||||
|                      // For the dir=rtl case:
 |                      // For the dir=rtl case:
 | ||||||
|                      + scrollableFrame->GetScrollRange().TopLeft(), |                      + scrollContainerFrame->GetScrollRange().TopLeft(), | ||||||
|                  scrollableFrame->GetScrolledRect().Size()); |                  scrollContainerFrame->GetScrolledRect().Size()); | ||||||
|       nsMargin padding = aForFrame->GetUsedPadding(); |       nsMargin padding = aForFrame->GetUsedPadding(); | ||||||
|       // padding-bottom is ignored on scrollable frames:
 |       // padding-bottom is ignored on scrollable frames:
 | ||||||
|       // https://bugzilla.mozilla.org/show_bug.cgi?id=748518
 |       // https://bugzilla.mozilla.org/show_bug.cgi?id=748518
 | ||||||
|  | @ -2771,11 +2771,12 @@ nsRect nsCSSRendering::ComputeImageLayerPositioningArea( | ||||||
|   nsIFrame* geometryFrame = aForFrame; |   nsIFrame* geometryFrame = aForFrame; | ||||||
|   if (MOZ_UNLIKELY(frameType == LayoutFrameType::ScrollContainer && |   if (MOZ_UNLIKELY(frameType == LayoutFrameType::ScrollContainer && | ||||||
|                    StyleImageLayerAttachment::Local == aLayer.mAttachment)) { |                    StyleImageLayerAttachment::Local == aLayer.mAttachment)) { | ||||||
|     nsIScrollableFrame* scrollableFrame = do_QueryFrame(aForFrame); |     ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(aForFrame); | ||||||
|     positionArea = nsRect(scrollableFrame->GetScrolledFrame()->GetPosition() |     positionArea = | ||||||
|                               // For the dir=rtl case:
 |         nsRect(scrollContainerFrame->GetScrolledFrame()->GetPosition() | ||||||
|                               + scrollableFrame->GetScrollRange().TopLeft(), |                    // For the dir=rtl case:
 | ||||||
|                           scrollableFrame->GetScrolledRect().Size()); |                    + scrollContainerFrame->GetScrollRange().TopLeft(), | ||||||
|  |                scrollContainerFrame->GetScrolledRect().Size()); | ||||||
|     // The ScrolledRect’s size does not include the borders or scrollbars,
 |     // The ScrolledRect’s size does not include the borders or scrollbars,
 | ||||||
|     // reverse the handling of background-origin
 |     // reverse the handling of background-origin
 | ||||||
|     // compared to the common case below.
 |     // compared to the common case below.
 | ||||||
|  | @ -2783,7 +2784,7 @@ nsRect nsCSSRendering::ComputeImageLayerPositioningArea( | ||||||
|       nsMargin border = geometryFrame->GetUsedBorder(); |       nsMargin border = geometryFrame->GetUsedBorder(); | ||||||
|       border.ApplySkipSides(geometryFrame->GetSkipSides()); |       border.ApplySkipSides(geometryFrame->GetSkipSides()); | ||||||
|       positionArea.Inflate(border); |       positionArea.Inflate(border); | ||||||
|       positionArea.Inflate(scrollableFrame->GetActualScrollbarSizes()); |       positionArea.Inflate(scrollContainerFrame->GetActualScrollbarSizes()); | ||||||
|     } else if (layerOrigin != StyleGeometryBox::PaddingBox) { |     } else if (layerOrigin != StyleGeometryBox::PaddingBox) { | ||||||
|       nsMargin padding = geometryFrame->GetUsedPadding(); |       nsMargin padding = geometryFrame->GetUsedPadding(); | ||||||
|       padding.ApplySkipSides(geometryFrame->GetSkipSides()); |       padding.ApplySkipSides(geometryFrame->GetSkipSides()); | ||||||
|  |  | ||||||
|  | @ -912,16 +912,16 @@ bool nsDisplayListBuilder::ShouldRebuildDisplayListDueToPrefChange() { | ||||||
|   return false; |   return false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void nsDisplayListBuilder::AddScrollFrameToNotify( | void nsDisplayListBuilder::AddScrollContainerFrameToNotify( | ||||||
|     nsIScrollableFrame* aScrollFrame) { |     ScrollContainerFrame* aScrollContainerFrame) { | ||||||
|   mScrollFramesToNotify.insert(aScrollFrame); |   mScrollContainerFramesToNotify.insert(aScrollContainerFrame); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void nsDisplayListBuilder::NotifyAndClearScrollFrames() { | void nsDisplayListBuilder::NotifyAndClearScrollContainerFrames() { | ||||||
|   for (const auto& it : mScrollFramesToNotify) { |   for (const auto& it : mScrollContainerFramesToNotify) { | ||||||
|     it->NotifyApzTransaction(); |     it->NotifyApzTransaction(); | ||||||
|   } |   } | ||||||
|   mScrollFramesToNotify.clear(); |   mScrollContainerFramesToNotify.clear(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool nsDisplayListBuilder::MarkOutOfFlowFrameForDisplay( | bool nsDisplayListBuilder::MarkOutOfFlowFrameForDisplay( | ||||||
|  | @ -1621,8 +1621,8 @@ static bool IsStickyFrameActive(nsDisplayListBuilder* aBuilder, | ||||||
| 
 | 
 | ||||||
|   StickyScrollContainer* stickyScrollContainer = |   StickyScrollContainer* stickyScrollContainer = | ||||||
|       StickyScrollContainer::GetStickyScrollContainerForFrame(aFrame); |       StickyScrollContainer::GetStickyScrollContainerForFrame(aFrame); | ||||||
|   return stickyScrollContainer && |   return stickyScrollContainer && stickyScrollContainer->ScrollContainer() | ||||||
|          stickyScrollContainer->ScrollFrame()->IsMaybeAsynchronouslyScrolled(); |                                       ->IsMaybeAsynchronouslyScrolled(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool nsDisplayListBuilder::IsAnimatedGeometryRoot(nsIFrame* aFrame, | bool nsDisplayListBuilder::IsAnimatedGeometryRoot(nsIFrame* aFrame, | ||||||
|  | @ -1657,7 +1657,7 @@ bool nsDisplayListBuilder::IsAnimatedGeometryRoot(nsIFrame* aFrame, | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   if (parent->IsScrollContainerOrSubclass()) { |   if (parent->IsScrollContainerOrSubclass()) { | ||||||
|     nsIScrollableFrame* sf = do_QueryFrame(parent); |     ScrollContainerFrame* sf = do_QueryFrame(parent); | ||||||
|     if (sf->GetScrolledFrame() == aFrame) { |     if (sf->GetScrolledFrame() == aFrame) { | ||||||
|       MOZ_ASSERT(!aFrame->IsTransformed()); |       MOZ_ASSERT(!aFrame->IsTransformed()); | ||||||
|       return sf->IsMaybeAsynchronouslyScrolled(); |       return sf->IsMaybeAsynchronouslyScrolled(); | ||||||
|  | @ -5582,9 +5582,9 @@ StickyScrollContainer* nsDisplayStickyPosition::GetStickyScrollContainer() { | ||||||
|     // will never be asynchronously scrolled. Instead we will always position
 |     // will never be asynchronously scrolled. Instead we will always position
 | ||||||
|     // the sticky items correctly on the gecko side and WR will never need to
 |     // the sticky items correctly on the gecko side and WR will never need to
 | ||||||
|     // adjust their position itself.
 |     // adjust their position itself.
 | ||||||
|     MOZ_ASSERT( |     MOZ_ASSERT(stickyScrollContainer->ScrollContainer() | ||||||
|         stickyScrollContainer->ScrollFrame()->IsMaybeAsynchronouslyScrolled()); |                    ->IsMaybeAsynchronouslyScrolled()); | ||||||
|     if (!stickyScrollContainer->ScrollFrame() |     if (!stickyScrollContainer->ScrollContainer() | ||||||
|              ->IsMaybeAsynchronouslyScrolled()) { |              ->IsMaybeAsynchronouslyScrolled()) { | ||||||
|       stickyScrollContainer = nullptr; |       stickyScrollContainer = nullptr; | ||||||
|     } |     } | ||||||
|  | @ -5618,14 +5618,14 @@ bool nsDisplayStickyPosition::CreateWebRenderCommands( | ||||||
|     nsRectAbsolute inner; |     nsRectAbsolute inner; | ||||||
|     stickyScrollContainer->GetScrollRanges(mFrame, &outer, &inner); |     stickyScrollContainer->GetScrollRanges(mFrame, &outer, &inner); | ||||||
| 
 | 
 | ||||||
|     nsIFrame* scrollFrame = do_QueryFrame(stickyScrollContainer->ScrollFrame()); |  | ||||||
|     nsPoint offset = |     nsPoint offset = | ||||||
|         scrollFrame->GetOffsetToCrossDoc(Frame()) + ToReferenceFrame(); |         stickyScrollContainer->ScrollContainer()->GetOffsetToCrossDoc(Frame()) + | ||||||
|  |         ToReferenceFrame(); | ||||||
| 
 | 
 | ||||||
|     // Adjust the scrollPort coordinates to be relative to the reference frame,
 |     // Adjust the scrollPort coordinates to be relative to the reference frame,
 | ||||||
|     // so that it is in the same space as everything else.
 |     // so that it is in the same space as everything else.
 | ||||||
|     nsRect scrollPort = |     nsRect scrollPort = | ||||||
|         stickyScrollContainer->ScrollFrame()->GetScrollPortRect(); |         stickyScrollContainer->ScrollContainer()->GetScrollPortRect(); | ||||||
|     scrollPort += offset; |     scrollPort += offset; | ||||||
| 
 | 
 | ||||||
|     // The following computations make more sense upon understanding the
 |     // The following computations make more sense upon understanding the
 | ||||||
|  | @ -5821,10 +5821,10 @@ bool nsDisplayStickyPosition::UpdateScrollData( | ||||||
|           nsLayoutUtils::GetSideBitsForFixedPositionContent(mFrame); |           nsLayoutUtils::GetSideBitsForFixedPositionContent(mFrame); | ||||||
|       aLayerData->SetFixedPositionSides(sides); |       aLayerData->SetFixedPositionSides(sides); | ||||||
| 
 | 
 | ||||||
|       ScrollableLayerGuid::ViewID scrollId = |       ScrollableLayerGuid::ViewID scrollId = nsLayoutUtils::FindOrCreateIDFor( | ||||||
|           nsLayoutUtils::FindOrCreateIDFor(stickyScrollContainer->ScrollFrame() |           stickyScrollContainer->ScrollContainer() | ||||||
|                                                ->GetScrolledFrame() |               ->GetScrolledFrame() | ||||||
|                                                ->GetContent()); |               ->GetContent()); | ||||||
|       aLayerData->SetStickyPositionScrollContainerId(scrollId); |       aLayerData->SetStickyPositionScrollContainerId(scrollId); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -5869,7 +5869,7 @@ UniquePtr<ScrollMetadata> nsDisplayScrollInfoLayer::ComputeScrollMetadata( | ||||||
|   ScrollContainerFrame* scrollContainerFrame = |   ScrollContainerFrame* scrollContainerFrame = | ||||||
|       mScrollFrame->GetScrollTargetFrame(); |       mScrollFrame->GetScrollTargetFrame(); | ||||||
|   if (scrollContainerFrame) { |   if (scrollContainerFrame) { | ||||||
|     aBuilder->AddScrollFrameToNotify(scrollContainerFrame); |     aBuilder->AddScrollContainerFrameToNotify(scrollContainerFrame); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   return UniquePtr<ScrollMetadata>(new ScrollMetadata(metadata)); |   return UniquePtr<ScrollMetadata>(new ScrollMetadata(metadata)); | ||||||
|  | @ -5960,9 +5960,10 @@ void nsDisplayAsyncZoom::HitTest(nsDisplayListBuilder* aBuilder, | ||||||
|                                  const nsRect& aRect, HitTestState* aState, |                                  const nsRect& aRect, HitTestState* aState, | ||||||
|                                  nsTArray<nsIFrame*>* aOutFrames) { |                                  nsTArray<nsIFrame*>* aOutFrames) { | ||||||
| #ifdef DEBUG | #ifdef DEBUG | ||||||
|   nsIScrollableFrame* scrollFrame = do_QueryFrame(mFrame); |   ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(mFrame); | ||||||
|   MOZ_ASSERT(scrollFrame && ViewportUtils::IsZoomedContentRoot( |   MOZ_ASSERT(scrollContainerFrame && | ||||||
|                                 scrollFrame->GetScrolledFrame())); |              ViewportUtils::IsZoomedContentRoot( | ||||||
|  |                  scrollContainerFrame->GetScrolledFrame())); | ||||||
| #endif | #endif | ||||||
|   nsRect rect = ViewportUtils::VisualToLayout(aRect, mFrame->PresShell()); |   nsRect rect = ViewportUtils::VisualToLayout(aRect, mFrame->PresShell()); | ||||||
|   mList.HitTest(aBuilder, rect, aState, aOutFrames); |   mList.HitTest(aBuilder, rect, aState, aOutFrames); | ||||||
|  |  | ||||||
|  | @ -65,7 +65,6 @@ | ||||||
| 
 | 
 | ||||||
| class gfxContext; | class gfxContext; | ||||||
| class nsIContent; | class nsIContent; | ||||||
| class nsIScrollableFrame; |  | ||||||
| class nsSubDocumentFrame; | class nsSubDocumentFrame; | ||||||
| class nsCaret; | class nsCaret; | ||||||
| struct WrFiltersHolder; | struct WrFiltersHolder; | ||||||
|  | @ -1643,8 +1642,9 @@ class nsDisplayListBuilder { | ||||||
|     } |     } | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   void AddScrollFrameToNotify(nsIScrollableFrame* aScrollFrame); |   void AddScrollContainerFrameToNotify( | ||||||
|   void NotifyAndClearScrollFrames(); |       ScrollContainerFrame* aScrollContainerFrame); | ||||||
|  |   void NotifyAndClearScrollContainerFrames(); | ||||||
| 
 | 
 | ||||||
|   // Helper class to find what link spec (if any) to associate with a frame,
 |   // Helper class to find what link spec (if any) to associate with a frame,
 | ||||||
|   // recording it in the builder, and generate the corresponding DisplayItem.
 |   // recording it in the builder, and generate the corresponding DisplayItem.
 | ||||||
|  | @ -1829,7 +1829,7 @@ class nsDisplayListBuilder { | ||||||
|   std::unordered_set<const DisplayItemClipChain*, DisplayItemClipChainHasher, |   std::unordered_set<const DisplayItemClipChain*, DisplayItemClipChainHasher, | ||||||
|                      DisplayItemClipChainEqualer> |                      DisplayItemClipChainEqualer> | ||||||
|       mClipDeduplicator; |       mClipDeduplicator; | ||||||
|   std::unordered_set<nsIScrollableFrame*> mScrollFramesToNotify; |   std::unordered_set<ScrollContainerFrame*> mScrollContainerFramesToNotify; | ||||||
| 
 | 
 | ||||||
|   AutoTArray<nsIFrame*, 20> mFramesWithOOFData; |   AutoTArray<nsIFrame*, 20> mFramesWithOOFData; | ||||||
|   AutoTArray<nsIFrame*, 40> mFramesMarkedForDisplayIfVisible; |   AutoTArray<nsIFrame*, 40> mFramesMarkedForDisplayIfVisible; | ||||||
|  |  | ||||||
|  | @ -23,7 +23,6 @@ | ||||||
| #include "nsIFrame.h" | #include "nsIFrame.h" | ||||||
| #include "nsIFrameInlines.h" | #include "nsIFrameInlines.h" | ||||||
| #include "mozilla/ComputedStyle.h" | #include "mozilla/ComputedStyle.h" | ||||||
| #include "nsIScrollableFrame.h" |  | ||||||
| #include "nsContentUtils.h" | #include "nsContentUtils.h" | ||||||
| #include "nsDocShell.h" | #include "nsDocShell.h" | ||||||
| #include "nsIContent.h" | #include "nsIContent.h" | ||||||
|  | @ -2014,9 +2013,9 @@ nscoord nsComputedDOMStyle::GetUsedAbsoluteOffset(mozilla::Side aSide) { | ||||||
|     // scrollbars.  We have to do some extra work.
 |     // scrollbars.  We have to do some extra work.
 | ||||||
|     // the first child in the default frame list is what we want
 |     // the first child in the default frame list is what we want
 | ||||||
|     nsIFrame* scrollingChild = container->PrincipalChildList().FirstChild(); |     nsIFrame* scrollingChild = container->PrincipalChildList().FirstChild(); | ||||||
|     nsIScrollableFrame* scrollFrame = do_QueryFrame(scrollingChild); |     ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(scrollingChild); | ||||||
|     if (scrollFrame) { |     if (scrollContainerFrame) { | ||||||
|       scrollbarSizes = scrollFrame->GetActualScrollbarSizes(); |       scrollbarSizes = scrollContainerFrame->GetActualScrollbarSizes(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     // The viewport size might have been expanded by the visual viewport or
 |     // The viewport size might have been expanded by the visual viewport or
 | ||||||
|  |  | ||||||
|  | @ -533,7 +533,7 @@ static bool CellHasVisibleContent(nsTableFrame* aTableFrame, | ||||||
| 
 | 
 | ||||||
| nsIFrame* nsTableCellFrame::CellContentFrame() const { | nsIFrame* nsTableCellFrame::CellContentFrame() const { | ||||||
|   nsIFrame* inner = mFrames.FirstChild(); |   nsIFrame* inner = mFrames.FirstChild(); | ||||||
|   if (nsIScrollableFrame* sf = do_QueryFrame(inner)) { |   if (ScrollContainerFrame* sf = do_QueryFrame(inner)) { | ||||||
|     return sf->GetScrolledFrame(); |     return sf->GetScrolledFrame(); | ||||||
|   } |   } | ||||||
|   return inner; |   return inner; | ||||||
|  |  | ||||||
|  | @ -47,7 +47,6 @@ | ||||||
| #include "mozilla/RestyleManager.h" | #include "mozilla/RestyleManager.h" | ||||||
| #include "mozilla/ServoStyleSet.h" | #include "mozilla/ServoStyleSet.h" | ||||||
| #include "nsDisplayList.h" | #include "nsDisplayList.h" | ||||||
| #include "nsIScrollableFrame.h" |  | ||||||
| #include "nsCSSProps.h" | #include "nsCSSProps.h" | ||||||
| #include "nsLayoutUtils.h" | #include "nsLayoutUtils.h" | ||||||
| #include "nsStyleChangeList.h" | #include "nsStyleChangeList.h" | ||||||
|  |  | ||||||
|  | @ -24,7 +24,6 @@ | ||||||
| #include "nsFrameManager.h" | #include "nsFrameManager.h" | ||||||
| #include "mozilla/dom/Document.h" | #include "mozilla/dom/Document.h" | ||||||
| #include "nsRect.h" | #include "nsRect.h" | ||||||
| #include "nsIScrollableFrame.h" |  | ||||||
| #include "nsIPopupContainer.h" | #include "nsIPopupContainer.h" | ||||||
| #include "nsIDocShell.h" | #include "nsIDocShell.h" | ||||||
| #include "nsReadableUtils.h" | #include "nsReadableUtils.h" | ||||||
|  | @ -53,6 +52,7 @@ | ||||||
| #include "mozilla/LookAndFeel.h" | #include "mozilla/LookAndFeel.h" | ||||||
| #include "mozilla/MouseEvents.h" | #include "mozilla/MouseEvents.h" | ||||||
| #include "mozilla/PresShell.h" | #include "mozilla/PresShell.h" | ||||||
|  | #include "mozilla/ScrollContainerFrame.h" | ||||||
| #include "mozilla/Services.h" | #include "mozilla/Services.h" | ||||||
| #include "mozilla/dom/BrowserParent.h" | #include "mozilla/dom/BrowserParent.h" | ||||||
| #include "mozilla/dom/Element.h" | #include "mozilla/dom/Element.h" | ||||||
|  | @ -472,7 +472,7 @@ void nsMenuPopupFrame::TweakMinPrefISize(nscoord& aSize) { | ||||||
|   //
 |   //
 | ||||||
|   // Automatically accommodating for the scrollbar otherwise would be bug
 |   // Automatically accommodating for the scrollbar otherwise would be bug
 | ||||||
|   // 764076, but that has its own set of problems.
 |   // 764076, but that has its own set of problems.
 | ||||||
|   if (nsIScrollableFrame* sf = GetScrollFrame()) { |   if (ScrollContainerFrame* sf = GetScrollContainerFrame()) { | ||||||
|     aSize += sf->GetDesiredScrollbarSizes().LeftRight(); |     aSize += sf->GetDesiredScrollbarSizes().LeftRight(); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | @ -1170,7 +1170,7 @@ nsPoint nsMenuPopupFrame::AdjustPositionForAnchorAlign( | ||||||
|         // popup up in a way that our box would no longer intersect with the
 |         // popup up in a way that our box would no longer intersect with the
 | ||||||
|         // anchor.
 |         // anchor.
 | ||||||
|         nscoord maxOffset = aPrefSize.height - itemHeight; |         nscoord maxOffset = aPrefSize.height - itemHeight; | ||||||
|         if (const nsIScrollableFrame* sf = GetScrollFrame()) { |         if (const ScrollContainerFrame* sf = GetScrollContainerFrame()) { | ||||||
|           // HACK: We ideally would want to use the offset from the bottom
 |           // HACK: We ideally would want to use the offset from the bottom
 | ||||||
|           // bottom of our scroll-frame to the bottom of our frame (so as to
 |           // bottom of our scroll-frame to the bottom of our frame (so as to
 | ||||||
|           // ensure that the bottom of the scrollport is inside the anchor
 |           // ensure that the bottom of the scrollport is inside the anchor
 | ||||||
|  | @ -1183,8 +1183,7 @@ nsPoint nsMenuPopupFrame::AdjustPositionForAnchorAlign( | ||||||
|           // from the top. This holds for all the popups where this matters
 |           // from the top. This holds for all the popups where this matters
 | ||||||
|           // (menulists on macOS, effectively), and seems better than somehow
 |           // (menulists on macOS, effectively), and seems better than somehow
 | ||||||
|           // moving the popup after the fact as we used to do.
 |           // moving the popup after the fact as we used to do.
 | ||||||
|           const nsIFrame* f = do_QueryFrame(sf); |           maxOffset -= sf->GetOffsetTo(this).y; | ||||||
|           maxOffset -= f->GetOffsetTo(this).y; |  | ||||||
|         } |         } | ||||||
|         mPositionedOffset = |         mPositionedOffset = | ||||||
|             originalAnchorRect.height + std::min(itemOffset, maxOffset); |             originalAnchorRect.height + std::min(itemOffset, maxOffset); | ||||||
|  | @ -1905,12 +1904,12 @@ ConsumeOutsideClicksResult nsMenuPopupFrame::ConsumeOutsideClicks() { | ||||||
|   return ConsumeOutsideClicks_True; |   return ConsumeOutsideClicks_True; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static nsIScrollableFrame* DoGetScrollFrame(const nsIFrame* aFrame) { | static ScrollContainerFrame* DoGetScrollContainerFrame(const nsIFrame* aFrame) { | ||||||
|   if (const nsIScrollableFrame* sf = do_QueryFrame(aFrame)) { |   if (const ScrollContainerFrame* sf = do_QueryFrame(aFrame)) { | ||||||
|     return const_cast<nsIScrollableFrame*>(sf); |     return const_cast<ScrollContainerFrame*>(sf); | ||||||
|   } |   } | ||||||
|   for (nsIFrame* childFrame : aFrame->PrincipalChildList()) { |   for (nsIFrame* childFrame : aFrame->PrincipalChildList()) { | ||||||
|     if (auto* sf = DoGetScrollFrame(childFrame)) { |     if (auto* sf = DoGetScrollContainerFrame(childFrame)) { | ||||||
|       return sf; |       return sf; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|  | @ -1919,8 +1918,8 @@ static nsIScrollableFrame* DoGetScrollFrame(const nsIFrame* aFrame) { | ||||||
| 
 | 
 | ||||||
| // XXXroc this is megalame. Fossicking around for a frame of the right
 | // XXXroc this is megalame. Fossicking around for a frame of the right
 | ||||||
| // type is a recipe for disaster in the long term.
 | // type is a recipe for disaster in the long term.
 | ||||||
| nsIScrollableFrame* nsMenuPopupFrame::GetScrollFrame() const { | ScrollContainerFrame* nsMenuPopupFrame::GetScrollContainerFrame() const { | ||||||
|   return DoGetScrollFrame(this); |   return DoGetScrollContainerFrame(this); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void nsMenuPopupFrame::ChangeByPage(bool aIsUp) { | void nsMenuPopupFrame::ChangeByPage(bool aIsUp) { | ||||||
|  | @ -1929,7 +1928,7 @@ void nsMenuPopupFrame::ChangeByPage(bool aIsUp) { | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   nsIScrollableFrame* scrollframe = GetScrollFrame(); |   ScrollContainerFrame* scrollContainerFrame = GetScrollContainerFrame(); | ||||||
| 
 | 
 | ||||||
|   RefPtr popup = &PopupElement(); |   RefPtr popup = &PopupElement(); | ||||||
|   XULButtonElement* currentMenu = popup->GetActiveMenuChild(); |   XULButtonElement* currentMenu = popup->GetActiveMenuChild(); | ||||||
|  | @ -1947,7 +1946,8 @@ void nsMenuPopupFrame::ChangeByPage(bool aIsUp) { | ||||||
| 
 | 
 | ||||||
|   if (currentMenu && currentMenu->GetPrimaryFrame()) { |   if (currentMenu && currentMenu->GetPrimaryFrame()) { | ||||||
|     const nscoord scrollHeight = |     const nscoord scrollHeight = | ||||||
|         scrollframe ? scrollframe->GetScrollPortRect().height : mRect.height; |         scrollContainerFrame ? scrollContainerFrame->GetScrollPortRect().height | ||||||
|  |                              : mRect.height; | ||||||
|     const nsRect currentRect = currentMenu->GetPrimaryFrame()->GetRect(); |     const nsRect currentRect = currentMenu->GetPrimaryFrame()->GetRect(); | ||||||
|     const XULButtonElement* startMenu = currentMenu; |     const XULButtonElement* startMenu = currentMenu; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -24,7 +24,6 @@ | ||||||
| 
 | 
 | ||||||
| #include "Units.h" | #include "Units.h" | ||||||
| 
 | 
 | ||||||
| class nsIScrollableFrame; |  | ||||||
| class nsIWidget; | class nsIWidget; | ||||||
| 
 | 
 | ||||||
| namespace mozilla { | namespace mozilla { | ||||||
|  | @ -339,7 +338,7 @@ class nsMenuPopupFrame final : public nsBlockFrame { | ||||||
|   void MoveToAnchor(nsIContent* aAnchorContent, const nsAString& aPosition, |   void MoveToAnchor(nsIContent* aAnchorContent, const nsAString& aPosition, | ||||||
|                     int32_t aXPos, int32_t aYPos, bool aAttributesOverride); |                     int32_t aXPos, int32_t aYPos, bool aAttributesOverride); | ||||||
| 
 | 
 | ||||||
|   nsIScrollableFrame* GetScrollFrame() const; |   mozilla::ScrollContainerFrame* GetScrollContainerFrame() const; | ||||||
| 
 | 
 | ||||||
|   void SetOverrideConstraintRect(const mozilla::CSSIntRect& aRect) { |   void SetOverrideConstraintRect(const mozilla::CSSIntRect& aRect) { | ||||||
|     mOverrideConstraintRect = mozilla::CSSIntRect::ToAppUnits(aRect); |     mOverrideConstraintRect = mozilla::CSSIntRect::ToAppUnits(aRect); | ||||||
|  |  | ||||||
|  | @ -166,13 +166,13 @@ nsresult nsScrollbarFrame::AttributeChanged(int32_t aNameSpaceID, | ||||||
|     return rv; |     return rv; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   nsIScrollableFrame* scrollable = do_QueryFrame(GetParent()); |   ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(GetParent()); | ||||||
|   if (!scrollable) { |   if (!scrollContainerFrame) { | ||||||
|     return rv; |     return rv; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   nsCOMPtr<nsIContent> content(mContent); |   nsCOMPtr<nsIContent> content(mContent); | ||||||
|   scrollable->CurPosAttributeChanged(content); |   scrollContainerFrame->CurPosAttributeChanged(content); | ||||||
|   return rv; |   return rv; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -214,11 +214,11 @@ nsIScrollbarMediator* nsScrollbarFrame::GetScrollbarMediator() { | ||||||
|     return nullptr; |     return nullptr; | ||||||
|   } |   } | ||||||
|   nsIFrame* f = mScrollbarMediator->GetPrimaryFrame(); |   nsIFrame* f = mScrollbarMediator->GetPrimaryFrame(); | ||||||
|   nsIScrollableFrame* scrollFrame = do_QueryFrame(f); |   ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(f); | ||||||
|   nsIScrollbarMediator* sbm; |   nsIScrollbarMediator* sbm; | ||||||
| 
 | 
 | ||||||
|   if (scrollFrame) { |   if (scrollContainerFrame) { | ||||||
|     nsIFrame* scrolledFrame = scrollFrame->GetScrolledFrame(); |     nsIFrame* scrolledFrame = scrollContainerFrame->GetScrolledFrame(); | ||||||
|     sbm = do_QueryFrame(scrolledFrame); |     sbm = do_QueryFrame(scrolledFrame); | ||||||
|     if (sbm) { |     if (sbm) { | ||||||
|       return sbm; |       return sbm; | ||||||
|  |  | ||||||
|  | @ -22,7 +22,6 @@ | ||||||
| #include "nsHTMLParts.h" | #include "nsHTMLParts.h" | ||||||
| #include "nsCSSRendering.h" | #include "nsCSSRendering.h" | ||||||
| #include "nsScrollbarButtonFrame.h" | #include "nsScrollbarButtonFrame.h" | ||||||
| #include "nsIScrollableFrame.h" |  | ||||||
| #include "nsIScrollbarMediator.h" | #include "nsIScrollbarMediator.h" | ||||||
| #include "nsISupportsImpl.h" | #include "nsISupportsImpl.h" | ||||||
| #include "nsScrollbarFrame.h" | #include "nsScrollbarFrame.h" | ||||||
|  | @ -38,6 +37,7 @@ | ||||||
| #include "mozilla/MouseEvents.h" | #include "mozilla/MouseEvents.h" | ||||||
| #include "mozilla/Preferences.h" | #include "mozilla/Preferences.h" | ||||||
| #include "mozilla/PresShell.h" | #include "mozilla/PresShell.h" | ||||||
|  | #include "mozilla/ScrollContainerFrame.h" | ||||||
| #include "mozilla/StaticPrefs_general.h" | #include "mozilla/StaticPrefs_general.h" | ||||||
| #include "mozilla/StaticPrefs_layout.h" | #include "mozilla/StaticPrefs_layout.h" | ||||||
| #include "mozilla/SVGIntegrationUtils.h" | #include "mozilla/SVGIntegrationUtils.h" | ||||||
|  | @ -388,9 +388,9 @@ void nsSliderFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, | ||||||
|   // XXX seems like this should be done in nsScrollbarFrame instead perhaps?
 |   // XXX seems like this should be done in nsScrollbarFrame instead perhaps?
 | ||||||
|   if (!aBuilder->IsForEventDelivery()) { |   if (!aBuilder->IsForEventDelivery()) { | ||||||
|     nsScrollbarFrame* scrollbar = Scrollbar(); |     nsScrollbarFrame* scrollbar = Scrollbar(); | ||||||
|     if (nsIScrollableFrame* scrollFrame = |     if (ScrollContainerFrame* scrollContainerFrame = | ||||||
|             do_QueryFrame(scrollbar->GetParent())) { |             do_QueryFrame(scrollbar->GetParent())) { | ||||||
|       if (scrollFrame->IsRootScrollFrameOfDocument()) { |       if (scrollContainerFrame->IsRootScrollFrameOfDocument()) { | ||||||
|         nsGlobalWindowInner* window = nsGlobalWindowInner::Cast( |         nsGlobalWindowInner* window = nsGlobalWindowInner::Cast( | ||||||
|             PresContext()->Document()->GetInnerWindow()); |             PresContext()->Document()->GetInnerWindow()); | ||||||
|         if (window && |         if (window && | ||||||
|  | @ -408,10 +408,10 @@ static bool UsesCustomScrollbarMediator(nsIFrame* scrollbarBox) { | ||||||
|   if (nsScrollbarFrame* scrollbarFrame = do_QueryFrame(scrollbarBox)) { |   if (nsScrollbarFrame* scrollbarFrame = do_QueryFrame(scrollbarBox)) { | ||||||
|     if (nsIScrollbarMediator* mediator = |     if (nsIScrollbarMediator* mediator = | ||||||
|             scrollbarFrame->GetScrollbarMediator()) { |             scrollbarFrame->GetScrollbarMediator()) { | ||||||
|       nsIScrollableFrame* scrollFrame = do_QueryFrame(mediator); |       ScrollContainerFrame* scrollContainerFrame = do_QueryFrame(mediator); | ||||||
|       // The scrollbar mediator is not the scroll frame.
 |       // The scrollbar mediator is not the scroll container frame.
 | ||||||
|       // That means this scroll frame has a custom scrollbar mediator.
 |       // That means this scroll container frame has a custom scrollbar mediator.
 | ||||||
|       if (!scrollFrame) { |       if (!scrollContainerFrame) { | ||||||
|         return true; |         return true; | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|  | @ -456,9 +456,9 @@ void nsSliderFrame::BuildDisplayListForThumb(nsDisplayListBuilder* aBuilder, | ||||||
|     bool isAsyncDraggable = !UsesCustomScrollbarMediator(scrollbarBox); |     bool isAsyncDraggable = !UsesCustomScrollbarMediator(scrollbarBox); | ||||||
| 
 | 
 | ||||||
|     nsPoint scrollPortOrigin; |     nsPoint scrollPortOrigin; | ||||||
|     if (nsIScrollableFrame* scrollFrame = |     if (ScrollContainerFrame* scrollContainerFrame = | ||||||
|             do_QueryFrame(scrollbarBox->GetParent())) { |             do_QueryFrame(scrollbarBox->GetParent())) { | ||||||
|       scrollPortOrigin = scrollFrame->GetScrollPortRect().TopLeft(); |       scrollPortOrigin = scrollContainerFrame->GetScrollPortRect().TopLeft(); | ||||||
|     } else { |     } else { | ||||||
|       isAsyncDraggable = false; |       isAsyncDraggable = false; | ||||||
|     } |     } | ||||||
|  | @ -1057,7 +1057,7 @@ static bool ScrollFrameWillBuildScrollInfoLayer(nsIFrame* aScrollFrame) { | ||||||
|   return false; |   return false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| nsIScrollableFrame* nsSliderFrame::GetScrollFrame() { | ScrollContainerFrame* nsSliderFrame::GetScrollContainerFrame() { | ||||||
|   return do_QueryFrame(Scrollbar()->GetParent()); |   return do_QueryFrame(Scrollbar()->GetParent()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1466,11 +1466,11 @@ void nsSliderFrame::PageScroll(bool aClickAndHold) { | ||||||
|   } |   } | ||||||
|   nsScrollbarFrame* sb = Scrollbar(); |   nsScrollbarFrame* sb = Scrollbar(); | ||||||
| 
 | 
 | ||||||
|   nsIScrollableFrame* sf = GetScrollFrame(); |   ScrollContainerFrame* sf = GetScrollContainerFrame(); | ||||||
|   const ScrollSnapFlags scrollSnapFlags = |   const ScrollSnapFlags scrollSnapFlags = | ||||||
|       ScrollSnapFlags::IntendedDirection | ScrollSnapFlags::IntendedEndPosition; |       ScrollSnapFlags::IntendedDirection | ScrollSnapFlags::IntendedEndPosition; | ||||||
| 
 | 
 | ||||||
|   // If our nsIScrollbarMediator implementation is an nsIScrollableFrame,
 |   // If our nsIScrollbarMediator implementation is a ScrollContainerFrame,
 | ||||||
|   // use ScrollTo() to ensure we do not scroll past the intended
 |   // use ScrollTo() to ensure we do not scroll past the intended
 | ||||||
|   // destination. Otherwise, the combination of smooth scrolling and
 |   // destination. Otherwise, the combination of smooth scrolling and
 | ||||||
|   // ScrollBy() semantics (which adds the delta to the current destination
 |   // ScrollBy() semantics (which adds the delta to the current destination
 | ||||||
|  |  | ||||||
|  | @ -22,6 +22,7 @@ class nsSliderFrame; | ||||||
| namespace mozilla { | namespace mozilla { | ||||||
| class nsDisplaySliderMarks; | class nsDisplaySliderMarks; | ||||||
| class PresShell; | class PresShell; | ||||||
|  | class ScrollContainerFrame; | ||||||
| }  // namespace mozilla
 | }  // namespace mozilla
 | ||||||
| 
 | 
 | ||||||
| nsIFrame* NS_NewSliderFrame(mozilla::PresShell* aPresShell, | nsIFrame* NS_NewSliderFrame(mozilla::PresShell* aPresShell, | ||||||
|  | @ -152,8 +153,9 @@ class nsSliderFrame final : public nsContainerFrame { | ||||||
| 
 | 
 | ||||||
|   bool OnlySystemGroupDispatch(mozilla::EventMessage aMessage) const override; |   bool OnlySystemGroupDispatch(mozilla::EventMessage aMessage) const override; | ||||||
| 
 | 
 | ||||||
|   // Returns the associated scrollframe that contains this slider if any.
 |   // Returns the associated scroll container frame that contains this slider if
 | ||||||
|   nsIScrollableFrame* GetScrollFrame(); |   // any.
 | ||||||
|  |   mozilla::ScrollContainerFrame* GetScrollContainerFrame(); | ||||||
| 
 | 
 | ||||||
|  private: |  private: | ||||||
|   bool GetScrollToClick(); |   bool GetScrollToClick(); | ||||||
|  |  | ||||||
|  | @ -17,6 +17,7 @@ | ||||||
| #include "mozilla/MouseEvents.h" | #include "mozilla/MouseEvents.h" | ||||||
| #include "mozilla/PresShell.h" | #include "mozilla/PresShell.h" | ||||||
| #include "mozilla/ResultExtensions.h" | #include "mozilla/ResultExtensions.h" | ||||||
|  | #include "mozilla/ScrollContainerFrame.h" | ||||||
| #include "mozilla/Try.h" | #include "mozilla/Try.h" | ||||||
| #include "mozilla/intl/Segmenter.h" | #include "mozilla/intl/Segmenter.h" | ||||||
| 
 | 
 | ||||||
|  | @ -57,7 +58,6 @@ | ||||||
| #include "mozilla/dom/NodeInfo.h" | #include "mozilla/dom/NodeInfo.h" | ||||||
| #include "nsContentUtils.h" | #include "nsContentUtils.h" | ||||||
| #include "nsLayoutUtils.h" | #include "nsLayoutUtils.h" | ||||||
| #include "nsIScrollableFrame.h" |  | ||||||
| #include "nsDisplayList.h" | #include "nsDisplayList.h" | ||||||
| #include "mozilla/dom/CustomEvent.h" | #include "mozilla/dom/CustomEvent.h" | ||||||
| #include "mozilla/dom/Event.h" | #include "mozilla/dom/Event.h" | ||||||
|  | @ -710,7 +710,7 @@ nsresult nsTreeBodyFrame::InvalidateRange(int32_t aStart, int32_t aEnd) { | ||||||
| static void FindScrollParts(nsIFrame* aCurrFrame, | static void FindScrollParts(nsIFrame* aCurrFrame, | ||||||
|                             nsTreeBodyFrame::ScrollParts* aResult) { |                             nsTreeBodyFrame::ScrollParts* aResult) { | ||||||
|   if (!aResult->mColumnsScrollFrame) { |   if (!aResult->mColumnsScrollFrame) { | ||||||
|     nsIScrollableFrame* f = do_QueryFrame(aCurrFrame); |     ScrollContainerFrame* f = do_QueryFrame(aCurrFrame); | ||||||
|     if (f) { |     if (f) { | ||||||
|       aResult->mColumnsFrame = aCurrFrame; |       aResult->mColumnsFrame = aCurrFrame; | ||||||
|       aResult->mColumnsScrollFrame = f; |       aResult->mColumnsScrollFrame = f; | ||||||
|  |  | ||||||
|  | @ -32,6 +32,7 @@ class nsTreeImageListener; | ||||||
| 
 | 
 | ||||||
| namespace mozilla { | namespace mozilla { | ||||||
| class PresShell; | class PresShell; | ||||||
|  | class ScrollContainerFrame; | ||||||
| namespace layout { | namespace layout { | ||||||
| class ScrollbarActivity; | class ScrollbarActivity; | ||||||
| }  // namespace layout
 | }  // namespace layout
 | ||||||
|  | @ -179,7 +180,7 @@ class nsTreeBodyFrame final : public mozilla::SimpleXULLeafFrame, | ||||||
|     nsScrollbarFrame* mHScrollbar; |     nsScrollbarFrame* mHScrollbar; | ||||||
|     RefPtr<mozilla::dom::Element> mHScrollbarContent; |     RefPtr<mozilla::dom::Element> mHScrollbarContent; | ||||||
|     nsIFrame* mColumnsFrame; |     nsIFrame* mColumnsFrame; | ||||||
|     nsIScrollableFrame* mColumnsScrollFrame; |     mozilla::ScrollContainerFrame* mColumnsScrollFrame; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   ImgDrawResult PaintTreeBody(gfxContext& aRenderingContext, |   ImgDrawResult PaintTreeBody(gfxContext& aRenderingContext, | ||||||
|  |  | ||||||
|  | @ -53,7 +53,6 @@ | ||||||
| #include "nsIContentInlines.h" | #include "nsIContentInlines.h" | ||||||
| #include "nsIDocShell.h" | #include "nsIDocShell.h" | ||||||
| #include "nsIFormControl.h" | #include "nsIFormControl.h" | ||||||
| #include "nsIScrollableFrame.h" |  | ||||||
| #include "nsISHistory.h" | #include "nsISHistory.h" | ||||||
| #include "nsIXULRuntime.h" | #include "nsIXULRuntime.h" | ||||||
| #include "nsPresContext.h" | #include "nsPresContext.h" | ||||||
|  |  | ||||||
|  | @ -18,12 +18,12 @@ | ||||||
| #include "mozilla/gfx/Types.h" | #include "mozilla/gfx/Types.h" | ||||||
| #include "mozilla/gfx/Filters.h" | #include "mozilla/gfx/Filters.h" | ||||||
| #include "mozilla/RelativeLuminanceUtils.h" | #include "mozilla/RelativeLuminanceUtils.h" | ||||||
|  | #include "mozilla/ScrollContainerFrame.h" | ||||||
| #include "mozilla/StaticPrefs_widget.h" | #include "mozilla/StaticPrefs_widget.h" | ||||||
| #include "mozilla/webrender/WebRenderAPI.h" | #include "mozilla/webrender/WebRenderAPI.h" | ||||||
| #include "nsCSSColorUtils.h" | #include "nsCSSColorUtils.h" | ||||||
| #include "nsCSSRendering.h" | #include "nsCSSRendering.h" | ||||||
| #include "nsScrollbarFrame.h" | #include "nsScrollbarFrame.h" | ||||||
| #include "nsIScrollableFrame.h" |  | ||||||
| #include "nsIScrollbarMediator.h" | #include "nsIScrollbarMediator.h" | ||||||
| #include "nsDeviceContext.h" | #include "nsDeviceContext.h" | ||||||
| #include "nsLayoutUtils.h" | #include "nsLayoutUtils.h" | ||||||
|  | @ -1139,7 +1139,7 @@ static ScrollbarDrawing::ScrollbarKind ComputeScrollbarKind( | ||||||
| 
 | 
 | ||||||
| static ScrollbarDrawing::ScrollbarKind ComputeScrollbarKindForScrollCorner( | static ScrollbarDrawing::ScrollbarKind ComputeScrollbarKindForScrollCorner( | ||||||
|     nsIFrame* aFrame) { |     nsIFrame* aFrame) { | ||||||
|   nsIScrollableFrame* sf = do_QueryFrame(aFrame->GetParent()); |   ScrollContainerFrame* sf = do_QueryFrame(aFrame->GetParent()); | ||||||
|   if (!sf) { |   if (!sf) { | ||||||
|     return ScrollbarDrawing::ScrollbarKind::VerticalRight; |     return ScrollbarDrawing::ScrollbarKind::VerticalRight; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  | @ -29,7 +29,6 @@ | ||||||
| #include "nsCocoaFeatures.h" | #include "nsCocoaFeatures.h" | ||||||
| #include "nsCocoaWindow.h" | #include "nsCocoaWindow.h" | ||||||
| #include "nsNativeThemeColors.h" | #include "nsNativeThemeColors.h" | ||||||
| #include "nsIScrollableFrame.h" |  | ||||||
| #include "mozilla/ClearOnShutdown.h" | #include "mozilla/ClearOnShutdown.h" | ||||||
| #include "mozilla/Range.h" | #include "mozilla/Range.h" | ||||||
| #include "mozilla/dom/Element.h" | #include "mozilla/dom/Element.h" | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Ting-Yu Lin
						Ting-Yu Lin