Index: Source/core/html/HTMLInputElement.cpp |
diff --git a/Source/core/html/HTMLInputElement.cpp b/Source/core/html/HTMLInputElement.cpp |
index b3232c0695529d5dc5ca207dadc5fff5d38219f3..11076c5977ed2555a59036b9acbc1b37dce5c757 100644 |
--- a/Source/core/html/HTMLInputElement.cpp |
+++ b/Source/core/html/HTMLInputElement.cpp |
@@ -70,7 +70,6 @@ |
#include "ShadowRoot.h" |
#include "ScriptEventListener.h" |
#include "StyleResolver.h" |
-#include "TouchEvent.h" |
#include <wtf/MathExtras.h> |
#include <wtf/StdLibExtras.h> |
@@ -82,6 +81,10 @@ |
#include "RuntimeEnabledFeatures.h" |
#endif |
+#if ENABLE(TOUCH_EVENTS) |
+#include "TouchEvent.h" |
+#endif |
+ |
using namespace std; |
namespace WebCore { |
@@ -130,7 +133,9 @@ HTMLInputElement::HTMLInputElement(const QualifiedName& tagName, Document* docum |
, m_valueAttributeWasUpdatedAfterParsing(false) |
, m_wasModifiedByUser(false) |
, m_canReceiveDroppedFiles(false) |
+#if ENABLE(TOUCH_EVENTS) |
, m_hasTouchEventHandler(false) |
+#endif |
, m_inputType(InputType::createText(this)) |
{ |
ASSERT(hasTagName(inputTag) || hasTagName(isindexTag)); |
@@ -171,8 +176,10 @@ HTMLInputElement::~HTMLInputElement() |
// We should unregister it to avoid accessing a deleted object. |
if (isRadioButton()) |
document()->formController()->checkedRadioButtons().removeButton(this); |
+#if ENABLE(TOUCH_EVENTS) |
if (m_hasTouchEventHandler) |
document()->didRemoveEventTargetNode(this); |
+#endif |
} |
const AtomicString& HTMLInputElement::name() const |
@@ -479,6 +486,7 @@ void HTMLInputElement::updateType() |
m_inputType = newType.release(); |
m_inputType->createShadowSubtree(); |
+#if ENABLE(TOUCH_EVENTS) |
bool hasTouchEventHandler = m_inputType->hasTouchEventHandler(); |
if (hasTouchEventHandler != m_hasTouchEventHandler) { |
if (hasTouchEventHandler) |
@@ -487,6 +495,7 @@ void HTMLInputElement::updateType() |
document()->didRemoveTouchEventHandler(this); |
m_hasTouchEventHandler = hasTouchEventHandler; |
} |
+#endif |
setNeedsWillValidateCheck(); |
@@ -1126,11 +1135,13 @@ void HTMLInputElement::defaultEventHandler(Event* evt) |
return; |
} |
+#if ENABLE(TOUCH_EVENTS) |
if (evt->isTouchEvent()) { |
m_inputType->handleTouchEvent(static_cast<TouchEvent*>(evt)); |
if (evt->defaultHandled()) |
return; |
} |
+#endif |
if (evt->isKeyboardEvent() && evt->type() == eventNames().keydownEvent) { |
m_inputType->handleKeydownEvent(static_cast<KeyboardEvent*>(evt)); |
@@ -1518,15 +1529,19 @@ void HTMLInputElement::didMoveToNewDocument(Document* oldDocument) |
oldDocument->unregisterForPageCacheSuspensionCallbacks(this); |
if (isRadioButton()) |
oldDocument->formController()->checkedRadioButtons().removeButton(this); |
+#if ENABLE(TOUCH_EVENTS) |
if (m_hasTouchEventHandler) |
oldDocument->didRemoveEventTargetNode(this); |
+#endif |
} |
if (needsSuspensionCallback) |
document()->registerForPageCacheSuspensionCallbacks(this); |
+#if ENABLE(TOUCH_EVENTS) |
if (m_hasTouchEventHandler) |
document()->didAddTouchEventHandler(this); |
+#endif |
HTMLTextFormControlElement::didMoveToNewDocument(oldDocument); |
} |