Bug 149242

Summary: HTMLSlotElement should render its assigned nodes
Product: WebKit Reporter: Ryosuke Niwa <rniwa>
Component: Layout and RenderingAssignee: 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 Flags
patch rniwa: review+

Ryosuke Niwa
Reported 2015-09-16 18:07:18 PDT
Support rendering the assigned nodes under HTMLSlotElement added in the bug 149241.
Attachments
patch (10.29 KB, patch)
2015-09-21 14:51 PDT, Antti Koivisto
rniwa: review+
Radar WebKit Bug Importer
Comment 1 2015-09-17 18:11:36 PDT
Antti Koivisto
Comment 2 2015-09-21 14:51:54 PDT
Ryosuke Niwa
Comment 3 2015-09-21 15:06:11 PDT
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.
Antti Koivisto
Comment 4 2015-09-21 15:16:24 PDT
(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.
Antti Koivisto
Comment 5 2015-09-21 15:28:16 PDT
Note You need to log in before you can comment on or make changes to this bug.