зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1373835
- Enable scroll snap for Element.scrollIntoView. r=botond
Depends on D21625 Differential Revision: https://phabricator.services.mozilla.com/D21626 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
66dd57767b
Коммит
a7fb73dd6e
|
@ -778,6 +778,9 @@ void Element::ScrollIntoView(const ScrollIntoViewOptions& aOptions) {
|
|||
} else if (aOptions.mBehavior == ScrollBehavior::Auto) {
|
||||
flags |= nsIPresShell::SCROLL_SMOOTH_AUTO;
|
||||
}
|
||||
if (StaticPrefs::layout_css_scroll_snap_v1_enabled()) {
|
||||
flags |= nsIPresShell::SCROLL_SNAP;
|
||||
}
|
||||
|
||||
presShell->ScrollContentIntoView(
|
||||
this, nsIPresShell::ScrollAxis(vpercent, nsIPresShell::SCROLL_ALWAYS),
|
||||
|
|
|
@ -3374,7 +3374,10 @@ static void ScrollToShowRect(nsIScrollableFrame* aFrameAsScrollable,
|
|||
if (gfxPrefs::ScrollBehaviorEnabled() && smoothScroll) {
|
||||
scrollMode = ScrollMode::eSmoothMsd;
|
||||
}
|
||||
aFrameAsScrollable->ScrollTo(scrollPt, scrollMode, &allowedRange);
|
||||
aFrameAsScrollable->ScrollTo(scrollPt, scrollMode, &allowedRange,
|
||||
aFlags & nsIPresShell::SCROLL_SNAP
|
||||
? nsIScrollbarMediator::ENABLE_SNAP
|
||||
: nsIScrollbarMediator::DISABLE_SNAP);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -778,7 +778,8 @@ class nsIPresShell : public nsStubDocumentObserver {
|
|||
SCROLL_OVERFLOW_HIDDEN = 0x02,
|
||||
SCROLL_NO_PARENT_FRAMES = 0x04,
|
||||
SCROLL_SMOOTH = 0x08,
|
||||
SCROLL_SMOOTH_AUTO = 0x10
|
||||
SCROLL_SMOOTH_AUTO = 0x10,
|
||||
SCROLL_SNAP = 0x20
|
||||
};
|
||||
/**
|
||||
* Scrolls the view of the document so that the given area of a frame
|
||||
|
|
Загрузка…
Ссылка в новой задаче