Bug 1794722 - Part 3. Remove all uses of GfxInfo::GetWebRenderEnabled. r=jrmuizel,webcompat-reviewers,twisniewski

This is always true.

Differential Revision: https://phabricator.services.mozilla.com/D160122
This commit is contained in:
Andrew Osmond 2022-10-28 12:36:06 +00:00
parent 9d245b8325
commit 77b6b3ccc7
16 changed files with 80 additions and 212 deletions

View File

@ -9,19 +9,6 @@
*/
add_task(async function() {
const isWebRenderEnabled = Services.prefs.getBoolPref("gfx.webrender.all");
const isFissionEnabled = SpecialPowers.useRemoteSubframes;
if (isFissionEnabled && !isWebRenderEnabled) {
// This configuration is not supported.
// Also, in this specific configuration, we're displaying a warning, which looks like a flicker.
// Deactivating test.
ok(
true,
"Detected Fission without WebRender. Flicker expected, deactivating flicker test"
);
return;
}
let startupRecorder = Cc["@mozilla.org/test/startuprecorder;1"].getService()
.wrappedJSObject;
await startupRecorder.done;

View File

@ -13,13 +13,6 @@ function isTelemetryEnabled() {
);
}
function isWebRenderEnabled() {
return (
Services.prefs.getBoolPref("gfx.webrender.all", false) ||
Services.prefs.getBoolPref("gfx.webrender.enabled", false)
);
}
this.browserInfo = class extends ExtensionAPI {
getAPI(context) {
return {

View File

@ -3,7 +3,7 @@
"name": "WebCompat Reporter",
"description": "Report site compatibility issues on webcompat.com",
"author": "Thomas Wisniewski <twisniewski@mozilla.com>",
"version": "1.5.0",
"version": "1.5.1",
"homepage_url": "https://github.com/mozilla/webcompat-reporter",
"applications": {
"gecko": {

View File

@ -5,10 +5,6 @@
/* global openSimulationMenu, toggleSimulationOption */
const {
isWebRenderEnabled,
} = require("resource://devtools/server/actors/utils/accessibility.js");
const TEST_URI = `<html>
<head>
<meta charset="utf-8"/>
@ -24,97 +20,84 @@ const TEST_URI = `<html>
</body>
</html>`;
if (!isWebRenderEnabled(window)) {
addA11YPanelTask(
"Test that simulation menu button does not exist without WebRender.",
TEST_URI,
async function({ doc }) {
ok(
!doc.querySelector("#simulation-menu-button"),
"Simulation menu is not shown without WebRender."
);
}
);
} else {
/**
* Test data has the format of:
* {
* desc {String} description for better logging
* setup {Function} An optional setup that needs to be performed before
* the state of the simulation components can be checked.
* expected {JSON} An expected states for the simulation components.
* }
*/
const tests = [
{
desc:
"Check that the menu button is inactivate and the menu is closed initially.",
expected: {
simulation: {
buttonActive: false,
},
/**
* Test data has the format of:
* {
* desc {String} description for better logging
* setup {Function} An optional setup that needs to be performed before
* the state of the simulation components can be checked.
* expected {JSON} An expected states for the simulation components.
* }
*/
const tests = [
{
desc:
"Check that the menu button is inactivate and the menu is closed initially.",
expected: {
simulation: {
buttonActive: false,
},
},
{
desc:
"Clicking the menu button shows the menu with No Simulation selected.",
setup: async ({ doc }) => {
await openSimulationMenu(doc);
},
expected: {
simulation: {
buttonActive: false,
checkedOptionIndices: [0],
},
},
{
desc:
"Clicking the menu button shows the menu with No Simulation selected.",
setup: async ({ doc }) => {
await openSimulationMenu(doc);
},
expected: {
simulation: {
buttonActive: false,
checkedOptionIndices: [0],
},
},
{
desc:
"Selecting an option renders the menu button active and closes the menu.",
setup: async ({ doc }) => {
await toggleSimulationOption(doc, 2);
},
expected: {
simulation: {
buttonActive: true,
checkedOptionIndices: [2],
},
},
{
desc:
"Selecting an option renders the menu button active and closes the menu.",
setup: async ({ doc }) => {
await toggleSimulationOption(doc, 2);
},
expected: {
simulation: {
buttonActive: true,
checkedOptionIndices: [2],
},
},
{
desc: "Reopening the menu preserves the previously selected option.",
setup: async ({ doc }) => {
await openSimulationMenu(doc);
},
expected: {
simulation: {
buttonActive: true,
checkedOptionIndices: [2],
},
},
{
desc: "Reopening the menu preserves the previously selected option.",
setup: async ({ doc }) => {
await openSimulationMenu(doc);
},
expected: {
simulation: {
buttonActive: true,
checkedOptionIndices: [2],
},
},
{
desc:
"Unselecting the option renders the button inactive and closes the menu.",
setup: async ({ doc }) => {
await toggleSimulationOption(doc, 2);
},
expected: {
simulation: {
buttonActive: false,
checkedOptionIndices: [0],
},
},
{
desc:
"Unselecting the option renders the button inactive and closes the menu.",
setup: async ({ doc }) => {
await toggleSimulationOption(doc, 2);
},
expected: {
simulation: {
buttonActive: false,
checkedOptionIndices: [0],
},
},
];
},
];
/**
* Test that checks state of simulation button and menu when
* options are selected/unselected with web render enabled.
*/
addA11yPanelTestsTask(
tests,
TEST_URI,
"Test selecting and unselecting simulation options updates UI."
);
}
/**
* Test that checks state of simulation button and menu when
* options are selected/unselected with web render enabled.
*/
addA11yPanelTestsTask(
tests,
TEST_URI,
"Test selecting and unselecting simulation options updates UI."
);

View File

@ -24,12 +24,6 @@ loader.lazyRequireGetter(
"resource://devtools/server/actors/accessibility/simulator.js",
true
);
loader.lazyRequireGetter(
this,
"isWebRenderEnabled",
"resource://devtools/server/actors/utils/accessibility.js",
true
);
/**
* The AccessibilityActor is a top level container actor that initializes
@ -116,11 +110,6 @@ const AccessibilityActor = ActorClassWithSpec(accessibilitySpec, {
* SimulatorActor for the current tab.
*/
getSimulator() {
// TODO: Remove this check after Bug1570667
if (!isWebRenderEnabled(this.targetActor.window)) {
return null;
}
if (!this.simulator) {
this.simulator = new SimulatorActor(this.conn, this.targetActor);
this.manage(this.simulator);

View File

@ -75,26 +75,6 @@ function removeSheetForBackgroundCalculation(win) {
removeSheet(win, HIGHLIGHTER_STYLES_SHEET);
}
/**
* Helper function that determines if web render is enabled.
*
* @param {Window} win
* Window to be tested.
* @return {Boolean}
* True if web render is enabled, false otherwise.
*/
function isWebRenderEnabled(win) {
try {
return win.windowUtils && win.windowUtils.layerManagerType === "WebRender";
} catch (e) {
// Sometimes nsIDOMWindowUtils::layerManagerType fails unexpectedly (see bug
// 1596428).
console.warn(e);
}
return false;
}
/**
* Get role attribute for an accessible object if specified for its
* corresponding DOMNode.
@ -118,6 +98,5 @@ function getAriaRoles(accessible) {
exports.getAriaRoles = getAriaRoles;
exports.isDefunct = isDefunct;
exports.isWebRenderEnabled = isWebRenderEnabled;
exports.loadSheetForBackgroundCalculation = loadSheetForBackgroundCalculation;
exports.removeSheetForBackgroundCalculation = removeSheetForBackgroundCalculation;

View File

@ -4,13 +4,6 @@
"use strict";
loader.lazyRequireGetter(
this,
"isWebRenderEnabled",
"resource://devtools/server/actors/utils/accessibility.js",
true
);
const PREF_ACCESSIBILITY_FORCE_DISABLED = "accessibility.force_disabled";
function checkAccessibilityState(accessibility, parentAccessibility, expected) {
@ -48,20 +41,12 @@ add_task(async function() {
);
const a11ySimulator = accessibility.simulatorFront;
const webRenderEnabled = isWebRenderEnabled(window);
ok(accessibility.simulatorFront, "Accessible simulator was initialized");
is(
!!a11ySimulator,
webRenderEnabled,
`The SimulatorFront was${webRenderEnabled ? "" : " not"} returned.`
a11ySimulator,
accessibility.simulatorFront,
"The SimulatorFront was returned"
);
if (webRenderEnabled) {
ok(accessibility.simulatorFront, "Accessible simulator was initialized");
is(
a11ySimulator,
accessibility.simulatorFront,
"The SimulatorFront was returned"
);
}
checkAccessibilityState(accessibility, parentAccessibility, {
enabled: false,

View File

@ -4,13 +4,6 @@
"use strict";
loader.lazyRequireGetter(
this,
"isWebRenderEnabled",
"resource://devtools/server/actors/utils/accessibility.js",
true
);
const {
accessibility: {
SIMULATION_TYPE: { PROTANOPIA },
@ -77,11 +70,8 @@ add_task(async function() {
);
const simulator = accessibility.simulatorFront;
if (!simulator) {
ok(!isWebRenderEnabled(window), "Web render is disabled.");
// If web render is disabled, we can't test the simulator actor, so return early
ok(false, "Missing simulator actor.");
return;
}

View File

@ -145,9 +145,6 @@ class MockGfxInfo final : public nsIGfxInfo {
NS_IMETHOD GetUsingGPUProcess(bool* aOutValue) override {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD GetWebRenderEnabled(bool* aWebRenderEnabled) override {
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHOD GetIsHeadless(bool* aIsHeadless) override {
return NS_ERROR_NOT_IMPLEMENTED;
}

View File

@ -32,19 +32,6 @@ function IsCSSPropertyPrefEnabled(prefName) {
return false;
}
// Returns true if WebRender is enabled. Otherwise, returns false
function IsWebRenderEnabled() {
try {
return SpecialPowers.Cc["@mozilla.org/gfx/info;1"].getService(
SpecialPowers.Ci.nsIGfxInfo
).WebRenderEnabled;
} catch (ex) {
ok(false, "Failed to check WebRender's enabled state");
}
return false;
}
// True longhand properties.
const CSS_TYPE_LONGHAND = 0;
@ -13510,10 +13497,7 @@ if (IsCSSPropertyPrefEnabled("layout.css.linear-easing-function.enabled")) {
);
}
if (
IsCSSPropertyPrefEnabled("layout.css.backdrop-filter.enabled") &&
IsWebRenderEnabled()
) {
if (IsCSSPropertyPrefEnabled("layout.css.backdrop-filter.enabled")) {
gCSSProperties["backdrop-filter"] = {
domProp: "backdropFilter",
inherited: false,

View File

@ -8,15 +8,11 @@
<script>
SimpleTest.waitForExplicitFinish();
const webRenderEnabled = SpecialPowers.Cc["@mozilla.org/gfx/info;1"].getService(
SpecialPowers.Ci.nsIGfxInfo
).WebRenderEnabled;
(async function() {
for (let enabled of [true, false]) {
await SpecialPowers.pushPrefEnv({"set": [["layout.css.backdrop-filter.enabled", enabled]]});
is(webRenderEnabled && enabled, CSS.supports("backdrop-filter: initial"),
"backdrop-filter is available only if backdrop-filter pref is set and WebRender is enabled");
is(enabled, CSS.supports("backdrop-filter: initial"),
"backdrop-filter is available only if backdrop-filter pref is set");
}
SimpleTest.finish();
}());

View File

@ -33,11 +33,8 @@
for (var idx in gLonghandProperties) {
var prop = gLonghandProperties[idx];
const webRenderEnabled = IsWebRenderEnabled();
if (prop.pref && !IsCSSPropertyPrefEnabled(prop.pref)) {
continue;
} else if (prop.name === "backdrop-filter" && !webRenderEnabled) {
continue;
}
var present = prop.name in gCSSProperties;
ok(present,
@ -53,8 +50,6 @@ for (var idx in gShorthandProperties) {
var prop = gShorthandProperties[idx];
if (prop.pref && !IsCSSPropertyPrefEnabled(prop.pref)) {
continue;
} else if (prop.name === "backdrop-filter" && !webRenderEnabled) {
continue;
}
if (prop.name == "all") {
// "all" isn't listed in property_database.js.
@ -76,8 +71,6 @@ for (var idx in gShorthandPropertiesLikeLonghand) {
var prop = gShorthandPropertiesLikeLonghand[idx];
if (prop.pref && !IsCSSPropertyPrefEnabled(prop.pref)) {
continue;
} else if (prop.name === "backdrop-filter" && !webRenderEnabled) {
continue;
}
var present = prop.name in gCSSProperties;
ok(present,

View File

@ -352,7 +352,7 @@ var supported_properties = {
],
};
if (IsCSSPropertyPrefEnabled("layout.css.backdrop-filter.enabled") && IsWebRenderEnabled()) {
if (IsCSSPropertyPrefEnabled("layout.css.backdrop-filter.enabled")) {
supported_properties["backdrop-filter"] = [ test_filter_transition ];
}

View File

@ -1838,12 +1838,6 @@ nsresult GfxInfoBase::GetActiveCrashGuards(JSContext* aCx,
return NS_OK;
}
NS_IMETHODIMP
GfxInfoBase::GetWebRenderEnabled(bool* aWebRenderEnabled) {
*aWebRenderEnabled = true;
return NS_OK;
}
NS_IMETHODIMP
GfxInfoBase::GetTargetFrameRate(uint32_t* aTargetFrameRate) {
*aTargetFrameRate = gfxPlatform::TargetFrameRate();

View File

@ -68,7 +68,6 @@ class GfxInfoBase : public nsIGfxInfo,
NS_IMETHOD GetAzureCanvasBackend(nsAString& aBackend) override;
NS_IMETHOD GetAzureContentBackend(nsAString& aBackend) override;
NS_IMETHOD GetUsingGPUProcess(bool* aOutValue) override;
NS_IMETHOD GetWebRenderEnabled(bool* aWebRenderEnabled) override;
NS_IMETHOD GetIsHeadless(bool* aIsHeadless) override;
NS_IMETHOD GetTargetFrameRate(uint32_t* aTargetFrameRate) override;
NS_IMETHOD GetCodecSupportInfo(nsACString& aCodecSupportInfo) override;

View File

@ -34,7 +34,6 @@ interface nsIGfxInfo : nsISupports
* These are valid across all platforms.
*/
readonly attribute AString ContentBackend;
readonly attribute boolean WebRenderEnabled;
readonly attribute boolean isHeadless;
readonly attribute unsigned long TargetFrameRate;
readonly attribute ACString CodecSupportInfo;