Bug 1010538 - Part 7 - Add support to Element.ScrollLeft and Element.ScrollTop. r=mstange

- Setting Element.ScrollLeft or Element.ScrollRight will now scroll smoothly
  if the scroll-behavior CSS property is set to "smooth".
This commit is contained in:
Kearwood (Kip) Gilbert 2014-09-25 15:52:00 +02:00
parent e100f477c7
commit fdc3d37feb

View File

@ -747,8 +747,13 @@ public:
{
nsIScrollableFrame* sf = GetScrollFrame();
if (sf) {
nsIScrollableFrame::ScrollMode scrollMode = nsIScrollableFrame::INSTANT;
if (sf->GetScrollbarStyles().mScrollBehavior == NS_STYLE_SCROLL_BEHAVIOR_SMOOTH) {
scrollMode = nsIScrollableFrame::SMOOTH_MSD;
}
sf->ScrollToCSSPixels(CSSIntPoint(sf->GetScrollPositionCSSPixels().x,
aScrollTop));
aScrollTop),
scrollMode);
}
}
int32_t ScrollLeft()
@ -760,8 +765,14 @@ public:
{
nsIScrollableFrame* sf = GetScrollFrame();
if (sf) {
nsIScrollableFrame::ScrollMode scrollMode = nsIScrollableFrame::INSTANT;
if (sf->GetScrollbarStyles().mScrollBehavior == NS_STYLE_SCROLL_BEHAVIOR_SMOOTH) {
scrollMode = nsIScrollableFrame::SMOOTH_MSD;
}
sf->ScrollToCSSPixels(CSSIntPoint(aScrollLeft,
sf->GetScrollPositionCSSPixels().y));
sf->GetScrollPositionCSSPixels().y),
scrollMode);
}
}
/* Scrolls without flushing the layout.