Bug 1282306 - More correctly describe APZ touch support in about:support. r=botond a=gchang
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 10 Mar 2017 15:18:48 -0500
changeset 376801 9c9fb1e26d9ea07a451633db1409c4a944a364a6
parent 376800 362e22fa09a15d200fa4c1f0a2182b96bfc7e107
child 376802 505f5940b4a470d56dd7f0c08b3f1c9cc424116c
push id7044
push usercbook@mozilla.com
push dateThu, 16 Mar 2017 11:48:47 +0000
treeherdermozilla-beta@bc68e859eb66 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond, gchang
bugs1282306
milestone53.0
Bug 1282306 - More correctly describe APZ touch support in about:support. r=botond a=gchang Instead of just reporting the value of the pref, also make sure that about:support incorporates the runtime check of whether or not a touch device was discovered in the widget code. The code to do this already exists in TouchEvent::PrefEnabled, so we can just reuse that. MozReview-Commit-ID: DN7FSlsDwD1
gfx/thebes/gfxAndroidPlatform.h
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
gfx/thebes/gfxPlatformGtk.cpp
gfx/thebes/gfxPlatformGtk.h
gfx/thebes/gfxWindowsPlatform.cpp
gfx/thebes/gfxWindowsPlatform.h
gfx/thebes/moz.build
--- a/gfx/thebes/gfxAndroidPlatform.h
+++ b/gfx/thebes/gfxAndroidPlatform.h
@@ -61,20 +61,16 @@ public:
     FT_Library GetFTLibrary() override;
 
     virtual bool CanRenderContentToDataSurface() const override {
       return true;
     }
 
     virtual already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() override;
 
-    virtual bool SupportsApzTouchInput() const override {
-      return true;
-    }
-
 protected:
     bool AccelerateLayersByDefault() override {
       return true;
     }
 
 private:
     gfxImageFormat mOffscreenFormat;
 };
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -131,16 +131,17 @@ class mozilla::gl::SkiaGLGlue : public G
 
 #include "nsAlgorithm.h"
 #include "nsIGfxInfo.h"
 #include "nsIXULRuntime.h"
 #include "VsyncSource.h"
 #include "SoftwareVsyncSource.h"
 #include "nscore.h" // for NS_FREE_PERMANENT_DATA
 #include "mozilla/dom/ContentChild.h"
+#include "mozilla/dom/TouchEvent.h"
 #include "gfxVR.h"
 #include "VRManagerChild.h"
 #include "mozilla/gfx/GPUParent.h"
 #include "prsystem.h"
 
 namespace mozilla {
 namespace layers {
 void ShutdownTileCache();
@@ -2582,16 +2583,22 @@ void
 gfxPlatform::ImportGPUDeviceData(const mozilla::gfx::GPUDeviceData& aData)
 {
   MOZ_ASSERT(XRE_IsParentProcess());
 
   gfxConfig::ImportChange(Feature::OPENGL_COMPOSITING, aData.oglCompositing());
 }
 
 bool
+gfxPlatform::SupportsApzTouchInput() const
+{
+  return dom::TouchEvent::PrefEnabled(nullptr);
+}
+
+bool
 gfxPlatform::SupportsApzDragInput() const
 {
   return gfxPrefs::APZDragEnabled();
 }
 
 void
 gfxPlatform::BumpDeviceCounter()
 {
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -621,19 +621,17 @@ public:
     static int GetDefaultFrameRate();
 
     /**
      * Used to test which input types are handled via APZ.
      */
     virtual bool SupportsApzWheelInput() const {
       return false;
     }
-    virtual bool SupportsApzTouchInput() const {
-      return false;
-    }
+    bool SupportsApzTouchInput() const;
     bool SupportsApzDragInput() const;
 
     virtual void FlushContentDrawing() {}
 
     // If a device reset has occurred, schedule any necessary paints in the
     // widget. This should only be used within nsRefreshDriver.
     virtual void SchedulePaintIfDeviceReset() {}
 
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -901,16 +901,9 @@ gfxPlatformGtk::CreateHardwareVsyncSourc
       }
       return vsyncSource.forget();
     }
     NS_WARNING("SGI_video_sync unsupported. Falling back to software vsync.");
   }
   return gfxPlatform::CreateHardwareVsyncSource();
 }
 
-bool
-gfxPlatformGtk::SupportsApzTouchInput() const
-{
-  int value = gfxPrefs::TouchEventsEnabled();
-  return value == 1 || value == 2;
-}
-
 #endif
--- a/gfx/thebes/gfxPlatformGtk.h
+++ b/gfx/thebes/gfxPlatformGtk.h
@@ -118,18 +118,16 @@ public:
     bool UseImageOffscreenSurfaces();
 
     virtual gfxImageFormat GetOffscreenFormat() override;
 
     bool SupportsApzWheelInput() const override {
       return true;
     }
 
-    bool SupportsApzTouchInput() const override;
-
     void FontsPrefsChanged(const char *aPref) override;
 
     // maximum number of fonts to substitute for a generic
     uint32_t MaxGenericSubstitions();
 
     bool SupportsPluginDirectBitmapDrawing() override {
       return true;
     }
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -1960,23 +1960,16 @@ gfxWindowsPlatform::CreateHardwareVsyncS
     NS_WARNING("DWM not enabled, falling back to software vsync");
     return gfxPlatform::CreateHardwareVsyncSource();
   }
 
   RefPtr<VsyncSource> d3dVsyncSource = new D3DVsyncSource();
   return d3dVsyncSource.forget();
 }
 
-bool
-gfxWindowsPlatform::SupportsApzTouchInput() const
-{
-  int value = gfxPrefs::TouchEventsEnabled();
-  return value == 1 || value == 2;
-}
-
 void
 gfxWindowsPlatform::GetAcceleratedCompositorBackends(nsTArray<LayersBackend>& aBackends)
 {
   if (gfxConfig::IsEnabled(Feature::OPENGL_COMPOSITING) && gfxPrefs::LayersPreferOpenGL()) {
     aBackends.AppendElement(LayersBackend::LAYERS_OPENGL);
   }
 
   if (gfxConfig::IsEnabled(Feature::D3D9_COMPOSITING) && gfxPrefs::LayersPreferD3D9()) {
--- a/gfx/thebes/gfxWindowsPlatform.h
+++ b/gfx/thebes/gfxWindowsPlatform.h
@@ -210,17 +210,16 @@ public:
 
     mozilla::layers::ReadbackManagerD3D11* GetReadbackManager();
 
     static bool IsOptimus();
 
     bool SupportsApzWheelInput() const override {
       return true;
     }
-    bool SupportsApzTouchInput() const override;
 
     // Recreate devices as needed for a device reset. Returns true if a device
     // reset occurred.
     bool HandleDeviceReset();
     void UpdateBackendPrefs();
 
     virtual already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() override;
     static mozilla::Atomic<size_t> sD3D11SharedTextures;
--- a/gfx/thebes/moz.build
+++ b/gfx/thebes/moz.build
@@ -244,16 +244,17 @@ include('/ipc/chromium/chromium-config.m
 FINAL_LIBRARY = 'xul'
 
 GENERATED_FILES = [
     'DeprecatedPremultiplyTables.h',
 ]
 GENERATED_FILES['DeprecatedPremultiplyTables.h'].script = 'genTables.py:generate'
 
 LOCAL_INCLUDES += [
+    '/dom/base',
     '/dom/workers',
     '/dom/xml',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('android', 'gtk2', 'gtk3'):
     DEFINES['MOZ_ENABLE_FREETYPE'] = True
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':