Note: There are a few cases of duplicates in user autocompletion which are being worked on.

stylo: Implement ComputedValues sharing for text and anonymous boxes

NEW
Assigned to

Status

()

Core
CSS Parsing and Computation
P1
normal
2 months ago
4 days ago

People

(Reporter: bz, Assigned: bz)

Tracking

(Blocks: 5 bugs)

53 Branch
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Assignee)

Description

2 months ago
Right now we have ComputedValues sharing (via using the same style context) for sibling textnodes, but not across cousins.  In practice that means we can end up with lots of textnodes that could be sharing ComputedValues but are not; see data in bug 1367862.

We should probably figure out a sane way to do cousin sharing here.
I think the best would probably be to have an ephemeral nsRefPtrHashtable mapping from element style to text style on the nsFrameConstructorState. That would get sharing at least within a given restyle generation without bloating ComputedValues with another pointer.
(Assignee)

Comment 2

2 months ago
Do we have nsFrameConstructorState while doing restyling or the equivalent of ReparentStyleContext?
(Assignee)

Comment 3

2 months ago
So... I was digging into this more today.  Do we even have effective sharing for siblings?

For the restyle post-traversal we do, but if we're doing frame construction, don't we just end up doing a separate nsStyleContext and hence separate ComputedValues for every textnode?

As for the restyle case, we definitely don't have an nsFrameConstructorState in ProcessPostTraversalForText or its callees.
(In reply to Boris Zbarsky [:bz] (if a patch has no decent message, automatic r-) from comment #2)
> Do we have nsFrameConstructorState while doing restyling or the equivalent
> of ReparentStyleContext?

Well, no. That would be ServoRestyleManager::ProcessPostTraversal, which is its own thing. We could add an equivalent hashtable there.

(In reply to Boris Zbarsky [:bz] (if a patch has no decent message, automatic r-) from comment #3)
> So... I was digging into this more today.  Do we even have effective sharing
> for siblings?
> 
> For the restyle post-traversal we do, but if we're doing frame construction,
> don't we just end up doing a separate nsStyleContext and hence separate
> ComputedValues for every textnode?

I think that is accurate, unfortunately. Needs fixing.
(Assignee)

Updated

a month ago
Blocks: 1367862
Assignee: nobody → bzbarsky
Priority: -- → P1
Blocks: 1293767
(Assignee)

Updated

a month ago
Blocks: 1373430
We decided on IRC to hang these in a linked list off the ServoStyleContext. Same for anonymous boxes (bug 1368291).
Depends on: 1373018
Summary: stylo: Implement ComputedValues sharing across cousin textnodes → stylo: Implement ComputedValues sharing for text and anonymous boxes
Blocks: 1368291
You need to log in before you can comment on or make changes to this bug.