Implement CSSStyleProperties and other recent CSSOM changes
Categories
(Core :: DOM: CSS Object Model, task, P2)
Tracking
()
People
(Reporter: emilio, Assigned: saschanaz)
References
(Depends on 1 open bug)
Details
(Keywords: dev-doc-complete)
Attachments
(1 file)
That is, the stuff in https://github.com/w3c/csswg-drafts/pull/9686 and co.
Updated•1 year ago
|
| Assignee | ||
Comment 1•8 months ago
|
||
Implement CSSStyleProperties
Is this as simple as renaming CSS2Properties to CSSStyleProperties?
| Reporter | ||
Comment 2•8 months ago
|
||
I think mostly, yueah
| Assignee | ||
Comment 3•8 months ago
|
||
Updated•8 months ago
|
| Assignee | ||
Comment 4•8 months ago
•
|
||
Hi Andreas, we are renaming an existing interface CSS2Properties here, do we have a good reason that this would break addons? Are there many addons that specifically reference CSS2Properties?
| Assignee | ||
Comment 5•8 months ago
|
||
Similar question for devtools, although I think devtools complains if the browser version doesn't match for remote debugging? Would devtools get any problem by this renaming?
Comment 6•8 months ago
|
||
(In reply to Kagami Rosylight [:saschanaz] (they/them) from comment #5)
Similar question for devtools, although I think devtools complains if the browser version doesn't match for remote debugging? Would devtools get any problem by this renaming?
we do try to maintain client backward compatibility for server on version N-2 https://firefox-source-docs.mozilla.org/devtools/backend/backward-compatibility.html
But looking at your patch, the change in DevTools is on the server, so we shouldn't have issue with backward compatibility here
Comment 7•8 months ago
|
||
(In reply to Kagami Rosylight [:saschanaz] (they/them) from comment #4)
Hi Andreas, we are renaming an existing interface CSS2Properties here, do we have a good reason that this would break addons? Are there many addons that specifically reference CSS2Properties?
Hi Kagami, I am looking into this and will get back to you in the coming days.
Comment 8•8 months ago
|
||
In total we found 279 add-ons using the string CSS2Properties, 8 of them with more than 1k users each. I forwarded the list of 8 to William Durand. He's going to have a look and will report back his findings here.
Comment 9•7 months ago
|
||
There is an r+ patch which didn't land and no activity in this bug for 2 weeks.
:saschanaz, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.
| Assignee | ||
Updated•7 months ago
|
Comment 11•7 months ago
|
||
Oops sorry about that. It's looking alright in the add-ons I've inspected, I think we can proceed without further changes. If we get reports in the Nightly cycle, then we might need to add an alias but probably not a must-have for now (given the data we have).
| Assignee | ||
Comment 12•7 months ago
|
||
Thank you! Let's try and see in that case.
Comment 13•7 months ago
|
||
Comment 15•7 months ago
|
||
Comment 16•7 months ago
|
||
Reverted this because it was causing devtools failures in browser_dbg-preview-wrapped-lines.js.
- Revert link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-FAIL | devtools/client/debugger/test/mochitest/browser_dbg-preview-wrapped-lines.js | The content on line 6 to wrap over 6 lines (including the inline previews) - Got 77, expected 92
Comment 17•7 months ago
|
||
Comment 18•7 months ago
|
||
Comment 19•7 months ago
|
||
Backed out for dt failure on browser_dbg-preview-wrapped-lines.js
Backout link: https://hg-edge.mozilla.org/integration/autoland/rev/65a215f0ac954d7030783d5ccca5cf595283bbf0
Log link: https://treeherder.mozilla.org/logviewer?job_id=520605925&repo=autoland&lineNumber=2938
| Assignee | ||
Comment 20•7 months ago
|
||
Wait, the test result differs between Linux and Windows? That's not expected at all from my patch π€
| Assignee | ||
Comment 21•7 months ago
|
||
Pushed try with dump(): https://treeherder.mozilla.org/jobs?repo=try&landoCommitID=145761
Comment 23•7 months ago
|
||
(In reply to Kagami Rosylight [:saschanaz] (they/them) from comment #20)
Wait, the test result differs between Linux and Windows? That's not expected at all from my patch π€
This might be caused by differences in font-size between platforms, making the lines to wrap earlier/later depending on the OS :/
We had a test that was giving us trouble in the past for the same reason, and what we did was to force the Debugger to use a specific font so it would have similar sizes everywhere:
const font = new global.FontFace(
"Ahem",
"url(chrome://mochitests/content/browser/devtools/client/debugger/test/mochitest/examples/Ahem.ttf)"
);
const loadedFont = await font.load();
global.document.fonts.add(loadedFont);
is(global.devicePixelRatio, 1);
is(global.browsingContext.top.window.devicePixelRatio, 1);
global.browsingContext.top.overrideDPPX = 1;
is(global.browsingContext.fullZoom, 1);
is(global.browsingContext.textZoom, 1);
// /!\ Change the Codemirror font to use a fixed font across all OSes
// and always have the same number of characters displayed.
// Note that this devtools mono makes the "o" characters almost invisible.
editor.codeMirror.contentDOM.style.fontFamily = "Ahem";
editor.codeMirror.contentDOM.style.fontSize = "10px";
editor.codeMirror.contentDOM.style.lineHeight = "15px";
editor.codeMirror.contentDOM.style.fontWeight = "normal";
editor.codeMirror.contentDOM.style.fontStyle = "normal";
editor.codeMirror.contentDOM.style.fontStretch = "normal";
is(global.getComputedStyle(editor.codeMirror.contentDOM).fontFamily, "Ahem");
maybe this could help you here
Comment 24•6 months ago
|
||
Comment 26•6 months ago
|
||
| bugherder | ||
Updated•5 months ago
|
| Assignee | ||
Comment 28•5 months ago
|
||
Release Note Request (optional, but appreciated)
[Why is this notable]: Name change of an existing web interface object
[Affects Firefox for Android]: Yes
[Suggested wording]: Gecko-specific CSS2Properties is now renamed to CSSStyleProperties, to align with the latest web standard and for better interop with other browser engines.
[Links (documentation, blog post, etc)]:
Comment 29•5 months ago
|
||
FF144 MDN work for this can be tracked in https://github.com/mdn/content/issues/41133
I can see that this changes CSS2Properties to CSSStyleProperties, but that isn't particularly useful information since neither of these are documented on MDN, and it isn't clear what CSS2Properties did before and CSSStyleProperties does now. Can you advise?
What I can see in the spec is that CSSStyleProperties is
[Exposed=Window]
interface CSSStyleProperties : CSSStyleDeclaration {
[CEReactions] attribute [LegacyNullToEmptyString] CSSOMString cssFloat;
};
partial interface CSSStyleProperties {
[CEReactions] attribute [LegacyNullToEmptyString] CSSOMString _camel_cased_attribute;
};
partial interface CSSStyleProperties {
[CEReactions] attribute [LegacyNullToEmptyString] CSSOMString _webkit_cased_attribute;
};
What I take from that is that this is a CSSStyleDeclaration with the property cssFloat.
-
What is cssFloat for?
-
For every CSS property defined on the object such as
box-shadowthere will be a camel case propertyboxShadowand a webkit cased property box_shadow. Is that right - anything else I'm missing on the object?
The object is returned in a number of places
interface mixin ElementCSSInlineStyle {
[SameObject, PutForwards=cssText] readonly attribute CSSStyleProperties style;
};
AND https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle
-
FF does not appear to use
CSSStylePropertiesfor the style or thegetComputedStyleso:- What is it used for?
- What is the point of
CSSStyleProperties- why not just useCSSStyleDeclaration?
-
In other words, I'm trying to work out what the point is of all this and document the delta against what the spec says. Any advice you can give me would be much appreciated!
| Assignee | ||
Comment 30•5 months ago
|
||
(In reply to Hamish Willee from comment #29)
I can see that this changes
CSS2PropertiestoCSSStyleProperties, but that isn't particularly useful information since neither of these are documented on MDN, and it isn't clear whatCSS2Propertiesdid before andCSSStylePropertiesdoes now. Can you advise?
Probably it would be something like:
{
"version_added": "144"
},
{
"alternative_name": "CSS2Properties",
"version_added": "(i dunno, probably firefox 1, I only confirmed firefox 2 had it)"
},
I see https://github.com/mdn/browser-compat-data/pull/27902 added it but without alternative_name.
- What is cssFloat for?
It's for backward compatibility, back in the day float was a keyword and you couldn't just do document.body.style.float.
- For every CSS property defined on the object such as
box-shadowthere will be a camel case propertyboxShadowand a webkit cased property box_shadow. Is that right - anything else I'm missing on the object?
webkit prefix one would exist only for certain properties, and the hyphen case "box-shadow" is also a valid property on the object.
The object is returned in a number of places
interface mixin ElementCSSInlineStyle { [SameObject, PutForwards=cssText] readonly attribute CSSStyleProperties style; };AND https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle
- FF does not appear to use
CSSStylePropertiesfor the style or thegetComputedStyleso:
- What is it used for?
- What is the point of
CSSStyleProperties- why not just useCSSStyleDeclaration?
Err, I just forgot to update them in Gecko after https://github.com/w3c/csswg-drafts/pull/12477
- In other words, I'm trying to work out what the point is of all this and document the delta against what the spec says. Any advice you can give me would be much appreciated!
The details are in https://github.com/w3c/csswg-drafts/issues/5649, tl;dr is that we don't want to expose every existing properties in CSSPageRule.style and want to expose only relevant properties (for CSSPageRule the page related ones). And thus CSSStyleDeclaration as a superclass and then each subclass (CSSStyleProperties in general, or CSSPageDescriptors for CSSPageRule) where only the relevant properties are exposed.
Does it help? π
| Assignee | ||
Comment 31•5 months ago
|
||
a webkit cased property box_shadow
That's not a thing but webkitBoxShadow and -webkit-box-shadow are valid properties on the object.
Comment 32•5 months ago
|
||
Thanks! That makes sense and is very helpful.
I have created the interface document in https://github.com/mdn/content/pull/41254 - do you think you could sanity check it? Note that I haven't yet done the work in HTMLElement.style and other docs yet to refer to this new interface. That comes next - along with further updates in the compatibility docs.
| Assignee | ||
Updated•5 months ago
|
Updated•5 months ago
|
Description
•