Handle invalidation for @container style() queries
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
People
(Reporter: jfkthame, Assigned: descalante)
References
(Blocks 1 open bug)
Details
Attachments
(1 obsolete file)
Comment 1•9 months ago
|
||
(ni? me to elaborate on what the MVP of this would look like)
Comment 2•9 months ago
|
||
So what needs to happen here is:
- We need to keep track of whether a style is affected by style queries somehow. We should use a mechanism similar to this flag.
- When custom properties differ (we diff them around here) we need to keep that information.
- Right now, when inherited properties change, we just re-cascade the children. We need to make that
ChildRestyleRequirementa bit more subtle, since now that needs to not only re-cascade, but re-selector-match if those properties are queried by the child.
My suggestion would be to make ChildRestyleRequirement a bitfield, something along the lines:
const EMPTY = 0;
const CASCADE_CHILDREN_IF_INHERITS_RESET = 1 << 0;
const CASCADE_CHILDREN = 1 << 1;
const MATCH_CHILDREN_IF_AFFECTED_BY_STYLE_QUERIES = 1 << 2;
const CASCADE_SUBTREE = 1 << 3;
const MATCH_SUBTREE = 1 << 4;
In fact, I think we can just use RestyleHint directly (and we need to add a new bit there for style queries).
Then around here, we'd need to deal with the bits instead of a match statement, something like:
propagated_hint |= child_restyle_requirement;
(we could rename child_restyle_requirement actually).
And finally we'd need to tweak this condition to check whether the new bit is set, and whether the old style is affected by container queries.
I think that's the MVP for this. Further improvements could include keeping track of the changed properties or something, but we haven't needed that so far for explicit inheritance of reset properties which is a pretty similar mechanism, so hopefully we don't need that here either.
| Reporter | ||
Comment 3•9 months ago
|
||
(In reply to Emilio Cobos Álvarez [:emilio] from comment #2)
- When custom properties differ (we diff them around here) we need to keep that information.
Note that it's not only changes to custom properties that are relevant to style queries; at least changes to CSS units can also affect style queries, even in the absence of any custom props (e.g. @container style(15px < 1em < 25px) would require that we re-selector-match if the container's font-size changes). I don't think there's currently much (any?) test coverage for things like that, though.
| Assignee | ||
Updated•9 months ago
|
| Reporter | ||
Comment 4•9 months ago
|
||
(In reply to Emilio Cobos Álvarez [:emilio] from comment #2)
const MATCH_CHILDREN_IF_AFFECTED_BY_STYLE_QUERIES = 1 << 2;
Would this only re-do selector matching for the element's immediate children? IIUC, that may not be sufficient; we probably need it to be MATCH_SUBTREE_IF_AFFECTED_BY_STYLE_QUERIES, at least in the case where the element has a container-name, because arbitrarily distant descendants may be querying an ancestor container other than their immediate parent.
| Reporter | ||
Updated•9 months ago
|
| Assignee | ||
Comment 5•9 months ago
|
||
Comment 7•8 months ago
|
||
| bugherder | ||
Updated•8 months ago
|
Updated•8 months ago
|
| Reporter | ||
Comment 8•8 months ago
|
||
FTR, it looks like the patch that landed here should really have been attached to bug 2019553.
| Assignee | ||
Comment 9•8 months ago
|
||
(In reply to Jonathan Kew [:jfkthame] from comment #8)
FTR, it looks like the patch that landed here should really have been attached to bug 2019553.
Yes it was, sorry about that
Comment 10•8 months ago
|
||
Comment on attachment 9551399 [details]
Bug 2014403 - Convert ChildRestyleRequirement from enum to bitflags. r=emilio,jfkthame
Revision D286879 was moved to bug 2019553. Setting attachment 9551399 [details] to obsolete.
Updated•8 months ago
|
| Assignee | ||
Updated•3 months ago
|
Description
•