Bug 1282306 - More correctly describe APZ touch support in about:support. r?botond
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
--- 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
@@ -132,16 +132,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();
@@ -2640,16 +2641,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::InitOpenGLConfig()
{
--- 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
@@ -904,16 +904,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
@@ -1879,23 +1879,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::D3D11_COMPOSITING)) {
--- a/gfx/thebes/gfxWindowsPlatform.h
+++ b/gfx/thebes/gfxWindowsPlatform.h
@@ -204,17 +204,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
@@ -243,16 +243,17 @@ if CONFIG['ENABLE_INTL_API']:
'icu',
]
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
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':