Bug 1446724 - Lets plugins still receive original delta values instead of horizontalized values if the default action for wheel scrolling is horizontalizing vertical wheel scrolling. r=masayuki

Unlike a DOM wheel event listeners which receive original delta values, plugins
receive horizontalized ones. It's not reasonable to not send original values to
plugins.

Plugin developers can do any delta adjustment, and they are also capable of
DIRECTLY getting what inputs the user is manipulating, that is to say,
developers can horizontalize scrolling for [Shift+Vertical Wheel] or other other
inputs if they want, it's just their matter; conversely, they aren't capable of
getting what delta adjustment their upstream has already encapsulated for them.
So it's not reasonable to send adjusted delta values to plugins.

This patch restores horizontalized delta values to the original for plugins.

MozReview-Commit-ID: IX8XJn0lbKq

--HG--
extra : rebase_source : ea9abef4706701e2c43ee06563bd10bc0a863614
This commit is contained in:
Zhang Junzhi 2018-03-19 13:50:49 +08:00
Родитель df1a0e7203
Коммит 6f951120b1
3 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -3379,6 +3379,8 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
nsPluginFrame* pluginFrame = do_QueryFrame(frameToScroll);
if (pluginFrame) {
MOZ_ASSERT(pluginFrame->WantsToHandleWheelEventAsDefaultAction());
// Plugins should receive original values instead of adjusted values.
adjuster.CancelAdjustment();
action = WheelPrefs::ACTION_SEND_TO_PLUGIN;
}

Просмотреть файл

@ -610,7 +610,7 @@ AutoWheelDeltaAdjuster::AutoWheelDeltaAdjuster(WidgetWheelEvent& aWheelEvent)
}
}
AutoWheelDeltaAdjuster::~AutoWheelDeltaAdjuster()
void AutoWheelDeltaAdjuster::CancelAdjustment()
{
if (mTreatedVerticalWheelAsHorizontalScroll &&
mWheelEvent.mDeltaValuesAdjustedForDefaultHandler) {
@ -622,7 +622,13 @@ AutoWheelDeltaAdjuster::~AutoWheelDeltaAdjuster()
mWheelEvent.mLineOrPageDeltaY = mWheelEvent.mLineOrPageDeltaX;
mWheelEvent.mLineOrPageDeltaX = mOldLineOrPageDeltaX;
mWheelEvent.mDeltaValuesAdjustedForDefaultHandler = false;
mTreatedVerticalWheelAsHorizontalScroll = false;
}
}
AutoWheelDeltaAdjuster::~AutoWheelDeltaAdjuster()
{
CancelAdjustment();
}
} // namespace mozilla

Просмотреть файл

@ -229,6 +229,7 @@ public:
*/
explicit AutoWheelDeltaAdjuster(WidgetWheelEvent& aWheelEvent);
~AutoWheelDeltaAdjuster();
void CancelAdjustment();
private:
WidgetWheelEvent& mWheelEvent;