зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 2d9ef4afb05d (bug 1675949) for causing mochitest plain failures in test_dom_wheel_event.html
CLOSED TREE
This commit is contained in:
Родитель
15ccc7ae4e
Коммит
4cff4186cb
|
@ -2373,9 +2373,18 @@ void EventStateManager::DispatchLegacyMouseScrollEvents(
|
|||
|
||||
// Ignore mouse wheel transaction for computing legacy mouse wheel
|
||||
// events' delta value.
|
||||
nsIFrame* scrollFrame = ComputeScrollTargetAndMayAdjustWheelEvent(
|
||||
aTargetFrame, aEvent, COMPUTE_LEGACY_MOUSE_SCROLL_EVENT_TARGET);
|
||||
|
||||
nsIScrollableFrame* scrollTarget = do_QueryFrame(scrollFrame);
|
||||
nsPresContext* pc =
|
||||
scrollFrame ? scrollFrame->PresContext() : aTargetFrame->PresContext();
|
||||
|
||||
// DOM event's delta vales are computed from CSS pixels.
|
||||
auto scrollAmountInCSSPixels =
|
||||
CSSIntSize::FromAppUnits(aEvent->mScrollAmount);
|
||||
nsSize scrollAmount = GetScrollAmount(pc, aEvent, scrollTarget);
|
||||
nsIntSize scrollAmountInCSSPixels(
|
||||
nsPresContext::AppUnitsToIntCSSPixels(scrollAmount.width),
|
||||
nsPresContext::AppUnitsToIntCSSPixels(scrollAmount.height));
|
||||
|
||||
// XXX We don't deal with fractional amount in legacy event, though the
|
||||
// default action handler (DoScrollText()) deals with it.
|
||||
|
@ -5928,15 +5937,6 @@ void EventStateManager::DeltaAccumulator::InitLineOrPageDelta(
|
|||
mHandlingDeltaMode = aEvent->mDeltaMode;
|
||||
mIsNoLineOrPageDeltaDevice = aEvent->mIsNoLineOrPageDelta;
|
||||
|
||||
{
|
||||
nsIFrame* frame = aESM->ComputeScrollTarget(
|
||||
aTargetFrame, aEvent, COMPUTE_LEGACY_MOUSE_SCROLL_EVENT_TARGET);
|
||||
nsPresContext* pc =
|
||||
frame ? frame->PresContext() : aTargetFrame->PresContext();
|
||||
nsIScrollableFrame* scrollTarget = do_QueryFrame(frame);
|
||||
aEvent->mScrollAmount = aESM->GetScrollAmount(pc, aEvent, scrollTarget);
|
||||
}
|
||||
|
||||
// If it's handling neither a device that does not provide line or page deltas
|
||||
// nor delta values multiplied by prefs, we must not modify lineOrPageDelta
|
||||
// values.
|
||||
|
@ -5969,8 +5969,15 @@ void EventStateManager::DeltaAccumulator::InitLineOrPageDelta(
|
|||
// eMouseScrollEventClass (DOMMouseScroll) but not be used for scrolling
|
||||
// of default action. The transaction should be used only for the default
|
||||
// action.
|
||||
auto scrollAmountInCSSPixels =
|
||||
CSSIntSize::FromAppUnits(aEvent->mScrollAmount);
|
||||
nsIFrame* frame = aESM->ComputeScrollTarget(
|
||||
aTargetFrame, aEvent, COMPUTE_LEGACY_MOUSE_SCROLL_EVENT_TARGET);
|
||||
nsPresContext* pc =
|
||||
frame ? frame->PresContext() : aTargetFrame->PresContext();
|
||||
nsIScrollableFrame* scrollTarget = do_QueryFrame(frame);
|
||||
nsSize scrollAmount = aESM->GetScrollAmount(pc, aEvent, scrollTarget);
|
||||
nsIntSize scrollAmountInCSSPixels(
|
||||
nsPresContext::AppUnitsToIntCSSPixels(scrollAmount.width),
|
||||
nsPresContext::AppUnitsToIntCSSPixels(scrollAmount.height));
|
||||
|
||||
aEvent->mLineOrPageDeltaX = RoundDown(mX) / scrollAmountInCSSPixels.width;
|
||||
aEvent->mLineOrPageDeltaY = RoundDown(mY) / scrollAmountInCSSPixels.height;
|
||||
|
|
|
@ -61,8 +61,7 @@ void WheelEvent::InitWheelEvent(
|
|||
}
|
||||
|
||||
double WheelEvent::ToWebExposedDelta(const WidgetWheelEvent& aWidgetEvent,
|
||||
double aDelta, nscoord aLineOrPageAmount,
|
||||
CallerType aCallerType) {
|
||||
double aDelta, CallerType aCallerType) {
|
||||
if (aCallerType != CallerType::System) {
|
||||
if (mDeltaModeCheckingState == DeltaModeCheckingState::Unknown) {
|
||||
mDeltaModeCheckingState = DeltaModeCheckingState::Unchecked;
|
||||
|
@ -70,7 +69,9 @@ double WheelEvent::ToWebExposedDelta(const WidgetWheelEvent& aWidgetEvent,
|
|||
if (mDeltaModeCheckingState == DeltaModeCheckingState::Unchecked &&
|
||||
aWidgetEvent.mDeltaMode == WheelEvent_Binding::DOM_DELTA_LINE &&
|
||||
StaticPrefs::dom_event_wheel_deltaMode_lines_disabled()) {
|
||||
return aDelta * CSSPixel::FromAppUnits(aLineOrPageAmount);
|
||||
// TODO(emilio, bug 1675949): Consider not using a fixed multiplier here?
|
||||
return aDelta *
|
||||
StaticPrefs::dom_event_wheel_deltaMode_lines_to_pixel_scale();
|
||||
}
|
||||
}
|
||||
if (!mAppUnitsPerDevPixel) {
|
||||
|
@ -81,21 +82,17 @@ double WheelEvent::ToWebExposedDelta(const WidgetWheelEvent& aWidgetEvent,
|
|||
|
||||
double WheelEvent::DeltaX(CallerType aCallerType) {
|
||||
WidgetWheelEvent* ev = mEvent->AsWheelEvent();
|
||||
return ToWebExposedDelta(*ev, ev->mDeltaX, ev->mScrollAmount.width,
|
||||
aCallerType);
|
||||
return ToWebExposedDelta(*ev, ev->mDeltaX, aCallerType);
|
||||
}
|
||||
|
||||
double WheelEvent::DeltaY(CallerType aCallerType) {
|
||||
WidgetWheelEvent* ev = mEvent->AsWheelEvent();
|
||||
return ToWebExposedDelta(*ev, ev->mDeltaY, ev->mScrollAmount.height,
|
||||
aCallerType);
|
||||
return ToWebExposedDelta(*ev, ev->mDeltaY, aCallerType);
|
||||
}
|
||||
|
||||
double WheelEvent::DeltaZ(CallerType aCallerType) {
|
||||
WidgetWheelEvent* ev = mEvent->AsWheelEvent();
|
||||
// XXX Unclear what scroll amount we should use for deltaZ...
|
||||
auto amount = std::max(ev->mScrollAmount.width, ev->mScrollAmount.height);
|
||||
return ToWebExposedDelta(*ev, ev->mDeltaZ, amount, aCallerType);
|
||||
return ToWebExposedDelta(*ev, ev->mDeltaZ, aCallerType);
|
||||
}
|
||||
|
||||
uint32_t WheelEvent::DeltaMode(CallerType aCallerType) {
|
||||
|
|
|
@ -49,8 +49,7 @@ class WheelEvent : public MouseEvent {
|
|||
protected:
|
||||
~WheelEvent() = default;
|
||||
|
||||
double ToWebExposedDelta(const WidgetWheelEvent&, double aDelta,
|
||||
nscoord aLineOrPageAmount, CallerType);
|
||||
double ToWebExposedDelta(const WidgetWheelEvent&, double aDelta, CallerType);
|
||||
|
||||
private:
|
||||
int32_t mAppUnitsPerDevPixel;
|
||||
|
|
|
@ -2503,9 +2503,9 @@ function* testContinuousTrustedEvents()
|
|||
wheel: {
|
||||
expected: true, preventDefault: false,
|
||||
skipDeltaModeCheck: true,
|
||||
deltaX: gHorizontalLine,
|
||||
deltaY: gLineHeight,
|
||||
deltaZ: Math.max(gHorizontalLine, gLineHeight),
|
||||
deltaX: SpecialPowers.getIntPref("dom.event.wheel-deltaMode-lines-to-pixel-scale"),
|
||||
deltaY: SpecialPowers.getIntPref("dom.event.wheel-deltaMode-lines-to-pixel-scale"),
|
||||
deltaZ: SpecialPowers.getIntPref("dom.event.wheel-deltaMode-lines-to-pixel-scale"),
|
||||
},
|
||||
DOMMouseScroll: {
|
||||
horizontal: { expected: true, preventDefault: false, detail: 1 },
|
||||
|
|
|
@ -1780,6 +1780,15 @@
|
|||
value: false
|
||||
mirror: always
|
||||
|
||||
# When dom.event.wheel-deltaMode-lines.disabled is true, this is the lines to
|
||||
# pixels multiplier that gets used.
|
||||
#
|
||||
# The value here is taken from PIXELS_PER_LINE_SCALE from pdf.js.
|
||||
- name: dom.event.wheel-deltaMode-lines-to-pixel-scale
|
||||
type: uint32_t
|
||||
value: 30
|
||||
mirror: always
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
# Whether to disable treating ctrl click as right click
|
||||
- name: dom.event.treat_ctrl_click_as_right_click.disabled
|
||||
|
|
|
@ -513,12 +513,6 @@ class WidgetWheelEvent : public WidgetMouseEventBase {
|
|||
double mDeltaY;
|
||||
double mDeltaZ;
|
||||
|
||||
// The amount of scrolling per line or page, without accounting for mouse
|
||||
// wheel transactions etc.
|
||||
//
|
||||
// Computed by EventStateManager::DeltaAccumulator::InitLineOrPageDelta.
|
||||
nsSize mScrollAmount;
|
||||
|
||||
// overflowed delta values for scroll, these values are set by
|
||||
// EventStateManger. If the default action of the wheel event isn't scroll,
|
||||
// these values are always zero. Otherwise, remaining delta values which are
|
||||
|
@ -615,7 +609,6 @@ class WidgetWheelEvent : public WidgetMouseEventBase {
|
|||
mDeltaY = aEvent.mDeltaY;
|
||||
mDeltaZ = aEvent.mDeltaZ;
|
||||
mDeltaMode = aEvent.mDeltaMode;
|
||||
mScrollAmount = aEvent.mScrollAmount;
|
||||
mCustomizedByUserPrefs = aEvent.mCustomizedByUserPrefs;
|
||||
mMayHaveMomentum = aEvent.mMayHaveMomentum;
|
||||
mIsMomentum = aEvent.mIsMomentum;
|
||||
|
|
Загрузка…
Ссылка в новой задаче