Bug 737758: Part 2: Address Windows abnormality (identify _faked_ pixel scrolls) [r=jmathies]

This commit is contained in:
Avi Halachmi (:avih) 2012-03-26 13:34:10 +02:00
parent 8a2de1a907
commit d19ba25120
3 changed files with 16 additions and 5 deletions

View File

@ -3223,8 +3223,11 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
break;
case MOUSE_SCROLL_PIXELS:
DoScrollText(aTargetFrame, msEvent, nsIScrollableFrame::DEVICE_PIXELS,
false);
{
bool fromLines = msEvent->scrollFlags & nsMouseScrollEvent::kFromLines;
DoScrollText(aTargetFrame, msEvent, nsIScrollableFrame::DEVICE_PIXELS,
false, nsnull, (fromLines ? nsGkAtoms::mouseWheel : nsnull));
}
break;
case MOUSE_SCROLL_HISTORY:

View File

@ -1284,9 +1284,14 @@ public:
kIsMomentum = 1 << 6, // Marks scroll events that aren't controlled by the
// user but fire automatically as the result of a
// "momentum" scroll.
kAllowSmoothScroll = 1 << 7 // Allow smooth scroll for the pixel scroll
// event.
};
kAllowSmoothScroll = 1 << 7, // Allow smooth scroll for the pixel scroll
// event.
kFromLines = 1 << 8 // For a pixels scroll event, indicates that it
// originated from a lines scroll event.
// (Only used on windows which generates "faked"
// pixel scroll events even for simple mouse wheel
// scroll)
};
nsMouseScrollEvent(bool isTrusted, PRUint32 msg, nsIWidget *w)
: nsMouseEvent_base(isTrusted, msg, w, NS_MOUSE_SCROLL_EVENT),

View File

@ -698,12 +698,14 @@ MouseScrollHandler::HandleMouseWheelMessage(nsWindow* aWindow,
// Grab the widget, it might be destroyed by a DOM event handler.
nsRefPtr<nsWindow> kungFuDethGrip(aWindow);
bool fromLines = false;
nsMouseScrollEvent scrollEvent(true, NS_MOUSE_SCROLL, aWindow);
if (mLastEventInfo.InitMouseScrollEvent(aWindow, scrollEvent,
scrollTargetInfo, modKeyState)) {
PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS,
("MouseScroll::HandleMouseWheelMessage: dispatching "
"NS_MOUSE_SCROLL event"));
fromLines = true;
DispatchEvent(aWindow, scrollEvent);
if (aWindow->Destroyed()) {
PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS,
@ -727,6 +729,7 @@ MouseScrollHandler::HandleMouseWheelMessage(nsWindow* aWindow,
PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS,
("MouseScroll::HandleMouseWheelMessage: dispatching "
"NS_MOUSE_PIXEL_SCROLL event"));
pixelEvent.scrollFlags |= fromLines ? nsMouseScrollEvent::kFromLines : 0;
DispatchEvent(aWindow, pixelEvent);
if (aWindow->Destroyed()) {
PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS,