Bug 1701928 - Selection scrolling should not ignore scroll-{margin,padding}. r=hiro,masayuki

Differential Revision: https://phabricator.services.mozilla.com/D110440
This commit is contained in:
Emilio Cobos Álvarez
2021-04-02 12:14:19 +00:00
parent d7b5fd7086
commit 79cfc09871
4 changed files with 54 additions and 13 deletions

View File

@@ -3414,10 +3414,7 @@ static void ScrollToShowRect(nsIScrollableFrame* aFrameAsScrollable,
const nsRect visibleRect(scrollPt,
aFrameAsScrollable->GetVisualViewportSize());
const nsMargin scrollPadding =
(aScrollFlags & ScrollFlags::IgnoreMarginAndPadding)
? nsMargin()
: aFrameAsScrollable->GetScrollPadding();
const nsMargin scrollPadding = aFrameAsScrollable->GetScrollPadding();
const nsRect rectToScrollIntoView = [&] {
nsRect r(aRect);
@@ -3586,10 +3583,7 @@ void PresShell::DoScrollContentIntoView() {
// Get the scroll-margin here since |frame| is going to be changed to iterate
// over all continuation frames below.
nsMargin scrollMargin;
if (!(data->mContentToScrollToFlags & ScrollFlags::IgnoreMarginAndPadding)) {
scrollMargin = frame->StyleMargin()->GetScrollMargin();
}
const nsMargin scrollMargin = frame->StyleMargin()->GetScrollMargin();
// This is a two-step process.
// Step 1: Find the bounds of the rect we want to scroll into view. For
@@ -8974,8 +8968,7 @@ bool PresShell::EventHandler::PrepareToUseCaretPosition(
->ScrollContentIntoView(
content, ScrollAxis(kScrollMinimum, WhenToScroll::IfNotVisible),
ScrollAxis(kScrollMinimum, WhenToScroll::IfNotVisible),
ScrollFlags::ScrollOverflowHidden |
ScrollFlags::IgnoreMarginAndPadding);
ScrollFlags::ScrollOverflowHidden);
NS_ENSURE_SUCCESS(rv, false);
frame = content->GetPrimaryFrame();
NS_WARNING_ASSERTION(frame, "No frame for focused content?");