Closed Bug 1988038 Opened 5 months ago Closed 4 days ago

Tree-scope resolution of anchor names

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1987926

People

(Reporter: dshin, Assigned: jari)

References

(Blocks 1 open bug)

Details

(Whiteboard: [anchorpositioning:backlog])

Attachments

(13 obsolete files)

Anchor references does not cross shadow boundary, and visibility is based on where the declaration sits on the shadow boundary.

See Also: → 1987926
Blocks: 1986602
Whiteboard: [anchorpositioning:triage] → [anchorpositioning:reserve]

So to fix this we need to make the computed value of tree scoped identifiers include the tree they came from. So, initially, I thought that the easiest thing to do would be to pull from the CascadeLevel of the current declaration we're applying. That works for most things, except animations.

Animations might not have a tree at all, and I guess we should use the value where they came from.

So, maybe something like:

pub struct TreeScoped<T> {
    value: T,
    scope: CascadeLevel, // Or could be a i8 or so. default to SameTreeAuthorNormal
}

impl<T: ToComputedValue> ToComputedValue for TreeScoped<T> {
    type ComputedValue = TreeScopedName<T::ComputedValue>;
    fn to_computed_value(&self, context: &computed::Context) -> Self::ComputedValue {
        TreeScoped {
            value: self.value.to_computed_value(context),
            scope: if context.current_scope().is_tree() {
                context.current_scope()
            } else {
                // This, combined with the from_computed_value, is needed to "preserve" the scope with keyframes
                self.scope
            }
        }
    }

    fn from_computed_value(computed: Self::ComputedValue) -> Self {
        Self {
             value: ToComputedValue::from_computed_value(self.value),
             scope: self.scope,
        }
    }
}

Then the tricky thing is to plumb current_scope properly from the cascade. I think you have all the relevant info here, so maybe just a matter of setting it properly.

Whiteboard: [anchorpositioning:reserve] → [anchorpositioning:backlog]
Assignee: nobody → jjalkanen

This commit introduces the TreeScoped generic type for representing values
scoped to a specific cascade level in the shadow tree hierarchy. It also
makes CascadeLevel serializable by adding SpecifiedValueInfo and
ToResolvedValue derives.

Attachment #9537404 - Attachment is obsolete: true

Comment on attachment 9537394 [details]
Bug 1988038: Add TreeScoped type to attach CascadeLevel to AnchorNames. r=#anchor-positioning-reviewers

Revision D278919 was moved to bug 2006964. Setting attachment 9537394 [details] to obsolete.

Attachment #9537394 - Attachment is obsolete: true

Comment on attachment 9537395 [details]
Bug 1988038: Make generated StyleCascadeLevel trivial. r=#anchor-positioning-reviewers

Revision D278920 was moved to bug 2006964. Setting attachment 9537395 [details] to obsolete.

Attachment #9537395 - Attachment is obsolete: true

Comment on attachment 9537397 [details]
Bug 1988038: Augment AnchorNames with tree scope. r=#anchor-positioning-reviewers

Revision D278922 was moved to bug 2006964. Setting attachment 9537397 [details] to obsolete.

Attachment #9537397 - Attachment is obsolete: true

Comment on attachment 9537398 [details]
Bug 1988038: Augment PositionAnchors with tree scope. r=#anchor-positioning-reviewers

Revision D278923 was moved to bug 2006964. Setting attachment 9537398 [details] to obsolete.

Attachment #9537398 - Attachment is obsolete: true

Comment on attachment 9537399 [details]
Bug 1988038: Augment AnchorFunctions with tree scope. r=#anchor-positioning-reviewers

Revision D278924 was moved to bug 2006964. Setting attachment 9537399 [details] to obsolete.

Attachment #9537399 - Attachment is obsolete: true

Comment on attachment 9537400 [details]
Bug 1988038: Use tree-scoped anchor names in Gecko code. r=#anchor-positioning-reviewers

Revision D278925 was moved to bug 2006964. Setting attachment 9537400 [details] to obsolete.

Attachment #9537400 - Attachment is obsolete: true

Comment on attachment 9537401 [details]
Bug 1988038: Switch ResolutionMap to use scoped atom as hash key. r=#anchor-positioning-reviewers

Revision D278926 was moved to bug 2006964. Setting attachment 9537401 [details] to obsolete.

Attachment #9537401 - Attachment is obsolete: true

Comment on attachment 9537402 [details]
Bug 1988038: Introduce logic to match tree-scoped references and names of anchors. r=#anchor-positioning-reviewers

Revision D278927 was moved to bug 2006964. Setting attachment 9537402 [details] to obsolete.

Attachment #9537402 - Attachment is obsolete: true

Comment on attachment 9537403 [details]
Bug 1988038: Augment AnchorScopes with tree scopes. r=#anchor-positioning-reviewers

Revision D278928 was moved to bug 2006964. Setting attachment 9537403 [details] to obsolete.

Attachment #9537403 - Attachment is obsolete: true

Comment on attachment 9537405 [details]
Bug 1988038: Fix test for :host anchor scopes. r=#anchor-positioning-reviewers

Revision D278930 was moved to bug 2006964. Setting attachment 9537405 [details] to obsolete.

Attachment #9537405 - Attachment is obsolete: true

Comment on attachment 9537406 [details]
Bug 1988038: Fix test for :host pseudo elements. r=#anchor-positioning-reviewers

Revision D278931 was moved to bug 2006964. Setting attachment 9537406 [details] to obsolete.

Attachment #9537406 - Attachment is obsolete: true
Attachment #9537396 - Attachment is obsolete: true

Fixed in bug 1987926.

Status: NEW → RESOLVED
Closed: 4 days ago
Duplicate of bug: 1987926
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: