Open Bug 144826 Opened 20 years ago Updated 3 years ago
create pseudo-element style contexts at the same time as the primary style context rather than probing for them later
I was thinking a bit about the way we handle pseudo elements (see bug 136704 comment 22 and bug 141054 comment 18 for part of the story), and I'm becoming convinced that the way we're handling pseudo-elements in the style system is wrong. First, let me say that what I'm discussing here is the pseudo-elements that are described in the CSS spec -- :before, :after, :first-letter, and :first-line. It doesn't apply to lots of the things we use pseudo-elements for internally, which we could easily replace with -moz-special(name) and just have a lookup table. :selection might be a bit of a problem, though, although I'd need to think about exactly what :selection means. The basic problem is that I think the idea of having to probe for pseudo-element selectors is wrong. The selectors with pseudo-elements should be matched at the same time as the selectors without them, and a list of style contexts returned. We can then set a bit on the main style context and have this list available in a hashtable -- or perhaps it's just worth a pointer (mPseudoElement, in a linked list?). At least, this would make sense in a world where the content node had a pointer to the style context and the frame and we could reresolve by walking content nodes. I'm not sure if it makes so much sense now...
Status: NEW → ASSIGNED
Priority: -- → P2
Target Milestone: --- → Future
Assignee: dbaron → nobody
Status: ASSIGNED → NEW
QA Contact: ian → style-system
I've also been thinking lately about redesign of pseudo-elements that would work well for CSS regions. In that model, I'd like to be able to have selectors to the right of the pseudo-element -- the pseudo-element would still "jump" the selector from the thing that creates the pseudo-element to the stuff that lives inside of it. I'm not sure how that model interacts with the ::first-line model where div contains p contains div::first-line contains p::first-line (and they're all different).
Priority: P2 → P4
It's 16 years later since you initially requested to overhaul the handling of pseudo-elements. Are there any new insights or ideas for this? It sounds like this builds the basis for future improvements and additions of new pseudo-elements. So is this still P4? Sebastian
I'm not sure; it depends what future work we're doing on pseudo-elements. P4 is probably still appropriate.
Summary: redesign pseudo-elements → create pseudo-element style contexts at the same time as the primary style context rather than probing for them later
For what it's worth, stylo actually made a lot of the changes comment 0 suggests: we now eagerly resolve some pseudo-element styles, and the probing code is gone last I checked. So it's possible this bug is just fixed by stylo.
I guess we still have probing for lazy pseudo-elements, actually. So we no longer probe for ::before and ::after, but we do for some other things.
You need to log in before you can comment on or make changes to this bug.