| Index: Source/core/rendering/RenderObject.cpp
|
| diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp
|
| index af60bc8dd846a6675e11db68a909bf99104f7cb2..32405e954c417db0bad85252ae25f15467bd4c15 100644
|
| --- a/Source/core/rendering/RenderObject.cpp
|
| +++ b/Source/core/rendering/RenderObject.cpp
|
| @@ -2367,12 +2367,15 @@ void RenderObject::willBeDestroyed()
|
| if (hasCounterNodeMap())
|
| RenderCounter::destroyCounterNodes(*this);
|
|
|
| - // Remove the handler if node had touch-action set. Don't call when
|
| - // document is being destroyed as all handlers will have been cleared
|
| - // previously. Handlers are not added for text nodes so don't try removing
|
| - // for one too. Need to check if m_style is null in cases of partial construction.
|
| - if (!documentBeingDestroyed() && node() && !node()->isTextNode() && m_style && m_style->touchAction() != TouchActionAuto)
|
| - document().frameHost()->eventHandlerRegistry().didRemoveEventHandler(*node(), EventHandlerRegistry::TouchEvent);
|
| + // Remove the handler if node had touch-action set. Handlers are not added
|
| + // for text nodes so don't try removing for one too. Need to check if
|
| + // m_style is null in cases of partial construction. Any handler we added
|
| + // previously may have already been removed by the Document independently.
|
| + if (node() && !node()->isTextNode() && m_style && m_style->touchAction() != TouchActionAuto) {
|
| + EventHandlerRegistry& registry = document().frameHost()->eventHandlerRegistry();
|
| + if (registry.eventHandlerTargets(EventHandlerRegistry::TouchEvent)->contains(node()))
|
| + registry.didRemoveEventHandler(*node(), EventHandlerRegistry::TouchEvent);
|
| + }
|
|
|
| setAncestorLineBoxDirty(false);
|
|
|
|
|