WebKit Bugzilla
Attachment 348058 Details for
Bug 169718
: Changes to slot children should trigger slotchange
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP
wip169718.patch (text/plain), 5.47 KB, created by
Ryosuke Niwa
on 2018-08-24 16:49:39 PDT
(
hide
)
Description:
WIP
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2018-08-24 16:49:39 PDT
Size:
5.47 KB
patch
obsolete
>Index: Source/WebCore/dom/Element.cpp >=================================================================== >--- Source/WebCore/dom/Element.cpp (revision 235334) >+++ Source/WebCore/dom/Element.cpp (working copy) >@@ -2178,7 +2178,7 @@ > switch (change.type) { > case ElementInserted: > case ElementRemoved: >- // For elements, we notify shadowRoot in Element::insertedInto and Element::removedFrom. >+ // For elements, we notify shadowRoot in Element::insertedIntoAncestor and Element::removedFromAncestor. > break; > case AllChildrenRemoved: > case AllChildrenReplaced: >Index: Source/WebCore/dom/ShadowRoot.cpp >=================================================================== >--- Source/WebCore/dom/ShadowRoot.cpp (revision 235334) >+++ Source/WebCore/dom/ShadowRoot.cpp (working copy) >@@ -183,6 +183,7 @@ > > void ShadowRoot::addSlotElementByName(const AtomicString& name, HTMLSlotElement& slot) > { >+ ASSERT(&slot.rootNode() == this); > if (!m_slotAssignment) > m_slotAssignment = std::make_unique<SlotAssignment>(); > >@@ -194,6 +195,12 @@ > return m_slotAssignment->removeSlotElementByName(name, slot, *this); > } > >+void ShadowRoot::slotFallbackDidChange(HTMLSlotElement& slot) >+{ >+ ASSERT(&slot.rootNode() == this); >+ return m_slotAssignment->slotFallbackDidChange(slot, *this); >+} >+ > const Vector<Node*>* ShadowRoot::assignedNodesForSlot(const HTMLSlotElement& slot) > { > if (!m_slotAssignment) >Index: Source/WebCore/dom/ShadowRoot.h >=================================================================== >--- Source/WebCore/dom/ShadowRoot.h (revision 235334) >+++ Source/WebCore/dom/ShadowRoot.h (working copy) >@@ -74,6 +74,7 @@ > > void addSlotElementByName(const AtomicString&, HTMLSlotElement&); > void removeSlotElementByName(const AtomicString&, HTMLSlotElement&); >+ void slotFallbackDidChange(HTMLSlotElement&); > > void didRemoveAllChildrenOfShadowHost(); > void didChangeDefaultSlot(); >@@ -107,7 +108,6 @@ > Element* m_host { nullptr }; > > std::unique_ptr<Style::Scope> m_styleScope; >- > std::unique_ptr<SlotAssignment> m_slotAssignment; > }; > >Index: Source/WebCore/dom/SlotAssignment.cpp >=================================================================== >--- Source/WebCore/dom/SlotAssignment.cpp (revision 235334) >+++ Source/WebCore/dom/SlotAssignment.cpp (working copy) >@@ -123,6 +123,21 @@ > ASSERT(slotInfo.element || m_needsToResolveSlotElements); > } > >+void SlotAssignment::slotFallbackDidChange(HTMLSlotElement& slotElement, ShadowRoot& shadowRoot) >+{ >+ bool usesFallbackContent = !assignedNodesForSlot(slotElement, shadowRoot); >+ if (!usesFallbackContent) >+ return; >+ >+ m_slotAssignmentsIsValid = false; >+ shadowRoot.host()->invalidateStyleAndRenderersForSubtree(); >+ >+ if (shadowRoot.mode() == ShadowRootMode::UserAgent) >+ return; >+ >+ slotElement.enqueueSlotChangeEvent(); >+} >+ > void SlotAssignment::didChangeSlot(const AtomicString& slotAttrValue, ShadowRoot& shadowRoot) > { > auto& slotName = slotNameFromAttributeValue(slotAttrValue); >Index: Source/WebCore/dom/SlotAssignment.h >=================================================================== >--- Source/WebCore/dom/SlotAssignment.h (revision 235334) >+++ Source/WebCore/dom/SlotAssignment.h (working copy) >@@ -51,6 +51,7 @@ > > void addSlotElementByName(const AtomicString&, HTMLSlotElement&, ShadowRoot&); > void removeSlotElementByName(const AtomicString&, HTMLSlotElement&, ShadowRoot&); >+ void slotFallbackDidChange(HTMLSlotElement&, ShadowRoot&); > > void didChangeSlot(const AtomicString&, ShadowRoot&); > void enqueueSlotChangeEvent(const AtomicString&, ShadowRoot&); >Index: Source/WebCore/html/HTMLSlotElement.cpp >=================================================================== >--- Source/WebCore/html/HTMLSlotElement.cpp (revision 235334) >+++ Source/WebCore/html/HTMLSlotElement.cpp (working copy) >@@ -57,7 +57,7 @@ > ASSERT_UNUSED(insertionResult, insertionResult == InsertedIntoAncestorResult::Done); > > if (insertionType.treeScopeChanged && isInShadowTree()) { >- if (auto shadowRoot = containingShadowRoot()) >+ if (auto* shadowRoot = containingShadowRoot()) > shadowRoot->addSlotElementByName(attributeWithoutSynchronization(nameAttr), *this); > } > >@@ -75,6 +75,16 @@ > HTMLElement::removedFromAncestor(removalType, oldParentOfRemovedTree); > } > >+void HTMLSlotElement::childrenChanged(const ChildChange& childChange) >+{ >+ HTMLElement::childrenChanged(childChange); >+ >+ if (isInShadowTree()) { >+ if (auto* shadowRoot = containingShadowRoot()) >+ shadowRoot->slotFallbackDidChange(*this); >+ } >+} >+ > void HTMLSlotElement::attributeChanged(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue, AttributeModificationReason reason) > { > HTMLElement::attributeChanged(name, oldValue, newValue, reason); >Index: Source/WebCore/html/HTMLSlotElement.h >=================================================================== >--- Source/WebCore/html/HTMLSlotElement.h (revision 235334) >+++ Source/WebCore/html/HTMLSlotElement.h (working copy) >@@ -51,6 +51,7 @@ > > InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final; > void removedFromAncestor(RemovalType, ContainerNode&) final; >+ void childrenChanged(const ChildChange&) final; > void attributeChanged(const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue, AttributeModificationReason) final; > > bool m_inSignalSlotList { false };
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 169718
:
348058
|
348262
|
348266
|
348276
|
348364
|
348374
|
348382
|
348390