Skip to content

Commit

Permalink
Bug 1865332 - Expose MozTransform in CSSStyleDeclaration unconditiona…
Browse files Browse the repository at this point in the history
…lly. r=jwatt

Shipping CSS zoom requires to remove -moz-transform from stylesheets.
That's generally fine, however we've seen a bunch of regressions due to
sites doing broken feature detection in JS (see bugs mentioned in the
patch).

It seems like exposing MozTransform in CSSStyleDeclaration is a
requirement, for some large amount of pages. The hypothesis here is that
setting both MozTransform and zoom using JS is uncommon.

We could expose it conditionally, with some sort of reverse origin trial
or what not but, given the amount of regressions only on Nightly and
that this is harmless if you do proper feature detection, I think I'd
rather expose it unconditionally, rather than playing whack-a-mole
fixing pages after the fact. We could play whack-a-mole with pages that
use zoom and -moz-transform, if needed in the future, which seems like a
safer path forward.

Note that this change currently only affects behavior on Nightly,
because on other release channels -moz-transform is enabled right now.

Differential Revision: https://phabricator.services.mozilla.com/D194006
  • Loading branch information
emilio committed Nov 19, 2023
1 parent 0fbcd96 commit 5bbdc56
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dom/bindings/GenerateCSS2PropertiesWebIDL.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ def generate(output, idlFilename, dataFile):
# a function instead of checking the pref directly.
if p.method == "BackdropFilter":
extendedAttrs.append('Func="nsCSSProps::IsBackdropFilterAvailable"')
else:
# MozTransform accessor is generated regardless, for compatibility,
# see bug 1861828, 1865332, 1860424, 1864970, 1865332.
elif p.method != "MozTransform":
extendedAttrs.append('Pref="%s"' % p.pref)

def add_extra_accessors(p):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<title>CSS Test: MozTransform exists in Gecko for compat reasons</title>
<meta charset="utf-8">
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:[email protected]">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
let el = document.documentElement;
assert_true("MozTransform" in el.style, "MozTransform exists");
el.style.MozTransform = "scale(1)";
assert_not_equals(el.MozTransform, "", "MozTransform sets the value");
assert_equals(el.transform, el.MozTransform, "MozTransform is an alias of transform");
});
</script>

0 comments on commit 5bbdc56

Please sign in to comment.