| Summary: | HTMLSlotElement should render its assigned nodes | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Ryosuke Niwa <rniwa> | ||||
| Component: | Layout and Rendering | Assignee: | Antti Koivisto <koivisto> | ||||
| Status: | RESOLVED FIXED | ||||||
| Severity: | Normal | CC: | commit-queue, dino, eoconnor, esprehn+autocc, gyuyoung.kim, hyatt, kangil.han, simon.fraser, webkit-bug-importer | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | WebKit Nightly Build | ||||||
| Hardware: | Unspecified | ||||||
| OS: | Unspecified | ||||||
| Bug Depends on: | 149241 | ||||||
| Bug Blocks: | 148695 | ||||||
| Attachments: |
|
||||||
|
Description
Ryosuke Niwa
2015-09-16 18:07:18 PDT
Created attachment 261686 [details]
patch
Comment on attachment 261686 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=261686&action=review > Source/WebCore/dom/SlotAssignment.cpp:187 > + auto defaultSlotEntry = m_slots.find(emptyAtom); !? This would result in a hash lookup in each iteration. > Source/WebCore/style/StyleResolveTree.cpp:473 > +static void attachSlot(HTMLSlotElement& slot, RenderStyle& inheritedStyle, RenderTreePosition& renderTreePosition) Attach sounds like we're attaching a renderer for a slot. Maybe attachSlotContents would sound better? attachSlotAssignee? > Source/WebCore/style/StyleResolveTree.cpp:481 > + continue; > + } > + if (is<Element>(*child)) Why don't we just do elseif? > Source/WebCore/style/StyleResolveTree.cpp:586 > + continue; > + } > + if (is<Element>(*child)) Why don't we just do "else if" instead? > Source/WebCore/style/StyleResolveTree.cpp:616 > +#if ENABLE(SHADOW_DOM) > + else if (is<HTMLSlotElement>(current)) > + detachSlot(downcast<HTMLSlotElement>(current), detachType); > +#endif > + else if (ShadowRoot* shadowRoot = current.shadowRoot()) > detachShadowRoot(*shadowRoot, detachType); What happens when a slot element has its own shadow root? > Source/WebCore/style/StyleResolveTree.cpp:857 > + continue; > + } > + if (is<Element>(*child)) Ditto. (In reply to comment #3) > Comment on attachment 261686 [details] > patch > > View in context: > !? This would result in a hash lookup in each iteration. This fixes a bug, the cached iterator becomes invalid after mutation. > > Source/WebCore/style/StyleResolveTree.cpp:616 > > +#if ENABLE(SHADOW_DOM) > > + else if (is<HTMLSlotElement>(current)) > > + detachSlot(downcast<HTMLSlotElement>(current), detachType); > > +#endif > > + else if (ShadowRoot* shadowRoot = current.shadowRoot()) > > detachShadowRoot(*shadowRoot, detachType); > > What happens when a slot element has its own shadow root? We ignore shadow root for slot element when creating the render tree so no need to detach it either. I assume the spec forbids it. |