summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFranklinDM <mrmineshafter17@gmail.com>2023-03-11 00:02:28 +0800
committerFranklinDM <mrmineshafter17@gmail.com>2023-03-11 00:04:53 +0800
commit14746314c4297f76f2b2d64c59e8c8fe2dfe8d8e (patch)
tree159a3fe7b9f7a22fc0c6c30b5f529d312fa3fa51
parent476dec2351c75e3bf7355fbe111c604f32e5b558 (diff)
downloaduxp-14746314c4297f76f2b2d64c59e8c8fe2dfe8d8e.tar.gz
Issue #2135 - Destroy the host frame and restyle when there are content changes
This is likely inefficient, but I haven't found a way other than this to ensure that the host frame is updated if the inserted/removed content isn't slotted. I'm assuming that Firefox is handling this somewhere else (and may have been even moved to Stylo), but was mentioned in an m-c bug we haven't seen yet. In fact, this is actually similar to how we handled elements passed to ContentInserted before landing e31ed5b07466d4a579fe4b025f97c971003fbc3f.
-rw-r--r--dom/base/ShadowRoot.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/dom/base/ShadowRoot.cpp b/dom/base/ShadowRoot.cpp
index e31b97262c..92d5a2f2a9 100644
--- a/dom/base/ShadowRoot.cpp
+++ b/dom/base/ShadowRoot.cpp
@@ -578,6 +578,13 @@ ShadowRoot::ContentInserted(nsIDocument* aDocument,
if (slot && slot->GetContainingShadow() == this &&
slot->AssignedNodes().IsEmpty()) {
slot->EnqueueSlotChangeEvent();
+ return;
+ }
+
+ // XXX: The following makes the host destroy its frames and force a
+ // restyle for cases where the content isn't slotted.
+ if (aContainer == this) {
+ DistributionChanged();
}
}
@@ -614,6 +621,13 @@ ShadowRoot::ContentRemoved(nsIDocument* aDocument,
if (slot && slot->GetContainingShadow() == this &&
slot->AssignedNodes().IsEmpty()) {
slot->EnqueueSlotChangeEvent();
+ return;
+ }
+
+ // XXX: The following makes the host destroy its frames and force a
+ // restyle for cases where the content isn't slotted.
+ if (aContainer == this) {
+ DistributionChanged();
}
}