Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1478)

Unified Diff: Source/core/rendering/RenderObject.cpp

Issue 647503002: Only unregister touch action handler conditionally (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reduced test case. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/events/touch/touch-action-double-remove-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « LayoutTests/fast/events/touch/touch-action-double-remove-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698