Remove ui::ScrollGranularity::kScrollByPercentage
The CL deletes ui::ScrollGranularity::kScrollByPercentage, related code and the runtime PercentBasedScrolling feature flag. ScrollUtils::ResolveScrollPercentageToPixels is kept since it is used for scroll by page wheel scroll which happens on the compositor thread. Bug: 359747082 Change-Id: I7eaa5b9e516a52a48c26112b49258052bb639ffa Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6033599 Reviewed-by: Rahul Arakeri <arakeri@microsoft.com> Reviewed-by: Robert Flack <flackr@chromium.org> Reviewed-by: Olga Gerchikov <gerchiko@microsoft.com> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Commit-Queue: Yaroslav Shalivskyy <yshalivskyy@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1387160}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
00ac3868ea
commit
f90b4aa1a1
cc/input
components/input
content
browser
renderer_host
child
common
third_party/blink
common
input
renderer
core
input
scroll
platform
tools
blinkpy
presubmit
ui/events
@ -1494,13 +1494,6 @@ gfx::Vector2dF InputHandler::ResolveScrollGranularityToPixels(
|
||||
gfx::Vector2dF pixel_delta = scroll_delta;
|
||||
|
||||
if (granularity == ui::ScrollGranularity::kScrollByPage) {
|
||||
// Page should use a percentage of the scroller so change the parameters
|
||||
// and let the percentage case below resolve it.
|
||||
granularity = ui::ScrollGranularity::kScrollByPercentage;
|
||||
pixel_delta.Scale(kMinFractionToStepWhenPaging);
|
||||
}
|
||||
|
||||
if (granularity == ui::ScrollGranularity::kScrollByPercentage) {
|
||||
gfx::SizeF scroller_size = gfx::SizeF(scroll_node.container_bounds);
|
||||
gfx::SizeF viewport_size(compositor_delegate_->VisualDeviceViewportSize());
|
||||
|
||||
@ -1512,6 +1505,7 @@ gfx::Vector2dF InputHandler::ResolveScrollGranularityToPixels(
|
||||
// enabled, `DeviceScaleFactor()` returns 1).
|
||||
viewport_size.InvScale(compositor_delegate_->DeviceScaleFactor());
|
||||
|
||||
pixel_delta.Scale(kMinFractionToStepWhenPaging);
|
||||
pixel_delta = ScrollUtils::ResolveScrollPercentageToPixels(
|
||||
pixel_delta, scroller_size, viewport_size);
|
||||
}
|
||||
|
@ -17,16 +17,14 @@ namespace cc {
|
||||
static constexpr int kPixelsPerLineStep = 40;
|
||||
static constexpr float kMinFractionToStepWhenPaging = 0.875f;
|
||||
|
||||
// Each directional scroll for percentage-based units should scroll 1/8th of
|
||||
// the scrollable area.
|
||||
static constexpr float kPercentDeltaForDirectionalScroll = 0.125f;
|
||||
|
||||
// Class for scroll helper methods in cc and blink.
|
||||
class CC_EXPORT ScrollUtils {
|
||||
public:
|
||||
// Transforms a |scroll_delta| in percent units to pixel units based in its
|
||||
// |scroller_size|. Limits it by a maximum of 12.5% of |viewport_size| to
|
||||
// avoid too large deltas. Inputs and output must be in physical pixels.
|
||||
// Transforms a |scroll_delta| in percent units to pixel units based on its
|
||||
// scroller_size and viewport_size. Inputs and output must be in physical
|
||||
// pixels. Currently used for converting kScrollByPage wheel scrolls
|
||||
// (available on some platforms and can be enabled via the OS setting) that
|
||||
// are handled on the compositor thread to pixel units.
|
||||
static gfx::Vector2dF ResolveScrollPercentageToPixels(
|
||||
const gfx::Vector2dF& scroll_delta,
|
||||
const gfx::SizeF& scroller_size,
|
||||
|
@ -157,9 +157,7 @@ void MouseWheelEventQueue::ProcessMouseWheelAck(
|
||||
event_sent_for_gesture_ack_->event.delta_units ==
|
||||
ui::ScrollGranularity::kScrollByPrecisePixel ||
|
||||
event_sent_for_gesture_ack_->event.delta_units ==
|
||||
ui::ScrollGranularity::kScrollByPixel ||
|
||||
event_sent_for_gesture_ack_->event.delta_units ==
|
||||
ui::ScrollGranularity::kScrollByPercentage);
|
||||
ui::ScrollGranularity::kScrollByPixel);
|
||||
scroll_update.data.scroll_update.delta_units =
|
||||
event_sent_for_gesture_ack_->event.delta_units;
|
||||
|
||||
|
@ -67,28 +67,7 @@ void SyntheticGestureTargetBase::DispatchInputEventToPlatform(
|
||||
LOG(WARNING) << "Mouse wheel position is not within content bounds.";
|
||||
return;
|
||||
}
|
||||
if (web_wheel.delta_units != ui::ScrollGranularity::kScrollByPercentage)
|
||||
DispatchWebMouseWheelEventToPlatform(web_wheel, latency_info);
|
||||
else {
|
||||
// Percentage-based mouse wheel scrolls are implemented in the UI layer by
|
||||
// converting a native event's wheel tick amount to a percentage and
|
||||
// setting that directly on WebMouseWheelEvent (i.e. it does not read the
|
||||
// ui::MouseWheelEvent). However, when dispatching a synthetic
|
||||
// ui::MouseWheelEvent, the created WebMouseWheelEvent will copy values
|
||||
// from the ui::MouseWheelEvent. ui::MouseWheelEvent does
|
||||
// not have a float value for delta, so that codepath ends up truncating.
|
||||
// So instead, dispatch the WebMouseWheelEvent directly through the
|
||||
// RenderWidgetHostInputEventRouter attached to the RenderWidgetHostImpl.
|
||||
|
||||
DCHECK(host_->delegate());
|
||||
DCHECK(host_->delegate()->IsWidgetForPrimaryMainFrame(host_));
|
||||
DCHECK(host_->delegate()->GetInputEventRouter());
|
||||
|
||||
std::unique_ptr<WebInputEvent> wheel_evt_ptr = web_wheel.Clone();
|
||||
host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent(
|
||||
host_->GetView(),
|
||||
static_cast<WebMouseWheelEvent*>(wheel_evt_ptr.get()), latency_info);
|
||||
}
|
||||
DispatchWebMouseWheelEventToPlatform(web_wheel, latency_info);
|
||||
} else if (WebInputEvent::IsMouseEventType(event.GetType())) {
|
||||
const WebMouseEvent& web_mouse =
|
||||
static_cast<const WebMouseEvent&>(event);
|
||||
|
@ -262,8 +262,6 @@ void SetRuntimeFeaturesFromChromiumFeatures() {
|
||||
raw_ref(features::kNotificationContentImage), kSetOnlyIfOverridden},
|
||||
{wf::EnablePaymentApp, raw_ref(features::kServiceWorkerPaymentApps)},
|
||||
{wf::EnablePaymentRequest, raw_ref(features::kWebPayments)},
|
||||
{wf::EnablePercentBasedScrolling,
|
||||
raw_ref(features::kWindowsScrollingPersonality)},
|
||||
{wf::EnablePeriodicBackgroundSync,
|
||||
raw_ref(features::kPeriodicBackgroundSync)},
|
||||
{wf::EnablePushMessagingSubscriptionChange,
|
||||
|
@ -398,16 +398,11 @@ void SyntheticSmoothMoveGesture::ComputeNextMoveSegment() {
|
||||
DCHECK_LT(current_move_segment_, static_cast<int>(params().distances.size()));
|
||||
// Percentage based scrolls do not require velocity and are delivered in a
|
||||
// single segment. No need to compute another segment
|
||||
if (params().granularity == ui::ScrollGranularity::kScrollByPercentage) {
|
||||
current_move_segment_start_time_ = current_move_segment_stop_time_;
|
||||
} else {
|
||||
const auto duration = base::Seconds(
|
||||
double{params().distances[current_move_segment_].Length()} /
|
||||
params().speed_in_pixels_s);
|
||||
current_move_segment_start_time_ = current_move_segment_stop_time_;
|
||||
current_move_segment_stop_time_ =
|
||||
current_move_segment_start_time_ + duration;
|
||||
}
|
||||
const auto duration =
|
||||
base::Seconds(double{params().distances[current_move_segment_].Length()} /
|
||||
params().speed_in_pixels_s);
|
||||
current_move_segment_start_time_ = current_move_segment_stop_time_;
|
||||
current_move_segment_stop_time_ = current_move_segment_start_time_ + duration;
|
||||
}
|
||||
|
||||
base::TimeTicks SyntheticSmoothMoveGesture::ClampTimestamp(
|
||||
|
@ -126,31 +126,17 @@ ui::ScrollInputType WebGestureEvent::GetScrollInputType() const {
|
||||
}
|
||||
|
||||
float WebGestureEvent::DeltaXInRootFrame() const {
|
||||
float delta_x = (type_ == WebInputEvent::Type::kGestureScrollBegin)
|
||||
? data.scroll_begin.delta_x_hint
|
||||
: data.scroll_update.delta_x;
|
||||
|
||||
bool is_percent = (type_ == WebInputEvent::Type::kGestureScrollBegin)
|
||||
? data.scroll_begin.delta_hint_units ==
|
||||
ui::ScrollGranularity::kScrollByPercentage
|
||||
: data.scroll_update.delta_units ==
|
||||
ui::ScrollGranularity::kScrollByPercentage;
|
||||
|
||||
return is_percent ? delta_x : delta_x / frame_scale_;
|
||||
const float delta_x = (type_ == WebInputEvent::Type::kGestureScrollBegin)
|
||||
? data.scroll_begin.delta_x_hint
|
||||
: data.scroll_update.delta_x;
|
||||
return delta_x / frame_scale_;
|
||||
}
|
||||
|
||||
float WebGestureEvent::DeltaYInRootFrame() const {
|
||||
float delta_y = (type_ == WebInputEvent::Type::kGestureScrollBegin)
|
||||
? data.scroll_begin.delta_y_hint
|
||||
: data.scroll_update.delta_y;
|
||||
|
||||
bool is_percent = (type_ == WebInputEvent::Type::kGestureScrollBegin)
|
||||
? data.scroll_begin.delta_hint_units ==
|
||||
ui::ScrollGranularity::kScrollByPercentage
|
||||
: data.scroll_update.delta_units ==
|
||||
ui::ScrollGranularity::kScrollByPercentage;
|
||||
|
||||
return is_percent ? delta_y : delta_y / frame_scale_;
|
||||
const float delta_y = (type_ == WebInputEvent::Type::kGestureScrollBegin)
|
||||
? data.scroll_begin.delta_y_hint
|
||||
: data.scroll_update.delta_y;
|
||||
return delta_y / frame_scale_;
|
||||
}
|
||||
|
||||
ui::ScrollGranularity WebGestureEvent::DeltaUnits() const {
|
||||
@ -234,18 +220,12 @@ void WebGestureEvent::FlattenTransform() {
|
||||
if (frame_scale_ != 1) {
|
||||
switch (type_) {
|
||||
case WebInputEvent::Type::kGestureScrollBegin:
|
||||
if (data.scroll_begin.delta_hint_units !=
|
||||
ui::ScrollGranularity::kScrollByPercentage) {
|
||||
data.scroll_begin.delta_x_hint /= frame_scale_;
|
||||
data.scroll_begin.delta_y_hint /= frame_scale_;
|
||||
}
|
||||
data.scroll_begin.delta_x_hint /= frame_scale_;
|
||||
data.scroll_begin.delta_y_hint /= frame_scale_;
|
||||
break;
|
||||
case WebInputEvent::Type::kGestureScrollUpdate:
|
||||
if (data.scroll_update.delta_units !=
|
||||
ui::ScrollGranularity::kScrollByPercentage) {
|
||||
data.scroll_update.delta_x /= frame_scale_;
|
||||
data.scroll_update.delta_y /= frame_scale_;
|
||||
}
|
||||
data.scroll_update.delta_x /= frame_scale_;
|
||||
data.scroll_update.delta_y /= frame_scale_;
|
||||
break;
|
||||
case WebInputEvent::Type::kGestureTwoFingerTap:
|
||||
data.two_finger_tap.first_finger_width /= frame_scale_;
|
||||
|
@ -21,23 +21,6 @@
|
||||
|
||||
namespace blink {
|
||||
|
||||
namespace {
|
||||
|
||||
gfx::Vector2dF ResolveMouseWheelPercentToWheelDelta(
|
||||
const WebMouseWheelEvent& event) {
|
||||
DCHECK(event.delta_units == ui::ScrollGranularity::kScrollByPercentage);
|
||||
// TODO (dlibby): OS scroll settings need to be factored into this.
|
||||
// Note that this value is negative because we're converting from wheel
|
||||
// ticks to wheel delta pixel. Wheel ticks are negative for scrolling down,
|
||||
// but the delta must be positive.
|
||||
constexpr float percent_mouse_wheel_ticks_multiplier = -100.f;
|
||||
return gfx::Vector2dF(
|
||||
event.wheel_ticks_x * percent_mouse_wheel_ticks_multiplier,
|
||||
event.wheel_ticks_y * percent_mouse_wheel_ticks_multiplier);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
MouseWheelEventManager::MouseWheelEventManager(LocalFrame& frame,
|
||||
ScrollManager& scroll_manager)
|
||||
: frame_(frame), wheel_target_(nullptr), scroll_manager_(scroll_manager) {}
|
||||
@ -106,12 +89,7 @@ WebInputEventResult MouseWheelEventManager::HandleWheelEvent(
|
||||
|
||||
if (wheel_target_) {
|
||||
WheelEvent* dom_event =
|
||||
(event.delta_units == ui::ScrollGranularity::kScrollByPercentage)
|
||||
? WheelEvent::Create(event,
|
||||
ResolveMouseWheelPercentToWheelDelta(event),
|
||||
*wheel_target_->GetDocument().domWindow())
|
||||
: WheelEvent::Create(event,
|
||||
*wheel_target_->GetDocument().domWindow());
|
||||
WheelEvent::Create(event, *wheel_target_->GetDocument().domWindow());
|
||||
|
||||
// The event handler might remove |wheel_target_| from DOM so we should get
|
||||
// this value now (see https://crbug.com/857013).
|
||||
|
@ -221,20 +221,15 @@ bool ScrollManager::LogicalScroll(mojom::blink::ScrollDirection direction,
|
||||
ScrollableArea* scrollable_area = ScrollableArea::GetForScrolling(box);
|
||||
DCHECK(scrollable_area);
|
||||
|
||||
ScrollOffset delta =
|
||||
ToScrollDelta(physical_direction,
|
||||
ScrollableArea::DirectionBasedScrollDelta(granularity));
|
||||
ScrollOffset delta = ToScrollDelta(physical_direction, 1);
|
||||
delta.Scale(scrollable_area->ScrollStep(granularity, kHorizontalScrollbar),
|
||||
scrollable_area->ScrollStep(granularity, kVerticalScrollbar));
|
||||
// Pressing the arrow key is considered as a scroll with intended direction
|
||||
// only (this results in kScrollByLine or kScrollByPercentage, depending on
|
||||
// REF::PercentBasedScrollingEnabled). Pressing the PgUp/PgDn key is
|
||||
// considered as a scroll with intended direction and end position. Pressing
|
||||
// the Home/End key is considered as a scroll with intended end position
|
||||
// only.
|
||||
// only. Pressing the PgUp/PgDn key is considered as a scroll with intended
|
||||
// direction and end position. Pressing the Home/End key is considered as a
|
||||
// scroll with intended end position only.
|
||||
switch (granularity) {
|
||||
case ui::ScrollGranularity::kScrollByLine:
|
||||
case ui::ScrollGranularity::kScrollByPercentage: {
|
||||
case ui::ScrollGranularity::kScrollByLine: {
|
||||
if (scrollable_area->SnapForDirection(delta))
|
||||
return true;
|
||||
break;
|
||||
@ -297,10 +292,7 @@ bool ScrollManager::LogicalScroll(mojom::blink::ScrollDirection direction,
|
||||
&(frame_->GetEventHandler().GetKeyboardEventManager())),
|
||||
scrolling_via_key));
|
||||
ScrollResult result = scrollable_area->UserScroll(
|
||||
granularity,
|
||||
ToScrollDelta(physical_direction,
|
||||
ScrollableArea::DirectionBasedScrollDelta(granularity)),
|
||||
std::move(callback));
|
||||
granularity, ToScrollDelta(physical_direction, 1), std::move(callback));
|
||||
|
||||
if (result.DidScroll())
|
||||
return true;
|
||||
|
@ -92,14 +92,6 @@ int ScrollableArea::MaxOverlapBetweenPages() const {
|
||||
return GetPageScrollbarTheme().MaxOverlapBetweenPages();
|
||||
}
|
||||
|
||||
// static
|
||||
float ScrollableArea::DirectionBasedScrollDelta(
|
||||
ui::ScrollGranularity granularity) {
|
||||
return (granularity == ui::ScrollGranularity::kScrollByPercentage)
|
||||
? cc::kPercentDeltaForDirectionalScroll
|
||||
: 1;
|
||||
}
|
||||
|
||||
// static
|
||||
mojom::blink::ScrollBehavior ScrollableArea::DetermineScrollBehavior(
|
||||
mojom::blink::ScrollBehavior behavior_from_param,
|
||||
@ -203,8 +195,6 @@ float ScrollableArea::ScrollStep(ui::ScrollGranularity granularity,
|
||||
case ui::ScrollGranularity::kScrollByPixel:
|
||||
case ui::ScrollGranularity::kScrollByPrecisePixel:
|
||||
return PixelStep(orientation);
|
||||
case ui::ScrollGranularity::kScrollByPercentage:
|
||||
return PercentageStep(orientation);
|
||||
default:
|
||||
NOTREACHED();
|
||||
}
|
||||
@ -215,25 +205,6 @@ ScrollOffset ScrollableArea::ResolveScrollDelta(
|
||||
const ScrollOffset& delta) {
|
||||
gfx::SizeF step(ScrollStep(granularity, kHorizontalScrollbar),
|
||||
ScrollStep(granularity, kVerticalScrollbar));
|
||||
|
||||
if (granularity == ui::ScrollGranularity::kScrollByPercentage) {
|
||||
LocalFrame* local_frame = GetLayoutBox()->GetFrame();
|
||||
DCHECK(local_frame);
|
||||
gfx::SizeF viewport(local_frame->GetPage()->GetVisualViewport().Size());
|
||||
|
||||
// Convert to screen coordinates (physical pixels).
|
||||
float page_scale_factor = local_frame->GetPage()->PageScaleFactor();
|
||||
step.Scale(page_scale_factor);
|
||||
|
||||
gfx::Vector2dF pixel_delta =
|
||||
cc::ScrollUtils::ResolveScrollPercentageToPixels(delta, step, viewport);
|
||||
|
||||
// Rescale back to rootframe coordinates.
|
||||
pixel_delta.Scale(1 / page_scale_factor);
|
||||
|
||||
return pixel_delta;
|
||||
}
|
||||
|
||||
return gfx::ScaleVector2d(delta, step.width(), step.height());
|
||||
}
|
||||
|
||||
@ -1159,14 +1130,6 @@ float ScrollableArea::PixelStep(ScrollbarOrientation) const {
|
||||
return 1;
|
||||
}
|
||||
|
||||
float ScrollableArea::PercentageStep(ScrollbarOrientation orientation) const {
|
||||
int percent_basis =
|
||||
(orientation == ScrollbarOrientation::kHorizontalScrollbar)
|
||||
? VisibleWidth()
|
||||
: VisibleHeight();
|
||||
return static_cast<float>(percent_basis);
|
||||
}
|
||||
|
||||
int ScrollableArea::VerticalScrollbarWidth(
|
||||
OverlayScrollbarClipBehavior behavior) const {
|
||||
DCHECK_EQ(behavior, kIgnoreOverlayScrollbarSize);
|
||||
|
@ -109,10 +109,6 @@ class CORE_EXPORT ScrollableArea : public GarbageCollectedMixin {
|
||||
static float MinFractionToStepWhenPaging();
|
||||
int MaxOverlapBetweenPages() const;
|
||||
|
||||
// Returns the amount of delta, in |granularity| units, for a direction-based
|
||||
// (i.e. keyboard or scrollbar arrow) scroll.
|
||||
static float DirectionBasedScrollDelta(ui::ScrollGranularity granularity);
|
||||
|
||||
// Convert a non-finite scroll value (Infinity, -Infinity, NaN) to 0 as
|
||||
// per https://drafts.csswg.org/cssom-view/#normalize-non-finite-values.
|
||||
static float NormalizeNonFiniteScroll(float value) {
|
||||
@ -691,12 +687,6 @@ class CORE_EXPORT ScrollableArea : public GarbageCollectedMixin {
|
||||
virtual int DocumentStep(ScrollbarOrientation) const;
|
||||
virtual float PixelStep(ScrollbarOrientation) const;
|
||||
|
||||
// This returns the amount a percent-based delta should be resolved against;
|
||||
// which is the visible height of the scroller. This value is eventually
|
||||
// used to scroll the incoming scroll delta, where a scroll delta of 1
|
||||
// represents one hundred percent.
|
||||
float PercentageStep(ScrollbarOrientation) const;
|
||||
|
||||
// Returns true if a snap point was found.
|
||||
bool PerformSnapping(
|
||||
const cc::SnapSelectionStrategy& strategy,
|
||||
|
@ -620,10 +620,9 @@ void Scrollbar::MouseDown(const WebMouseEvent& evt) {
|
||||
|
||||
void Scrollbar::InjectScrollGestureForPressedPart(
|
||||
WebInputEvent::Type gesture_type) {
|
||||
ui::ScrollGranularity granularity = PressedPartScrollGranularity();
|
||||
ScrollOffset delta =
|
||||
ToScrollDelta(PressedPartScrollDirectionPhysical(),
|
||||
ScrollableArea::DirectionBasedScrollDelta(granularity));
|
||||
const ui::ScrollGranularity granularity = PressedPartScrollGranularity();
|
||||
const ScrollOffset delta =
|
||||
ToScrollDelta(PressedPartScrollDirectionPhysical(), 1);
|
||||
InjectScrollGesture(gesture_type, delta, granularity);
|
||||
}
|
||||
|
||||
|
@ -3218,12 +3218,6 @@
|
||||
status: "experimental",
|
||||
base_feature: "none",
|
||||
},
|
||||
{
|
||||
name: "PercentBasedScrolling",
|
||||
base_feature: "none",
|
||||
public: true,
|
||||
settable_from_internals: true,
|
||||
},
|
||||
{
|
||||
name: "PerformanceManagerInstrumentation",
|
||||
base_feature: "none",
|
||||
|
@ -626,7 +626,6 @@ _CONFIG = [
|
||||
'cc::kManipulationInfoTouch',
|
||||
'cc::kManipulationInfoWheel',
|
||||
'cc::kMinFractionToStepWhenPaging',
|
||||
'cc::kPercentDeltaForDirectionalScroll',
|
||||
'cc::kPixelsPerLineStep',
|
||||
'cc::MainThreadScrollingReason',
|
||||
'cc::ManipulationInfo',
|
||||
|
@ -29,10 +29,6 @@ struct GestureEventData;
|
||||
struct GestureEventDetails;
|
||||
class MotionEvent;
|
||||
|
||||
// The scroll percentage per mousewheel tick. Used to determine scroll delta
|
||||
// if percent based scrolling is enabled.
|
||||
const float kScrollPercentPerLineOrChar = 0.05f;
|
||||
|
||||
blink::WebTouchEvent CreateWebTouchEventFromMotionEvent(
|
||||
const MotionEvent& event,
|
||||
bool may_cause_scrolling,
|
||||
|
@ -35,12 +35,12 @@ TEST(BlinkEventUtilTest, NoScalingWith1DSF) {
|
||||
EXPECT_TRUE(ScaleWebInputEvent(event, 2.f));
|
||||
}
|
||||
|
||||
void RunTest(ui::ScrollGranularity granularity) {
|
||||
TEST(BlinkEventUtilTest, NonPaginatedWebMouseWheelEvent) {
|
||||
blink::WebMouseWheelEvent event(
|
||||
blink::WebInputEvent::Type::kMouseWheel,
|
||||
blink::WebInputEvent::kNoModifiers,
|
||||
blink::WebInputEvent::GetStaticTimeStampForTests());
|
||||
event.delta_units = granularity;
|
||||
event.delta_units = ui::ScrollGranularity::kScrollByPixel;
|
||||
event.delta_x = 1.f;
|
||||
event.delta_y = 1.f;
|
||||
event.wheel_ticks_x = 1.f;
|
||||
@ -56,14 +56,6 @@ void RunTest(ui::ScrollGranularity granularity) {
|
||||
EXPECT_EQ(2.f, mouseWheelEvent->wheel_ticks_y);
|
||||
}
|
||||
|
||||
TEST(BlinkEventUtilTest, NonPaginatedWebMouseWheelEvent) {
|
||||
RunTest(ui::ScrollGranularity::kScrollByPixel);
|
||||
}
|
||||
|
||||
TEST(BlinkEventUtilTest, NonPaginatedWebMouseWheelEventPercentBased) {
|
||||
RunTest(ui::ScrollGranularity::kScrollByPercentage);
|
||||
}
|
||||
|
||||
TEST(BlinkEventUtilTest, PaginatedWebMouseWheelEvent) {
|
||||
blink::WebMouseWheelEvent event(
|
||||
blink::WebInputEvent::Type::kMouseWheel,
|
||||
|
@ -16,8 +16,7 @@ enum class ScrollGranularity : uint8_t {
|
||||
kScrollByLine,
|
||||
kScrollByPage,
|
||||
kScrollByDocument,
|
||||
kScrollByPercentage,
|
||||
kMaxValue = kScrollByPercentage
|
||||
kMaxValue = kScrollByDocument
|
||||
};
|
||||
|
||||
} // namespace ui
|
||||
|
Reference in New Issue
Block a user