| Index: Source/core/rendering/RenderObject.cpp
|
| diff --git a/Source/core/rendering/RenderObject.cpp b/Source/core/rendering/RenderObject.cpp
|
| index 39bbfe7edebad4467f8fafcc8d80bae8e3a8b8ae..47753d259b97d0415a7cf0eb7481a585932f4184 100644
|
| --- a/Source/core/rendering/RenderObject.cpp
|
| +++ b/Source/core/rendering/RenderObject.cpp
|
| @@ -2333,12 +2333,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);
|
|
|
|
|