chromium/third_party/blink/renderer/core/scroll/scrollable_area.cc

/*
 * Copyright (c) 2010, Google Inc. All rights reserved.
 * Copyright (C) 2008, 2011 Apple Inc. All Rights Reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 *     * Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above
 * copyright notice, this list of conditions and the following disclaimer
 * in the documentation and/or other materials provided with the
 * distribution.
 *     * Neither the name of Google Inc. nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "third_party/blink/renderer/core/scroll/scrollable_area.h"

#include "base/task/single_thread_task_runner.h"
#include "build/build_config.h"
#include "cc/input/main_thread_scrolling_reason.h"
#include "cc/input/scroll_snap_data.h"
#include "cc/input/scroll_utils.h"
#include "cc/input/scrollbar.h"
#include "cc/input/snap_selection_strategy.h"
#include "third_party/blink/public/mojom/scroll/scroll_into_view_params.mojom-blink-forward.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/core/animation/scroll_timeline.h"
#include "third_party/blink/renderer/core/css/properties/longhands.h"
#include "third_party/blink/renderer/core/editing/frame_selection.h"
#include "third_party/blink/renderer/core/event_type_names.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/frame/visual_viewport.h"
#include "third_party/blink/renderer/core/input/event_handler.h"
#include "third_party/blink/renderer/core/layout/layout_box.h"
#include "third_party/blink/renderer/core/layout/layout_object.h"
#include "third_party/blink/renderer/core/layout/layout_shift_tracker.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/layout/physical_box_fragment.h"
#include "third_party/blink/renderer/core/loader/anchor_element_interaction_tracker.h"
#include "third_party/blink/renderer/core/page/chrome_client.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h"
#include "third_party/blink/renderer/core/paint/timing/paint_timing_detector.h"
#include "third_party/blink/renderer/core/scroll/mac_scrollbar_animator.h"
#include "third_party/blink/renderer/core/scroll/programmatic_scroll_animator.h"
#include "third_party/blink/renderer/core/scroll/scroll_alignment.h"
#include "third_party/blink/renderer/core/scroll/scroll_animator_base.h"
#include "third_party/blink/renderer/core/scroll/scroll_into_view_util.h"
#include "third_party/blink/renderer/core/scroll/scroll_start_targets.h"
#include "third_party/blink/renderer/core/scroll/scroll_types.h"
#include "third_party/blink/renderer/core/scroll/scrollbar_theme.h"
#include "third_party/blink/renderer/core/scroll/smooth_scroll_sequencer.h"
#include "third_party/blink/renderer/platform/geometry/layout_unit.h"
#include "third_party/blink/renderer/platform/graphics/color.h"
#include "third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.h"
#include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread_scheduler.h"
#include "third_party/blink/renderer/platform/timer.h"
#include "ui/gfx/geometry/vector2d_conversions.h"

namespace blink {

int ScrollableArea::PixelsPerLineStep(LocalFrame* frame) {}

float ScrollableArea::MinFractionToStepWhenPaging() {}

int ScrollableArea::MaxOverlapBetweenPages() const {}

// static
float ScrollableArea::DirectionBasedScrollDelta(
    ui::ScrollGranularity granularity) {}

// static
mojom::blink::ScrollBehavior ScrollableArea::DetermineScrollBehavior(
    mojom::blink::ScrollBehavior behavior_from_param,
    mojom::blink::ScrollBehavior behavior_from_style) {}

ScrollableArea::ScrollableArea(
    scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner)
    :{}

ScrollableArea::~ScrollableArea() = default;

void ScrollableArea::Dispose() {}

void ScrollableArea::ClearScrollableArea() {}

MacScrollbarAnimator* ScrollableArea::GetMacScrollbarAnimator() const {}

ScrollAnimatorBase& ScrollableArea::GetScrollAnimator() const {}

ProgrammaticScrollAnimator& ScrollableArea::GetProgrammaticScrollAnimator()
    const {}

ScrollbarOrientation ScrollableArea::ScrollbarOrientationFromDirection(
    ScrollDirectionPhysical direction) const {}

float ScrollableArea::ScrollStep(ui::ScrollGranularity granularity,
                                 ScrollbarOrientation orientation) const {}

ScrollOffset ScrollableArea::ResolveScrollDelta(
    ui::ScrollGranularity granularity,
    const ScrollOffset& delta) {}

ScrollResult ScrollableArea::UserScroll(ui::ScrollGranularity granularity,
                                        const ScrollOffset& delta,
                                        ScrollCallback on_finish) {}

ScrollOffset ScrollableArea::PendingScrollAnchorAdjustment() const {}

void ScrollableArea::ClearPendingScrollAnchorAdjustment() {}

bool ScrollableArea::SetScrollOffset(const ScrollOffset& offset,
                                     mojom::blink::ScrollType scroll_type,
                                     mojom::blink::ScrollBehavior behavior,
                                     ScrollCallback on_finish) {}

bool ScrollableArea::SetScrollOffset(const ScrollOffset& offset,
                                     mojom::blink::ScrollType type,
                                     mojom::blink::ScrollBehavior behavior) {}

float ScrollableArea::ScrollStartValueToOffsetAlongAxis(
    const ScrollStartData& data,
    cc::SnapAxis axis) const {}

ScrollOffset ScrollableArea::ScrollOffsetFromScrollStartData(
    const ScrollStartData& y_value,
    const ScrollStartData& x_value) const {}

bool ScrollableArea::ScrollStartIsDefault() const {}

const ScrollStartTargetCandidates* ScrollableArea::GetScrollStartTargets()
    const {}

void ScrollableArea::ScrollToScrollStartTarget(
    const LayoutBox* scroll_start_target,
    cc::SnapAxis axis) {}

void ScrollableArea::ScrollToScrollStartTargets(
    const ScrollStartTargetCandidates* targets) {}

void ScrollableArea::ApplyScrollStart() {}

void ScrollableArea::ScrollBy(const ScrollOffset& delta,
                              mojom::blink::ScrollType type,
                              mojom::blink::ScrollBehavior behavior) {}

bool ScrollableArea::ProgrammaticScrollHelper(
    const ScrollOffset& offset,
    mojom::blink::ScrollBehavior scroll_behavior,
    bool is_sequenced_scroll,
    gfx::Vector2d animation_adjustment,
    ScrollCallback on_finish) {}

void ScrollableArea::UserScrollHelper(
    const ScrollOffset& offset,
    mojom::blink::ScrollBehavior scroll_behavior) {}

PhysicalRect ScrollableArea::ScrollIntoView(
    const PhysicalRect& rect_in_absolute,
    const PhysicalBoxStrut& scroll_margin,
    const mojom::blink::ScrollIntoViewParamsPtr& params) {}

void ScrollableArea::ScrollOffsetChanged(const ScrollOffset& offset,
                                         mojom::blink::ScrollType scroll_type) {}

bool ScrollableArea::ScrollBehaviorFromString(
    const String& behavior_string,
    mojom::blink::ScrollBehavior& behavior) {}

void ScrollableArea::RegisterScrollCompleteCallback(ScrollCallback callback) {}

void ScrollableArea::RunScrollCompleteCallbacks(ScrollCompletionMode mode) {}

void ScrollableArea::ContentAreaWillPaint() const {}

void ScrollableArea::MouseEnteredContentArea() const {}

void ScrollableArea::MouseExitedContentArea() const {}

void ScrollableArea::MouseMovedInContentArea() const {}

void ScrollableArea::MouseEnteredScrollbar(Scrollbar& scrollbar) {}

void ScrollableArea::MouseExitedScrollbar(Scrollbar& scrollbar) {}

void ScrollableArea::MouseCapturedScrollbar() {}

void ScrollableArea::MouseReleasedScrollbar() {}

void ScrollableArea::DidAddScrollbar(Scrollbar& scrollbar,
                                     ScrollbarOrientation orientation) {}

void ScrollableArea::WillRemoveScrollbar(Scrollbar& scrollbar,
                                         ScrollbarOrientation orientation) {}

void ScrollableArea::ContentsResized() {}

bool ScrollableArea::HasOverlayScrollbars() const {}

void ScrollableArea::SetOverlayScrollbarColorScheme(
    mojom::blink::ColorScheme overlay_theme) {}

void ScrollableArea::RecalculateOverlayScrollbarColorScheme() {}

void ScrollableArea::SetScrollbarNeedsPaintInvalidation(
    ScrollbarOrientation orientation) {}

void ScrollableArea::SetScrollCornerNeedsPaintInvalidation() {}

void ScrollableArea::SetScrollControlsNeedFullPaintInvalidation() {}

bool ScrollableArea::HasLayerForHorizontalScrollbar() const {}

bool ScrollableArea::HasLayerForVerticalScrollbar() const {}

bool ScrollableArea::HasLayerForScrollCorner() const {}

void ScrollableArea::ServiceScrollAnimations(double monotonic_time) {}

void ScrollableArea::UpdateCompositorScrollAnimations() {}

void ScrollableArea::CancelScrollAnimation() {}

void ScrollableArea::CancelProgrammaticScrollAnimation() {}

bool ScrollableArea::ScrollbarsHiddenIfOverlay() const {}

void ScrollableArea::SetScrollbarsHiddenForTesting(bool hidden) {}

void ScrollableArea::SetScrollbarsHiddenFromExternalAnimator(bool hidden) {}

void ScrollableArea::SetScrollbarsHiddenIfOverlay(bool hidden) {}

void ScrollableArea::SetScrollbarsHiddenIfOverlayInternal(bool hidden) {}

void ScrollableArea::FadeOverlayScrollbarsTimerFired(TimerBase*) {}

void ScrollableArea::ShowNonMacOverlayScrollbars() {}

scoped_refptr<base::SingleThreadTaskRunner>
ScrollableArea::GetCompositorTaskRunner() {}

Node* ScrollableArea::EventTargetNode() const {}

const Document* ScrollableArea::GetDocument() const {}

gfx::Vector2d ScrollableArea::ClampScrollOffset(
    const gfx::Vector2d& scroll_offset) const {}

ScrollOffset ScrollableArea::ClampScrollOffset(
    const ScrollOffset& scroll_offset) const {}

int ScrollableArea::LineStep(ScrollbarOrientation) const {}

int ScrollableArea::PageStep(ScrollbarOrientation orientation) const {}

int ScrollableArea::DocumentStep(ScrollbarOrientation orientation) const {}

float ScrollableArea::PixelStep(ScrollbarOrientation) const {}

float ScrollableArea::PercentageStep(ScrollbarOrientation orientation) const {}

int ScrollableArea::VerticalScrollbarWidth(
    OverlayScrollbarClipBehavior behavior) const {}

int ScrollableArea::HorizontalScrollbarHeight(
    OverlayScrollbarClipBehavior behavior) const {}

gfx::QuadF ScrollableArea::LocalToVisibleContentQuad(const gfx::QuadF& quad,
                                                     const LayoutObject*,
                                                     unsigned) const {}

gfx::Size ScrollableArea::ExcludeScrollbars(const gfx::Size& size) const {}

void ScrollableArea::DidCompositorScroll(const gfx::PointF& position) {}

Scrollbar* ScrollableArea::GetScrollbar(
    ScrollbarOrientation orientation) const {}

CompositorElementId ScrollableArea::GetScrollbarElementId(
    ScrollbarOrientation orientation) {}

void ScrollableArea::OnScrollFinished(bool scroll_did_end) {}

void ScrollableArea::SnapAfterScrollbarScrolling(
    ScrollbarOrientation orientation) {}

bool ScrollableArea::SnapAtCurrentPosition(
    bool scrolled_x,
    bool scrolled_y,
    base::ScopedClosureRunner on_finish) {}

bool ScrollableArea::SnapForEndPosition(const gfx::PointF& end_position,
                                        bool scrolled_x,
                                        bool scrolled_y,
                                        base::ScopedClosureRunner on_finish) {}

bool ScrollableArea::SnapForDirection(const ScrollOffset& delta,
                                      base::ScopedClosureRunner on_finish) {}

bool ScrollableArea::SnapForEndAndDirection(const ScrollOffset& delta) {}

void ScrollableArea::SnapAfterLayout() {}

bool ScrollableArea::PerformSnapping(
    const cc::SnapSelectionStrategy& strategy,
    mojom::blink::ScrollBehavior scroll_behavior,
    base::ScopedClosureRunner on_finish) {}

void ScrollableArea::Trace(Visitor* visitor) const {}

void ScrollableArea::InjectScrollbarGestureScroll(
    ScrollOffset delta,
    ui::ScrollGranularity granularity,
    WebInputEvent::Type gesture_type) const {}

ScrollableArea* ScrollableArea::GetForScrolling(const LayoutBox* layout_box) {}

float ScrollableArea::ScaleFromDIP() const {}

bool ScrollableArea::ScrollOffsetIsNoop(const ScrollOffset& offset) const {}

void ScrollableArea::EnqueueScrollSnapChangeEvent() const {}

void ScrollableArea::EnqueueScrollSnapChangingEvent() const {}

ScrollOffset ScrollableArea::GetWebExposedScrollOffset() const {}

}  // namespace blink