Dispatch scroll wheel events through APZ on Gtk. (bug 1119743, r=nical)
authorDavid Anderson <danderson@mozilla.com>
Mon, 12 Jan 2015 19:45:10 -0800
changeset 223469 7e4b2f88f560bb9f296d0ac35c4e945438b29050
parent 223468 b5c6dd9423cf8830adf266c672ef550e83dc43f6
child 223470 0638060e5fbacd11a0ad4988d06211901c204893
push id28095
push usercbook@mozilla.com
push dateTue, 13 Jan 2015 13:24:48 +0000
treeherdermozilla-central@a5700bec72e1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1119743
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Dispatch scroll wheel events through APZ on Gtk. (bug 1119743, r=nical)
widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -118,16 +118,18 @@ extern "C" {
   
 #include "nsShmImage.h"
 
 #include "nsIDOMWheelEvent.h"
 
 #include "NativeKeyBindings.h"
 #include "nsWindow.h"
 
+#include "mozilla/layers/APZCTreeManager.h"
+
 using namespace mozilla;
 using namespace mozilla::gfx;
 using namespace mozilla::widget;
 using namespace mozilla::layers;
 using mozilla::gl::GLContext;
 
 // Don't put more than this many rects in the dirty region, just fluff
 // out to the bounding-box if there are more
@@ -3151,18 +3153,29 @@ nsWindow::OnScrollEvent(GdkEventScroll *
         wheelEvent.refPoint = point -
             LayoutDeviceIntPoint::FromUntyped(WidgetToScreenOffset());
     }
 
     KeymapWrapper::InitInputEvent(wheelEvent, aEvent->state);
 
     wheelEvent.time = aEvent->time;
 
-    nsEventStatus status;
-    DispatchEvent(&wheelEvent, status);
+    if (mAPZC) {
+        uint64_t inputBlockId = 0;
+        ScrollableLayerGuid guid;
+
+        nsEventStatus result = mAPZC->ReceiveInputEvent(*wheelEvent.AsWheelEvent(), &guid, &inputBlockId);
+        if (result == nsEventStatus_eConsumeNoDefault) {
+            return;
+        }
+        DispatchEventForAPZ(&wheelEvent, guid, inputBlockId);
+    } else {
+        nsEventStatus status;
+        DispatchEvent(&wheelEvent, status);
+    }
 }
 
 void
 nsWindow::OnVisibilityNotifyEvent(GdkEventVisibility *aEvent)
 {
     LOGDRAW(("Visibility event %i on [%p] %p\n",
              aEvent->state, this, aEvent->window));