Currently we unapply the alternative presentation button substitution whenever the associated Alternative Presentation Button is removed. We should only unapply the substitution when the Alternative Presentation Button is removed via SPI. Otherwise, we will cause the assertion NoEventDispatchAssertion::InMainThread::isEventDispatchAllowedInSubtree(child) to fail in WebCore::dispatchChildRemovalEvents() when unapplying the substitution for an <input> (since unapplying the substitution for an <input> changes its input type => destroys and creates a new shadow subtree).
<rdar://problem/35841099>
Created attachment 328401 [details] Patch and layout test
Comment on attachment 328401 [details] Patch and layout test View in context: https://bugs.webkit.org/attachment.cgi?id=328401&action=review > Source/WebCore/editing/cocoa/AlternativePresentationButtonSubstitution.h:47 > + void unapply(bool fromAPI); This would be better with an enum, but I'm fine with this as-is.
The approach for the alternative presentation button has since changed. This bug is no longer applicable.