Add APZ info to about:support. (bug 1146727, r=jrmuizel)
This commit is contained in:
@@ -96,6 +96,10 @@ public:
|
||||
virtual bool IsInGonkEmulator() const { return mIsInGonkEmulator; }
|
||||
#endif
|
||||
|
||||
virtual bool SupportsApzTouchInput() override {
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
int mScreenDepth;
|
||||
gfxImageFormat mOffscreenFormat;
|
||||
|
||||
@@ -384,6 +384,7 @@ gfxPlatform::gfxPlatform()
|
||||
: mTileWidth(-1)
|
||||
, mTileHeight(-1)
|
||||
, mAzureCanvasBackendCollector(this, &gfxPlatform::GetAzureBackendInfo)
|
||||
, mApzSupportCollector(this, &gfxPlatform::GetApzSupportInfo)
|
||||
{
|
||||
mAllowDownloadableFonts = UNINITIALIZED_VALUE;
|
||||
mFallbackUsesCmaps = UNINITIALIZED_VALUE;
|
||||
@@ -2329,3 +2330,42 @@ gfxPlatform::IsInLayoutAsapMode()
|
||||
return Preferences::GetInt("layout.frame_rate", -1) == 0;
|
||||
}
|
||||
|
||||
void
|
||||
gfxPlatform::GetApzSupportInfo(mozilla::widget::InfoObject& aObj)
|
||||
{
|
||||
if (SupportsApzWheelInput()) {
|
||||
static const char *sBadPrefs[] = {
|
||||
"mousewheel.system_scroll_override_on_root_content.enabled",
|
||||
"mousewheel.default.delta_multiplier_x",
|
||||
"mousewheel.with_alt.delta_multiplier_x",
|
||||
"mousewheel.with_alt.delta_multiplier_x",
|
||||
"mousewheel.with_control.delta_multiplier_x",
|
||||
"mousewheel.with_meta.delta_multiplier_x",
|
||||
"mousewheel.with_shift.delta_multiplier_x",
|
||||
"mousewheel.with_win.delta_multiplier_x",
|
||||
"mousewheel.with_alt.delta_multiplier_y",
|
||||
"mousewheel.with_control.delta_multiplier_y",
|
||||
"mousewheel.with_meta.delta_multiplier_y",
|
||||
"mousewheel.with_shift.delta_multiplier_y",
|
||||
"mousewheel.with_win.delta_multiplier_y",
|
||||
};
|
||||
|
||||
nsString badPref;
|
||||
for (size_t i = 0; i < MOZ_ARRAY_LENGTH(sBadPrefs); i++) {
|
||||
if (Preferences::HasUserValue(sBadPrefs[i])) {
|
||||
badPref.AssignASCII(sBadPrefs[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
aObj.DefineProperty("ApzWheelInput", 1);
|
||||
if (badPref.Length()) {
|
||||
aObj.DefineProperty("ApzWheelInputWarning", badPref);
|
||||
}
|
||||
}
|
||||
|
||||
if (SupportsApzTouchInput()) {
|
||||
aObj.DefineProperty("ApzTouchInput", 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -296,6 +296,7 @@ public:
|
||||
aObj.DefineProperty("AzureFallbackCanvasBackend", GetBackendName(mFallbackCanvasBackend));
|
||||
aObj.DefineProperty("AzureContentBackend", GetBackendName(mContentBackend));
|
||||
}
|
||||
void GetApzSupportInfo(mozilla::widget::InfoObject& aObj);
|
||||
|
||||
mozilla::gfx::BackendType GetContentBackend() {
|
||||
return mContentBackend;
|
||||
@@ -616,6 +617,16 @@ public:
|
||||
*/
|
||||
static bool IsInLayoutAsapMode();
|
||||
|
||||
/**
|
||||
* Used to test which input types are handled via APZ.
|
||||
*/
|
||||
virtual bool SupportsApzWheelInput() {
|
||||
return false;
|
||||
}
|
||||
virtual bool SupportsApzTouchInput() {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
gfxPlatform();
|
||||
virtual ~gfxPlatform();
|
||||
@@ -730,6 +741,7 @@ private:
|
||||
int mTileHeight;
|
||||
|
||||
mozilla::widget::GfxInfoCollector<gfxPlatform> mAzureCanvasBackendCollector;
|
||||
mozilla::widget::GfxInfoCollector<gfxPlatform> mApzSupportCollector;
|
||||
|
||||
mozilla::RefPtr<mozilla::gfx::DrawEventRecorder> mRecorder;
|
||||
mozilla::RefPtr<mozilla::gl::SkiaGLGlue> mSkiaGlue;
|
||||
|
||||
@@ -110,6 +110,10 @@ public:
|
||||
|
||||
virtual int GetScreenDepth() const override;
|
||||
|
||||
bool SupportsApzWheelInput() override {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
static gfxFontconfigUtils *sFontconfigUtils;
|
||||
|
||||
|
||||
@@ -2164,3 +2164,10 @@ gfxWindowsPlatform::CreateHardwareVsyncSource()
|
||||
nsRefPtr<VsyncSource> d3dVsyncSource = new D3DVsyncSource();
|
||||
return d3dVsyncSource.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
gfxWindowsPlatform::SupportsApzTouchInput()
|
||||
{
|
||||
int value = Preferences::GetInt("dom.w3c_touch_events.enabled", 0);
|
||||
return value == 1 || value == 2;
|
||||
}
|
||||
|
||||
@@ -254,6 +254,11 @@ public:
|
||||
|
||||
bool IsWARP() { return mIsWARP; }
|
||||
|
||||
bool SupportsApzWheelInput() override {
|
||||
return true;
|
||||
}
|
||||
bool SupportsApzTouchInput() override;
|
||||
|
||||
virtual already_AddRefed<mozilla::gfx::VsyncSource> CreateHardwareVsyncSource() override;
|
||||
static mozilla::Atomic<size_t> sD3D11MemoryUsed;
|
||||
static mozilla::Atomic<size_t> sD3D9MemoryUsed;
|
||||
|
||||
@@ -168,8 +168,65 @@ let snapshotFormatters = {
|
||||
},
|
||||
|
||||
graphics: function graphics(data) {
|
||||
let strings = stringBundle();
|
||||
|
||||
function localizedMsg(msgArray) {
|
||||
let nameOrMsg = msgArray.shift();
|
||||
if (msgArray.length) {
|
||||
// formatStringFromName logs an NS_ASSERTION failure otherwise that says
|
||||
// "use GetStringFromName". Lame.
|
||||
try {
|
||||
return strings.formatStringFromName(nameOrMsg, msgArray,
|
||||
msgArray.length);
|
||||
}
|
||||
catch (err) {
|
||||
// Throws if nameOrMsg is not a name in the bundle. This shouldn't
|
||||
// actually happen though, since msgArray.length > 1 => nameOrMsg is a
|
||||
// name in the bundle, not a message, and the remaining msgArray
|
||||
// elements are parameters.
|
||||
return nameOrMsg;
|
||||
}
|
||||
}
|
||||
try {
|
||||
return strings.GetStringFromName(nameOrMsg);
|
||||
}
|
||||
catch (err) {
|
||||
// Throws if nameOrMsg is not a name in the bundle.
|
||||
}
|
||||
return nameOrMsg;
|
||||
}
|
||||
|
||||
// Read APZ info out of data.info, stripping it out in the process.
|
||||
let apzInfo = [];
|
||||
let formatApzInfo = function (info) {
|
||||
let out = [];
|
||||
for (let type of ['Wheel', 'Touch']) {
|
||||
let key = 'Apz' + type + 'Input';
|
||||
let warningKey = key + 'Warning';
|
||||
|
||||
if (!(key in info))
|
||||
continue;
|
||||
|
||||
let badPref = info[warningKey];
|
||||
delete info[key];
|
||||
delete info[warningKey];
|
||||
|
||||
let message;
|
||||
if (badPref)
|
||||
message = localizedMsg([type.toLowerCase() + 'Warning', badPref]);
|
||||
else
|
||||
message = localizedMsg([type.toLowerCase() + 'Enabled']);
|
||||
dump(message + ', ' + (type.toLowerCase() + 'Warning') + ', ' + badPref + '\n');
|
||||
out.push(message);
|
||||
}
|
||||
|
||||
return out;
|
||||
};
|
||||
|
||||
// graphics-info-properties tbody
|
||||
if ("info" in data) {
|
||||
apzInfo = formatApzInfo(data.info);
|
||||
|
||||
let trs = sortedArrayFromObject(data.info).map(function ([prop, val]) {
|
||||
return $.new("tr", [
|
||||
$.new("th", prop, "column"),
|
||||
@@ -212,34 +269,12 @@ let snapshotFormatters = {
|
||||
|
||||
// graphics-tbody tbody
|
||||
|
||||
function localizedMsg(msgArray) {
|
||||
let nameOrMsg = msgArray.shift();
|
||||
if (msgArray.length) {
|
||||
// formatStringFromName logs an NS_ASSERTION failure otherwise that says
|
||||
// "use GetStringFromName". Lame.
|
||||
try {
|
||||
return strings.formatStringFromName(nameOrMsg, msgArray,
|
||||
msgArray.length);
|
||||
}
|
||||
catch (err) {
|
||||
// Throws if nameOrMsg is not a name in the bundle. This shouldn't
|
||||
// actually happen though, since msgArray.length > 1 => nameOrMsg is a
|
||||
// name in the bundle, not a message, and the remaining msgArray
|
||||
// elements are parameters.
|
||||
return nameOrMsg;
|
||||
}
|
||||
}
|
||||
try {
|
||||
return strings.GetStringFromName(nameOrMsg);
|
||||
}
|
||||
catch (err) {
|
||||
// Throws if nameOrMsg is not a name in the bundle.
|
||||
}
|
||||
return nameOrMsg;
|
||||
}
|
||||
|
||||
let out = Object.create(data);
|
||||
let strings = stringBundle();
|
||||
|
||||
if (apzInfo.length == 0)
|
||||
out.asyncPanZoom = "none";
|
||||
else
|
||||
out.asyncPanZoom = apzInfo.join("; ");
|
||||
|
||||
out.acceleratedWindows =
|
||||
data.numAcceleratedWindows + "/" + data.numTotalWindows;
|
||||
|
||||
@@ -94,3 +94,11 @@ canSandboxMedia = Media Plugin Sandboxing
|
||||
# of windows, respectively, while %3$S will indicate whether windows are remote by default ('true'
|
||||
# or 'false')
|
||||
multiProcessStatus = %1$S/%2$S (default: %3$S)
|
||||
|
||||
asyncPanZoom = Asynchronous Pan/Zoom
|
||||
wheelEnabled = wheel input enabled
|
||||
touchEnabled = touch input enabled
|
||||
|
||||
# LOCALIZATION NOTE %1 will be replaced with the key of a preference.
|
||||
wheelWarning = async wheel input disabled due to unsupported pref: %S
|
||||
touchWarning = async touch input disabled due to unsupported pref: %S
|
||||
|
||||
Reference in New Issue
Block a user