Skip to content

Commit

Permalink
Backed out changeset 80c0c730e1aa (bug 1729894) for causing mochitest…
Browse files Browse the repository at this point in the history
… failures on browser_styleeditor_autocomplete.js. CLOSED TREE
  • Loading branch information
Marian-Vasile Laza committed Sep 13, 2021
1 parent 72115b2 commit fd405f7
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 26 deletions.
25 changes: 0 additions & 25 deletions devtools/shared/css/generated/properties-db.js
Original file line number Diff line number Diff line change
Expand Up @@ -3401,31 +3401,6 @@ exports.CSS_PROPERTIES = {
"unset"
]
},
"backdrop-filter": {
"isInherited": false,
"subproperties": [
"backdrop-filter"
],
"supports": [],
"values": [
"blur",
"brightness",
"contrast",
"drop-shadow",
"grayscale",
"hue-rotate",
"inherit",
"initial",
"invert",
"none",
"opacity",
"revert",
"saturate",
"sepia",
"unset",
"url"
]
},
"backface-visibility": {
"isInherited": false,
"subproperties": [
Expand Down
8 changes: 8 additions & 0 deletions gfx/thebes/gfxPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2518,6 +2518,11 @@ void gfxPlatform::InitWebRenderConfig() {
bool prefEnabled = WebRenderPrefEnabled();
bool envvarEnabled = WebRenderEnvvarEnabled();

// This would ideally be in the nsCSSProps code
// but nsCSSProps is initialized before gfxPlatform
// so it has to be done here.
gfxVars::AddReceiver(&nsCSSProps::GfxVarReceiver());

// WR? WR+ => means WR was enabled via gfx.webrender.all.qualified on
// qualified hardware
// WR! WR+ => means WR was enabled via gfx.webrender.{all,enabled} or
Expand All @@ -2532,6 +2537,9 @@ void gfxPlatform::InitWebRenderConfig() {
// later in this function. For other processes we still want to report
// the state of the feature for crash reports.
if (gfxVars::UseWebRender()) {
// gfxVars doesn't notify receivers when initialized on content processes
// we need to explicitly recompute backdrop-filter's enabled state here.
nsCSSProps::RecomputeEnabledState("layout.css.backdrop-filter.enabled");
reporter.SetSuccessful();
}
return;
Expand Down
40 changes: 40 additions & 0 deletions layout/style/nsCSSProps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ void nsCSSProps::RecomputeEnabledState(const char* aPref, void*) {
#else
gPropertyEnabled[pref->mPropID] = Preferences::GetBool(pref->mPref);
#endif
if (pref->mPropID == eCSSProperty_backdrop_filter) {
gPropertyEnabled[pref->mPropID] &=
gfx::gfxVars::GetUseWebRenderOrDefault();
}
}
}
MOZ_ASSERT(foundPref);
Expand Down Expand Up @@ -212,4 +216,40 @@ bool nsCSSProps::gPropertyEnabled[eCSSProperty_COUNT_with_aliases] = {
#undef IS_ENABLED_BY_DEFAULT
};

/**
* A singleton class to register as a receiver for gfxVars.
* Updates the state of backdrop-filter's pref if the gfx
* WebRender var changes state.
*/
class nsCSSPropsGfxVarReceiver final : public gfx::gfxVarReceiver {
constexpr nsCSSPropsGfxVarReceiver() = default;

// WebRender's last known enabled state.
static bool sLastKnownUseWebRender;
static nsCSSPropsGfxVarReceiver sInstance;

public:
static gfx::gfxVarReceiver& GetInstance() { return sInstance; }

void OnVarChanged(const gfx::GfxVarUpdate&) override {
bool enabled = gfxVars::UseWebRender();
if (sLastKnownUseWebRender != enabled) {
sLastKnownUseWebRender = enabled;
nsCSSProps::RecomputeEnabledState("layout.css.backdrop-filter.enabled");
}
}
};

/* static */
nsCSSPropsGfxVarReceiver nsCSSPropsGfxVarReceiver::sInstance =
nsCSSPropsGfxVarReceiver();

/* static */
bool nsCSSPropsGfxVarReceiver::sLastKnownUseWebRender = false;

/* static */
gfx::gfxVarReceiver& nsCSSProps::GfxVarReceiver() {
return nsCSSPropsGfxVarReceiver::GetInstance();
}

#include "nsCSSPropsGenerated.inc"
2 changes: 1 addition & 1 deletion modules/libpref/init/StaticPrefList.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6856,7 +6856,7 @@
# Is support for CSS backdrop-filter enabled?
- name: layout.css.backdrop-filter.enabled
type: bool
value: @IS_EARLY_BETA_OR_EARLIER@
value: false
mirror: always

# Should stray control characters be rendered visibly?
Expand Down

0 comments on commit fd405f7

Please sign in to comment.