Closed Bug 2009001 Opened 4 months ago Closed 2 months ago

[css-attr] Fix failing type(...) parsing tests.

Categories

(Core :: CSS Parsing and Computation, defect)

defect

Tracking

()

RESOLVED FIXED
151 Branch
Tracking Status
firefox151 --- fixed

People

(Reporter: sukil, Assigned: sukil)

References

(Blocks 1 open bug)

Details

(Whiteboard: css-attr , [wptsync upstream])

Attachments

(3 files, 1 obsolete file)

A number of type(...) tests in attr-all-types.html fail like:

  • test_valid_attr('--y', 'attr(data-foo type(*))', 'var(--x, 3)', '3');
  • test_valid_attr('--y', 'attr(data-foo type(*))', 'attr(data-bar, 11)', '"3"');

These tests expect recursive resolution. I.e. data-foo=attr(data-bar, 3) to be resolved as 3. Right now we resolve it as type(<string>) so data-foo substitutes as "attr(data-bar, 11)" but the test would expect 3.

Severity: -- → S3

Basically, need to support recursive substitution.
Recursive substitution of attr shouldn't be super complicated, but attr -> var substitution could get complicated with registered properties that defer its computation.

So we need to make correct deferring of attr() substitution for e.g. For --bar: attr(foo) + foo="var(--registered-length)" + --registered-length: 5em; (Depending on attribute, depending on registered property, depending on font-size). Also need to handle circular references e.g. font-size: attr(foo) + foo="var(--registered-length)" + --registered-length: 5em` (Depending on attribute, depending on registered property, depending on a computed value that depends on font size).

Ultimately, this means that we need to do a bit more legwork and try to parse the attribute in question like a declaration value, like we do for fallbacks - These would store references to other properties/attributes to be used during substitution time here for fallbacks

As for when that needs to happen... Well, attributes can be used for prioritary properties, so to be able to detect circular references by then, we need to have references populated by the first substitution time. OTOH we can't handle it exactly like fallbacks, because attributes depend on which element we're styling.

Assignee: nobody → sukil
Status: NEW → ASSIGNED

The test previously expected width: 3, which passed without
proper attr() substitution. It now compares against width: 3px
using data-baz=3px to test for correct substitution.

See Also: → 2021110
See Also: → 2021155
Attachment #9555201 - Attachment is obsolete: true
Pushed by dshin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/b09e47c25222 https://hg.mozilla.org/integration/autoland/rev/2d1dba54adb6 Support chained references in attr when type() syntax is used. r=firefox-style-system-reviewers,dshin https://github.com/mozilla-firefox/firefox/commit/d2c68e854c95 https://hg.mozilla.org/integration/autoland/rev/034bbef95b7e Fix attr substitution test using invalid width value. r=dshin https://github.com/mozilla-firefox/firefox/commit/38f583eb0f82 https://hg.mozilla.org/integration/autoland/rev/f99176341264 Inline all AllSubstitutionFunctions and ComputedSubstitutionFunctions functions. r=firefox-style-system-reviewers,sukil,emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/58717 for changes under testing/web-platform/tests
Whiteboard: css-attr → css-attr , [wptsync upstream]
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 151 Branch
Blocks: 2028861
QA Whiteboard: [qa-triage-done-c152/b151]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: