diff options
author | FranklinDM <mrmineshafter17@gmail.com> | 2023-03-19 23:43:34 +0800 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2023-03-23 12:18:03 +0100 |
commit | 039b67f6c681f55b9bb3ffb4569333b78cd87f8a (patch) | |
tree | c069e15c54e6be6d6972770012ca868bf9dae423 /dom/base | |
parent | c0e6ba933e063226816d3b67f92c721c14267f53 (diff) | |
download | uxp-039b67f6c681f55b9bb3ffb4569333b78cd87f8a.tar.gz |
Issue #1592 - Part 9: Post a restyle event after changing the slot of a slottable
Diffstat (limited to 'dom/base')
-rw-r--r-- | dom/base/ShadowRoot.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/dom/base/ShadowRoot.cpp b/dom/base/ShadowRoot.cpp index d432c96e41..8482da5e99 100644 --- a/dom/base/ShadowRoot.cpp +++ b/dom/base/ShadowRoot.cpp @@ -9,6 +9,7 @@ #include "mozilla/dom/DocumentFragment.h" #include "ChildIterator.h" #include "nsContentUtils.h" +#include "nsLayoutUtils.h" #include "nsDOMClassInfoID.h" #include "nsIDOMHTMLElement.h" #include "nsIStyleSheetLinkingElement.h" @@ -162,6 +163,16 @@ ShadowRoot::AddSlot(HTMLSlotElement* aSlot) oldSlot->RemoveAssignedNode(assignedNode); currentSlot->AppendAssignedNode(assignedNode); + Element* restyleElement; + if (assignedNode->IsElement()) { + restyleElement = assignedNode->AsElement(); + } else { + // This is likely a text node. Use the host instead. + restyleElement = GetHost(); + } + nsLayoutUtils::PostRestyleEvent( + restyleElement, eRestyle_Subtree, nsChangeHint(0)); + doEnqueueSlotChange = true; } |