Title: [291961] trunk
- Revision
- 291961
- Author
- [email protected]
- Date
- 2022-03-28 01:27:30 -0700 (Mon, 28 Mar 2022)
Log Message
Remove pending UA shadow tree state when an input element is removed from the document
https://bugs.webkit.org/show_bug.cgi?id=238429
<rdar://90682918>
Reviewed by Antti Koivisto.
Source/WebCore:
If an <input> element has a pending UA shadow tree, and the element is
removed from the document, we don't currently remove the element from
Document::m_elementsWithPendingUserAgentShadowTreeUpdates. Not only
does that means we may wastefully create the shadow tree if the
element is not inserted into the document again, but if the element is
then inserted into a different document, flushing style in the new
document won't correctly create the shadow tree.
Test: fast/forms/lazy-shadow-tree-creation-move-document-crash.html
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::removedFromAncestor):
LayoutTests:
* fast/forms/lazy-shadow-tree-creation-move-document-crash-expected.txt: Added.
* fast/forms/lazy-shadow-tree-creation-move-document-crash.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (291960 => 291961)
--- trunk/LayoutTests/ChangeLog 2022-03-28 06:15:24 UTC (rev 291960)
+++ trunk/LayoutTests/ChangeLog 2022-03-28 08:27:30 UTC (rev 291961)
@@ -1,3 +1,14 @@
+2022-03-28 Cameron McCormack <[email protected]>
+
+ Remove pending UA shadow tree state when an input element is removed from the document
+ https://bugs.webkit.org/show_bug.cgi?id=238429
+ <rdar://90682918>
+
+ Reviewed by Antti Koivisto.
+
+ * fast/forms/lazy-shadow-tree-creation-move-document-crash-expected.txt: Added.
+ * fast/forms/lazy-shadow-tree-creation-move-document-crash.html: Added.
+
2022-03-27 Matt Woodrow <[email protected]>
Preserve repeat() notation for grid-templates
Added: trunk/LayoutTests/fast/forms/lazy-shadow-tree-creation-move-document-crash-expected.txt (0 => 291961)
--- trunk/LayoutTests/fast/forms/lazy-shadow-tree-creation-move-document-crash-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/forms/lazy-shadow-tree-creation-move-document-crash-expected.txt 2022-03-28 08:27:30 UTC (rev 291961)
@@ -0,0 +1 @@
+PASS if no crash.
Added: trunk/LayoutTests/fast/forms/lazy-shadow-tree-creation-move-document-crash.html (0 => 291961)
--- trunk/LayoutTests/fast/forms/lazy-shadow-tree-creation-move-document-crash.html (rev 0)
+++ trunk/LayoutTests/fast/forms/lazy-shadow-tree-creation-move-document-crash.html 2022-03-28 08:27:30 UTC (rev 291961)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+PASS if no crash.
+<script>
+function run() {
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ let e = document.createElement("input");
+ frames[0].document.body.offsetTop;
+ document.body.append(e);
+ frames[0].document.body.append(e);
+}
+</script>
+<iframe _onload_="run()"></iframe>
Modified: trunk/Source/WebCore/ChangeLog (291960 => 291961)
--- trunk/Source/WebCore/ChangeLog 2022-03-28 06:15:24 UTC (rev 291960)
+++ trunk/Source/WebCore/ChangeLog 2022-03-28 08:27:30 UTC (rev 291961)
@@ -1,3 +1,24 @@
+2022-03-28 Cameron McCormack <[email protected]>
+
+ Remove pending UA shadow tree state when an input element is removed from the document
+ https://bugs.webkit.org/show_bug.cgi?id=238429
+ <rdar://90682918>
+
+ Reviewed by Antti Koivisto.
+
+ If an <input> element has a pending UA shadow tree, and the element is
+ removed from the document, we don't currently remove the element from
+ Document::m_elementsWithPendingUserAgentShadowTreeUpdates. Not only
+ does that means we may wastefully create the shadow tree if the
+ element is not inserted into the document again, but if the element is
+ then inserted into a different document, flushing style in the new
+ document won't correctly create the shadow tree.
+
+ Test: fast/forms/lazy-shadow-tree-creation-move-document-crash.html
+
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::removedFromAncestor):
+
2022-03-27 Lauro Moura <[email protected]>
Unreviewed, non-unified buildfix
Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (291960 => 291961)
--- trunk/Source/WebCore/html/HTMLInputElement.cpp 2022-03-28 06:15:24 UTC (rev 291960)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp 2022-03-28 08:27:30 UTC (rev 291961)
@@ -1637,6 +1637,10 @@
oldParentOfRemovedTree.treeScope().radioButtonGroups().removeButton(*this);
if (removalType.disconnectedFromDocument && !form())
removeFromRadioButtonGroup();
+ if (removalType.disconnectedFromDocument && m_hasPendingUserAgentShadowTreeUpdate) {
+ document().removeElementWithPendingUserAgentShadowTreeUpdate(*this);
+ m_hasPendingUserAgentShadowTreeUpdate = false;
+ }
HTMLTextFormControlElement::removedFromAncestor(removalType, oldParentOfRemovedTree);
ASSERT(!isConnected());
if (removalType.disconnectedFromDocument && !form() && isRadioButton())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes