diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
commit | da4c7e7ed675c3bf405668739c3012d140856109 (patch) | |
tree | cdd868dba063fecba609a1d819de271f0d51b23e /layout/generic/nsGfxScrollFrame.cpp | |
parent | Adding upstream version 125.0.3. (diff) | |
download | firefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip |
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/generic/nsGfxScrollFrame.cpp')
-rw-r--r-- | layout/generic/nsGfxScrollFrame.cpp | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 361847b753..2b0c53efe1 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -170,7 +170,7 @@ class nsHTMLScrollFrame::ScrollEvent : public Runnable { class nsHTMLScrollFrame::ScrollEndEvent : public Runnable { public: NS_DECL_NSIRUNNABLE - explicit ScrollEndEvent(nsHTMLScrollFrame* aHelper); + explicit ScrollEndEvent(nsHTMLScrollFrame* aHelper, bool aDelayed); void Revoke() { mHelper = nullptr; } private: @@ -1265,17 +1265,7 @@ nsMargin nsHTMLScrollFrame::ComputeStableScrollbarGutter( // Legacy, this sucks! static bool IsMarqueeScrollbox(const nsIFrame& aScrollFrame) { - if (!aScrollFrame.GetContent()) { - return false; - } - if (MOZ_LIKELY(!aScrollFrame.GetContent()->HasBeenInUAWidget())) { - return false; - } - MOZ_ASSERT(aScrollFrame.GetParent() && - aScrollFrame.GetParent()->GetContent()); - return aScrollFrame.GetParent() && - HTMLMarqueeElement::FromNodeOrNull( - aScrollFrame.GetParent()->GetContent()); + return HTMLMarqueeElement::FromNodeOrNull(aScrollFrame.GetContent()); } /* virtual */ @@ -1290,7 +1280,6 @@ nscoord nsHTMLScrollFrame::GetMinISize(gfxContext* aRenderingContext) { return mScrolledFrame->GetMinISize(aRenderingContext); }(); - DISPLAY_MIN_INLINE_SIZE(this, result); return result + IntrinsicScrollbarGutterSizeAtInlineEdges(); } @@ -1300,7 +1289,6 @@ nscoord nsHTMLScrollFrame::GetPrefISize(gfxContext* aRenderingContext) { nscoord result = containISize ? *containISize : mScrolledFrame->GetPrefISize(aRenderingContext); - DISPLAY_PREF_INLINE_SIZE(this, result); return NSCoordSaturatingAdd(result, IntrinsicScrollbarGutterSizeAtInlineEdges()); } @@ -1497,7 +1485,6 @@ void nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext, nsReflowStatus& aStatus) { MarkInReflow(); DO_GLOBAL_REFLOW_COUNT("nsHTMLScrollFrame"); - DISPLAY_REFLOW(aPresContext, this, aReflowInput, aDesiredSize, aStatus); MOZ_ASSERT(aStatus.IsEmpty(), "Caller should pass a fresh reflow status!"); HandleScrollbarStyleSwitching(); @@ -5429,23 +5416,31 @@ nsresult nsHTMLScrollFrame::FireScrollPortEvent() { return EventDispatcher::Dispatch(content, presContext, &event); } -void nsHTMLScrollFrame::PostScrollEndEvent() { +void nsHTMLScrollFrame::PostScrollEndEvent(bool aDelayed) { if (mScrollEndEvent) { return; } // The ScrollEndEvent constructor registers itself with the refresh driver. - mScrollEndEvent = new ScrollEndEvent(this); + mScrollEndEvent = new ScrollEndEvent(this, aDelayed); } void nsHTMLScrollFrame::FireScrollEndEvent() { - MOZ_ASSERT(GetContent()); - MOZ_ASSERT(mScrollEndEvent); + RefPtr<nsIContent> content = GetContent(); + MOZ_ASSERT(content); - RefPtr<nsPresContext> presContext = PresContext(); + MOZ_ASSERT(mScrollEndEvent); mScrollEndEvent->Revoke(); mScrollEndEvent = nullptr; + if (content->GetComposedDoc() && + content->GetComposedDoc()->EventHandlingSuppressed()) { + content->GetComposedDoc()->SetHasDelayedRefreshEvent(); + PostScrollEndEvent(/* aDelayed = */ true); + return; + } + + RefPtr<nsPresContext> presContext = PresContext(); nsEventStatus status = nsEventStatus_eIgnore; WidgetGUIEvent event(true, eScrollend, nullptr); event.mFlags.mBubbles = mIsRoot; @@ -5895,9 +5890,10 @@ nsHTMLScrollFrame::ScrollEvent::Run() { return NS_OK; } -nsHTMLScrollFrame::ScrollEndEvent::ScrollEndEvent(nsHTMLScrollFrame* aHelper) +nsHTMLScrollFrame::ScrollEndEvent::ScrollEndEvent(nsHTMLScrollFrame* aHelper, + bool aDelayed) : Runnable("nsHTMLScrollFrame::ScrollEndEvent"), mHelper(aHelper) { - mHelper->PresContext()->RefreshDriver()->PostScrollEvent(this); + mHelper->PresContext()->RefreshDriver()->PostScrollEvent(this, aDelayed); } MOZ_CAN_RUN_SCRIPT_BOUNDARY NS_IMETHODIMP |