Bug 50790

Summary: Add simple pseudoelement style resolution and adapt slider thumb to use it.
Product: WebKit Reporter: Dimitri Glazkov (Google) <dglazkov>
Component: New BugsAssignee: Dimitri Glazkov (Google) <dglazkov>
Status: RESOLVED INVALID    
Severity: Normal CC: darin, eric, hyatt, jamesr
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Other   
OS: OS X 10.5   
Bug Depends on:    
Bug Blocks: 46595    
Attachments:
Description Flags
Patch hyatt: review-

Description Dimitri Glazkov (Google) 2010-12-09 16:17:35 PST
Add simple pseudoelement style resolution and adapt slider thumb to use it.
Comment 1 Dimitri Glazkov (Google) 2010-12-09 16:22:15 PST
Created attachment 76134 [details]
Patch
Comment 2 Dimitri Glazkov (Google) 2010-12-09 16:24:02 PST
Dave, this is still pretty hacky, but at least there's no double-resolving the style as it was in the first RenderSlider patch.

Long-term, I guess we should rework pseudoElement resolution to be more like normal element matching. WDYT?
Comment 3 Dave Hyatt 2010-12-10 13:58:41 PST
Comment on attachment 76134 [details]
Patch

This feature is comparable to the :xbl-pseudo.

http://www.w3.org/TR/xbl/#the-xblpseudo

It's basically something new, a hybrid, that is both an element with a shadow DOM position (that needs to match normal rules that apply to that element type), but that also matches pseudo-element rules.

*This is not a pseudo style.*

It's a normal style that happens to also match a pseudo-element rule.  Your instinct to patch styleForElement is correct, but you need to implement it such that you don't lose normal rule matching as well.

Here's the basic template I would use.

(1) Remove the hard-coded pseudo-element from the pseudo-element list.  It shouldn't be there any more.
(2) Have elements know their shadowPseudoId.  That part is fine.
(3) Flag rules that have unrecognized pseudo-elements (and that are therefore potentially matched by a shadow pseudo). You should be able to make another hash (similar to the id, tag, class hashes) that lets you easily grab rules for your shadow pseudo id.
(4) Match on it treating the shadow pseudo id as yourself (and then you have to go to the parent to test it for the rest of the rule, similar to a > selector).
Comment 4 Dimitri Glazkov (Google) 2010-12-17 08:48:32 PST
(In reply to comment #3)
> (From update of attachment 76134 [details])
> This feature is comparable to the :xbl-pseudo.
> 
> http://www.w3.org/TR/xbl/#the-xblpseudo
> 
> It's basically something new, a hybrid, that is both an element with a shadow DOM position (that needs to match normal rules that apply to that element type), but that also matches pseudo-element rules.
> 
> *This is not a pseudo style.*
> 
> It's a normal style that happens to also match a pseudo-element rule.  Your instinct to patch styleForElement is correct, but you need to implement it such that you don't lose normal rule matching as well.
> 
> Here's the basic template I would use.
> 
> (1) Remove the hard-coded pseudo-element from the pseudo-element list.  It shouldn't be there any more.
> (2) Have elements know their shadowPseudoId.  That part is fine.
> (3) Flag rules that have unrecognized pseudo-elements (and that are therefore potentially matched by a shadow pseudo). You should be able to make another hash (similar to the id, tag, class hashes) that lets you easily grab rules for your shadow pseudo id.
> (4) Match on it treating the shadow pseudo id as yourself (and then you have to go to the parent to test it for the rest of the rule, similar to a > selector).

This is basically the TODO list for bug 46595, closing this as invalid.