Commit 55fecc32 authored by Donn Denman's avatar Donn Denman Committed by Commit Bot

[Visual Viewport] Fix a new null dereference.

Fixes a null-dereference regression from a recent CL that added
support for scrolling to a position:fixed element when there
a scrollable visual viewport.

Also implements GetSmoothScrollSequencer by getting it from the
main frame if possible.

BUG=992683

Change-Id: I75cbb7e25e1a8289e1405f01d2d9ddfafb785361
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1749549
Commit-Queue: David Bokan <bokan@chromium.org>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Auto-Submit: Donn Denman <donnd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686414}
parent 10ef65eb
......@@ -800,6 +800,12 @@ ChromeClient* VisualViewport::GetChromeClient() const {
return &GetPage().GetChromeClient();
}
SmoothScrollSequencer* VisualViewport::GetSmoothScrollSequencer() const {
if (!MainFrame())
return nullptr;
return &MainFrame()->GetSmoothScrollSequencer();
}
void VisualViewport::SetScrollOffset(const ScrollOffset& offset,
ScrollType scroll_type,
ScrollBehavior scroll_behavior,
......@@ -832,8 +838,9 @@ PhysicalRect VisualViewport::ScrollIntoView(
if (params.is_for_scroll_sequence) {
DCHECK(params.GetScrollType() == kProgrammaticScroll ||
params.GetScrollType() == kUserScroll);
GetSmoothScrollSequencer()->QueueAnimation(this, new_scroll_offset,
behavior);
if (SmoothScrollSequencer* sequencer = GetSmoothScrollSequencer()) {
sequencer->QueueAnimation(this, new_scroll_offset, behavior);
}
} else {
SetScrollOffset(new_scroll_offset, params.GetScrollType(), behavior,
ScrollCallback());
......
......@@ -186,6 +186,7 @@ class CORE_EXPORT VisualViewport final
// ScrollableArea implementation
ChromeClient* GetChromeClient() const override;
SmoothScrollSequencer* GetSmoothScrollSequencer() const override;
void SetScrollOffset(const ScrollOffset&,
ScrollType,
ScrollBehavior,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment