Chromium Code Reviews| Index: Source/core/html/HTMLInputElement.cpp |
| diff --git a/Source/core/html/HTMLInputElement.cpp b/Source/core/html/HTMLInputElement.cpp |
| index 904da975e84edb9fcd952b2394076ec414d58c3e..58900cb7afc40412ce2a94fbd669058ae7a2cf8f 100644 |
| --- a/Source/core/html/HTMLInputElement.cpp |
| +++ b/Source/core/html/HTMLInputElement.cpp |
| @@ -49,6 +49,7 @@ |
| #include "core/events/ScopedEventQueue.h" |
| #include "core/events/TouchEvent.h" |
| #include "core/fileapi/FileList.h" |
| +#include "core/frame/EventHandlerRegistry.h" |
| #include "core/frame/FrameHost.h" |
| #include "core/frame/FrameView.h" |
| #include "core/frame/LocalFrame.h" |
| @@ -174,8 +175,8 @@ HTMLInputElement::~HTMLInputElement() |
| // We should unregister it to avoid accessing a deleted object. |
| if (isRadioButton()) |
| document().formController().radioButtonGroupScope().removeButton(this); |
| - if (m_hasTouchEventHandler) |
| - document().didRemoveTouchEventHandler(this); |
| + if (m_hasTouchEventHandler && document().frameHost()) |
| + document().frameHost()->eventHandlerRegistry().didRemoveEventHandler(*this, EventHandlerRegistry::TouchEvent); |
| #endif |
| } |
| @@ -426,10 +427,13 @@ void HTMLInputElement::updateType() |
| bool hasTouchEventHandler = m_inputTypeView->hasTouchEventHandler(); |
| if (hasTouchEventHandler != m_hasTouchEventHandler) { |
| - if (hasTouchEventHandler) |
| - document().didAddTouchEventHandler(this); |
| - else |
| - document().didRemoveTouchEventHandler(this); |
| + if (document().frameHost() && document().isActive()) { |
|
Rick Byers
2014/07/01 18:21:33
Looks like this change will also skip updating the
|
| + EventHandlerRegistry& registry = document().frameHost()->eventHandlerRegistry(); |
| + if (hasTouchEventHandler) |
| + registry.didAddEventHandler(*this, EventHandlerRegistry::TouchEvent); |
| + else |
| + registry.didRemoveEventHandler(*this, EventHandlerRegistry::TouchEvent); |
| + } |
| m_hasTouchEventHandler = hasTouchEventHandler; |
| } |
| @@ -1435,11 +1439,6 @@ void HTMLInputElement::didMoveToNewDocument(Document& oldDocument) |
| if (isRadioButton()) |
| oldDocument.formController().radioButtonGroupScope().removeButton(this); |
| - if (m_hasTouchEventHandler) |
| - oldDocument.didRemoveTouchEventHandler(this); |
| - |
| - if (m_hasTouchEventHandler) |
| - document().didAddTouchEventHandler(this); |
| HTMLTextFormControlElement::didMoveToNewDocument(oldDocument); |
| } |