Closed Bug 933125 Opened 12 years ago Closed 7 years ago

make scoped style sheets work in anonymous content

Categories

(Core :: CSS Parsing and Computation, defect, P4)

defect

Tracking

()

RESOLVED WONTFIX

People

(Reporter: heycam, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

Scoped style sheets should work in non-native anonymous content, both <style scoped> elements from the outside applying to elements in the shadow tree, and <style scoped> elements within the shadow tree applying to its siblings and any descendent real and non-native anonymous content.
Followup from bug 926717.
Priority: -- → P3
Attached patch WIP (v0.1) (obsolete) — Splinter Review
Mostly works, but the layout/reftests/scoped-style/scoped-style-xbl-005.xhtml test doesn't. Looks like Element::BindToTree isn't called for the <span> element that is in the deeper shadow tree, so my SetIsElementInStyleScope call in there isn't getting hit.
Assignee: nobody → cam
Status: NEW → ASSIGNED
Priority: P3 → P4
Attached patch patchSplinter Review
Attachment #825135 - Attachment is obsolete: true
Attachment #825624 - Flags: review?(bzbarsky)
(In reply to Cameron McCormack (:heycam) from comment #2) > Looks like Element::BindToTree isn't called for the <span> element that is in the > deeper shadow tree I was wrong about that bit.
Hmm, got a couple of oranges for one of the added reftests, but not on all platforms: https://tbpl.mozilla.org/?tree=Try&rev=074eea814efc
Comment on attachment 825624 [details] [diff] [review] patch >+ FlattenedChildIterator it(aElement); Hmm. So in cases when the <style> is a kid of an anonymous element, this will iterate too many things. But I'm not sure we have a sane way to iterate the set of things we _really_ want here. Blake, do we? Also, we should raise a web components spec issue about how <style> in anonymous content interacts with document.styleSheets (ideally it doesn't show up there, I'd think; add tests for this?). > HasScopedStyleSheetChild(nsIContent* aContent) Again, using FlattenedChildIterator is a bit weird here. If this incorrectly reports "true" is that ok? > UpdateIsElementInStyleScopeFlagOnSubtree And the same worries about FlattenedChildIterator here. At the very least all of this stuff needs extensive comments explaining why the non-intuitive FlattenedChildIterator uses make sense and what assumptions make them OK, and perhaps some asserts of these assumptions if that's possible.
Attachment #825624 - Flags: review?(bzbarsky)
Attachment #825624 - Flags: review-
Attachment #825624 - Flags: feedback?(mrbkap)
Hmm, when you say it will iterate too many things, which additional things is it going to be iterating that we don't want?
Consider this DOM: <div><span></span></div> Say the <div> has a binding attached that has: <content> <p> <style scoped></style> <children></children> </p> </content> The FlattenedChildIterator on <p> will see the <span> as a child of <p>. But it seems pretty wrong to me for the <style scoped> there to apply to that <span>.... And from the other direction: <div><style scoped></style></div> and the binding: <content> <p> <span>Some stuff</span> <children></children> </p> </content> I don't think we want the <p> to be treated as a style scope for the <style> in this case.
Or I guess to actually answer comment 7, it'll iterate DOM kids of the bound element whose insertion point is under the element whose flattened children we're iterating.
Comment on attachment 825624 [details] [diff] [review] patch After talking to dglazkov on IRC, it seems like nobody has really thought about what this means, so we probably should hold off on it until we figure that out...
Attachment #825624 - Flags: feedback?(mrbkap) → feedback-
OK let's leave it for now.
Assignee: cam → nobody
Status: ASSIGNED → NEW
See Also: → 1270174
Per bug 1345702 comment 2 we're removing scoped style sheets.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: