summaryrefslogtreecommitdiffstats
path: root/layout/generic/nsGfxScrollFrame.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'layout/generic/nsGfxScrollFrame.cpp')
-rw-r--r--layout/generic/nsGfxScrollFrame.cpp62
1 files changed, 31 insertions, 31 deletions
diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp
index 361847b753..97e6b614dc 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:
@@ -964,7 +964,7 @@ void nsHTMLScrollFrame::ReflowScrolledFrame(ScrollReflowInput& aState,
nsRect childScrollableOverflow = childOverflow.ScrollableOverflow();
const LogicalMargin inlinePadding =
- padding.ApplySkipSides(LogicalSides(wm, eLogicalSideBitsBBoth));
+ padding.ApplySkipSides(LogicalSides(wm, LogicalSides::BBoth));
childScrollableOverflow.Inflate(inlinePadding.GetPhysicalMargin(wm));
nsRect& so = aMetrics->ScrollableOverflow();
@@ -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();
@@ -5224,15 +5211,19 @@ nsSize nsHTMLScrollFrame::GetPageScrollAmount() const {
}
nsSize lineScrollAmount = GetLineScrollAmount();
+ const int32_t maxOverlapPercent = std::clamp(
+ StaticPrefs::toolkit_scrollbox_pagescroll_maxOverlapPercent(), 0, 80);
+ const int32_t maxOverlapLines =
+ std::max(StaticPrefs::toolkit_scrollbox_pagescroll_maxOverlapLines(), 0);
- // The page increment is the size of the page, minus the smaller of
- // 10% of the size or 2 lines.
- return nsSize(effectiveScrollPortSize.width -
- std::min(effectiveScrollPortSize.width / 10,
- 2 * lineScrollAmount.width),
- effectiveScrollPortSize.height -
- std::min(effectiveScrollPortSize.height / 10,
- 2 * lineScrollAmount.height));
+ // The page increment is the size of the page, minus some overlap.
+ return nsSize(
+ effectiveScrollPortSize.width -
+ std::min(effectiveScrollPortSize.width * maxOverlapPercent / 100,
+ maxOverlapLines * lineScrollAmount.width),
+ effectiveScrollPortSize.height -
+ std::min(effectiveScrollPortSize.height * maxOverlapPercent / 100,
+ maxOverlapLines * lineScrollAmount.height));
}
/**
@@ -5429,23 +5420,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 +5894,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