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

Unified Diff: Source/core/html/HTMLInputElement.cpp

Issue 225903009: Migrate touch events to EventHandlerRegistry (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years, 6 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
Index: Source/core/html/HTMLInputElement.cpp
diff --git a/Source/core/html/HTMLInputElement.cpp b/Source/core/html/HTMLInputElement.cpp
index 700a04d0c2ad16093048e0e329070733c34dafd7..08e841017850b541a2cdadb5d793ffb9d6b01618 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"
@@ -173,8 +174,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
}
@@ -425,10 +426,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()) {
+ EventHandlerRegistry* registry = &document().frameHost()->eventHandlerRegistry();
+ if (hasTouchEventHandler)
+ registry->didAddEventHandler(*this, EventHandlerRegistry::TouchEvent);
+ else
+ registry->didRemoveEventHandler(*this, EventHandlerRegistry::TouchEvent);
+ }
m_hasTouchEventHandler = hasTouchEventHandler;
}
@@ -1434,11 +1438,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);
}

Powered by Google App Engine
This is Rietveld 408576698