Commit 6d74d4c2 authored by Rahul Arakeri's avatar Rahul Arakeri Committed by Commit Bot

Deleted ScrollbarLayerImplBase arg from ScrollbarController methods.

This CL gets rid of the several ScrollbarLayerImplBase references in
the private methods of ScrollbarController. They need not be passed
around because the ScrollbarLayerImplBase can easily be looked up by
calling ScrollbarController::ScrollbarLayer (which retrieves the needed
scrollber layer by using CapturedScrollbarMetadata::scroll_element_id).

Bug: 1077093
Change-Id: I2bb48b4fe61227e6e89c4dff8cef4064a20e3965
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2174809
Commit-Queue: Rahul Arakeri <arakeri@microsoft.com>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#765347}
parent 666c947c
This diff is collapsed.
...@@ -127,16 +127,9 @@ class CC_EXPORT ScrollbarController { ...@@ -127,16 +127,9 @@ class CC_EXPORT ScrollbarController {
InputHandlerPointerResult HandlePointerUp( InputHandlerPointerResult HandlePointerUp(
const gfx::PointF position_in_widget); const gfx::PointF position_in_widget);
// "velocity" here is calculated based on the initial scroll delta (See bool ScrollbarScrollIsActive() const { return scrollbar_scroll_is_active_; }
// InitialDeltaToAutoscrollVelocity). This value carries a "sign" which is
// needed to determine whether we should set up the autoscrolling in the
// forwards or the backwards direction.
void StartAutoScrollAnimation(float velocity,
const ScrollbarLayerImplBase* scrollbar,
ScrollbarPart pressed_scrollbar_part);
bool ScrollbarScrollIsActive() { return scrollbar_scroll_is_active_; }
void DidUnregisterScrollbar(ElementId element_id); void DidUnregisterScrollbar(ElementId element_id);
ScrollbarLayerImplBase* ScrollbarLayer(); ScrollbarLayerImplBase* ScrollbarLayer() const;
void WillBeginImplFrame(); void WillBeginImplFrame();
void ResetState(); void ResetState();
...@@ -187,44 +180,42 @@ class CC_EXPORT ScrollbarController { ...@@ -187,44 +180,42 @@ class CC_EXPORT ScrollbarController {
ScrollbarOrientation orientation; ScrollbarOrientation orientation;
}; };
// "velocity" here is calculated based on the initial scroll delta (See
// InitialDeltaToAutoscrollVelocity). This value carries a "sign" which is
// needed to determine whether we should set up the autoscrolling in the
// forwards or the backwards direction.
void StartAutoScrollAnimation(float velocity,
ScrollbarPart pressed_scrollbar_part);
// Returns the DSF based on whether use-zoom-for-dsf is enabled. // Returns the DSF based on whether use-zoom-for-dsf is enabled.
float ScreenSpaceScaleFactor() const; float ScreenSpaceScaleFactor() const;
// Helper to convert scroll offset to autoscroll velocity. // Helper to convert scroll offset to autoscroll velocity.
float InitialDeltaToAutoscrollVelocity( float InitialDeltaToAutoscrollVelocity(gfx::ScrollOffset scroll_offset) const;
const ScrollbarLayerImplBase* scrollbar,
gfx::ScrollOffset scroll_offset) const;
// Returns the hit tested ScrollbarPart based on the position_in_widget. // Returns the hit tested ScrollbarPart based on the position_in_widget.
ScrollbarPart GetScrollbarPartFromPointerDown( ScrollbarPart GetScrollbarPartFromPointerDown(
const ScrollbarLayerImplBase* scrollbar, const gfx::PointF position_in_widget) const;
const gfx::PointF position_in_widget);
// Returns scroll offsets based on which ScrollbarPart was hit tested. // Returns scroll offsets based on which ScrollbarPart was hit tested.
gfx::ScrollOffset GetScrollOffsetForScrollbarPart( gfx::ScrollOffset GetScrollOffsetForScrollbarPart(
const ScrollbarLayerImplBase* scrollbar,
const ScrollbarPart scrollbar_part, const ScrollbarPart scrollbar_part,
const bool shift_modifier); const bool shift_modifier) const;
// Returns the rect for the ScrollbarPart. // Returns the rect for the ScrollbarPart.
gfx::Rect GetRectForScrollbarPart(const ScrollbarLayerImplBase* scrollbar, gfx::Rect GetRectForScrollbarPart(const ScrollbarPart scrollbar_part) const;
const ScrollbarPart scrollbar_part);
LayerImpl* GetLayerHitByPoint(const gfx::PointF position_in_widget); LayerImpl* GetLayerHitByPoint(const gfx::PointF position_in_widget) const;
int GetScrollDeltaForScrollbarPart(const ScrollbarLayerImplBase* scrollbar, int GetScrollDeltaForScrollbarPart(const ScrollbarPart scrollbar_part,
const ScrollbarPart scrollbar_part, const bool shift_modifier) const;
const bool shift_modifier);
// Makes position_in_widget relative to the scrollbar. // Makes position_in_widget relative to the scrollbar.
gfx::PointF GetScrollbarRelativePosition( gfx::PointF GetScrollbarRelativePosition(const gfx::PointF position_in_widget,
const ScrollbarLayerImplBase* scrollbar, bool* clipped) const;
const gfx::PointF position_in_widget,
bool* clipped);
// Decides if the scroller should snap to the offset that it was originally at // Decides if the scroller should snap to the offset that it was originally at
// (i.e the offset before the thumb drag). // (i.e the offset before the thumb drag).
bool SnapToDragOrigin(const ScrollbarLayerImplBase* scrollbar, bool SnapToDragOrigin(const gfx::PointF pointer_position_in_widget) const;
const gfx::PointF pointer_position_in_widget);
// Decides whether a track autoscroll should be aborted (or restarted) due to // Decides whether a track autoscroll should be aborted (or restarted) due to
// the thumb reaching the pointer or the pointer leaving (or re-entering) the // the thumb reaching the pointer or the pointer leaving (or re-entering) the
...@@ -233,22 +224,21 @@ class CC_EXPORT ScrollbarController { ...@@ -233,22 +224,21 @@ class CC_EXPORT ScrollbarController {
// Shift (or "Option" in case of Mac) + click is expected to do a non-animated // Shift (or "Option" in case of Mac) + click is expected to do a non-animated
// jump to a certain offset. // jump to a certain offset.
float GetScrollDeltaForAbsoluteJump(const ScrollbarLayerImplBase* scrollbar); float GetScrollDeltaForAbsoluteJump() const;
// Determines if the delta needs to be animated. // Determines if the delta needs to be animated.
ui::ScrollGranularity Granularity(const ScrollbarPart scrollbar_part, ui::ScrollGranularity Granularity(const ScrollbarPart scrollbar_part,
bool shift_modifier); bool shift_modifier) const;
// Calculates the delta based on position_in_widget and drag_origin. // Calculates the delta based on position_in_widget and drag_origin.
int GetScrollDeltaForDragPosition( int GetScrollDeltaForDragPosition(
const ScrollbarLayerImplBase* scrollbar, const gfx::PointF pointer_position_in_widget) const;
const gfx::PointF pointer_position_in_widget);
// Returns the ratio of the scroller length to the scrollbar length. This is // Returns the ratio of the scroller length to the scrollbar length. This is
// needed to scale the scroll delta for thumb drag. // needed to scale the scroll delta for thumb drag.
float GetScrollerToScrollbarRatio(const ScrollbarLayerImplBase* scrollbar); float GetScrollerToScrollbarRatio() const;
int GetViewportLength(const ScrollbarLayerImplBase* scrollbar) const; int GetViewportLength() const;
LayerTreeHostImpl* layer_tree_host_impl_; LayerTreeHostImpl* layer_tree_host_impl_;
......
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