Bug 1865332 - Expose MozTransform in CSSStyleDeclaration unconditionally. 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
This commit is contained in:
Emilio Cobos Álvarez 2023-11-20 12:41:57 +00:00
parent f27edbd417
commit 1c1ea1a92c
3 changed files with 21 additions and 2 deletions

View File

@ -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):

View File

@ -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:emilio@crisal.io">
<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>

View File

@ -85,7 +85,9 @@ const properties = [
"-moz-tab-size",
"-moz-text-align-last",
"-moz-text-size-adjust",
"-moz-transform",
// No -moz-transform here, because it might intentionally break the
// expectations of this test for compat reasons, see:
// https://bugzilla.mozilla.org/show_bug.cgi?id=1865332
"-moz-transform-origin",
"-moz-transform-style",
"-moz-transition",