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

Side by Side Diff: Source/WebCore/html/HTMLInputElement.cpp

Issue 14296003: Remove TOUCH_EVENTS and TOUCH_EVENT_TRACKING compile-time flags. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
8 * Copyright (C) 2010 Google Inc. All rights reserved. 8 * Copyright (C) 2010 Google Inc. All rights reserved.
9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #include "MouseEvent.h" 60 #include "MouseEvent.h"
61 #include "PlatformLocale.h" 61 #include "PlatformLocale.h"
62 #include "RenderTextControlSingleLine.h" 62 #include "RenderTextControlSingleLine.h"
63 #include "RenderTheme.h" 63 #include "RenderTheme.h"
64 #include "RuntimeEnabledFeatures.h" 64 #include "RuntimeEnabledFeatures.h"
65 #include "ScopedEventQueue.h" 65 #include "ScopedEventQueue.h"
66 #include "SearchInputType.h" 66 #include "SearchInputType.h"
67 #include "ShadowRoot.h" 67 #include "ShadowRoot.h"
68 #include "ScriptEventListener.h" 68 #include "ScriptEventListener.h"
69 #include "StyleResolver.h" 69 #include "StyleResolver.h"
70 #include "TouchEvent.h"
70 #include <wtf/MathExtras.h> 71 #include <wtf/MathExtras.h>
71 #include <wtf/StdLibExtras.h> 72 #include <wtf/StdLibExtras.h>
72 73
73 #if ENABLE(INPUT_TYPE_COLOR) 74 #if ENABLE(INPUT_TYPE_COLOR)
74 #include "ColorInputType.h" 75 #include "ColorInputType.h"
75 #endif 76 #endif
76 77
77 #if ENABLE(INPUT_SPEECH) 78 #if ENABLE(INPUT_SPEECH)
78 #include "RuntimeEnabledFeatures.h" 79 #include "RuntimeEnabledFeatures.h"
79 #endif 80 #endif
80 81
81 #if ENABLE(TOUCH_EVENTS)
82 #include "TouchEvent.h"
83 #endif
84
85 using namespace std; 82 using namespace std;
86 83
87 namespace WebCore { 84 namespace WebCore {
88 85
89 using namespace HTMLNames; 86 using namespace HTMLNames;
90 87
91 #if ENABLE(DATALIST_ELEMENT) 88 #if ENABLE(DATALIST_ELEMENT)
92 class ListAttributeTargetObserver : IdTargetObserver { 89 class ListAttributeTargetObserver : IdTargetObserver {
93 WTF_MAKE_FAST_ALLOCATED; 90 WTF_MAKE_FAST_ALLOCATED;
94 public: 91 public:
(...skipping 28 matching lines...) Expand all
123 , m_autocomplete(Uninitialized) 120 , m_autocomplete(Uninitialized)
124 , m_isAutofilled(false) 121 , m_isAutofilled(false)
125 #if ENABLE(DATALIST_ELEMENT) 122 #if ENABLE(DATALIST_ELEMENT)
126 , m_hasNonEmptyList(false) 123 , m_hasNonEmptyList(false)
127 #endif 124 #endif
128 , m_stateRestored(false) 125 , m_stateRestored(false)
129 , m_parsingInProgress(createdByParser) 126 , m_parsingInProgress(createdByParser)
130 , m_valueAttributeWasUpdatedAfterParsing(false) 127 , m_valueAttributeWasUpdatedAfterParsing(false)
131 , m_wasModifiedByUser(false) 128 , m_wasModifiedByUser(false)
132 , m_canReceiveDroppedFiles(false) 129 , m_canReceiveDroppedFiles(false)
133 #if ENABLE(TOUCH_EVENTS)
134 , m_hasTouchEventHandler(false) 130 , m_hasTouchEventHandler(false)
135 #endif
136 , m_inputType(InputType::createText(this)) 131 , m_inputType(InputType::createText(this))
137 { 132 {
138 ASSERT(hasTagName(inputTag) || hasTagName(isindexTag)); 133 ASSERT(hasTagName(inputTag) || hasTagName(isindexTag));
139 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 134 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
140 setHasCustomStyleCallbacks(); 135 setHasCustomStyleCallbacks();
141 #endif 136 #endif
142 ScriptWrappable::init(this); 137 ScriptWrappable::init(this);
143 } 138 }
144 139
145 PassRefPtr<HTMLInputElement> HTMLInputElement::create(const QualifiedName& tagNa me, Document* document, HTMLFormElement* form, bool createdByParser) 140 PassRefPtr<HTMLInputElement> HTMLInputElement::create(const QualifiedName& tagNa me, Document* document, HTMLFormElement* form, bool createdByParser)
(...skipping 20 matching lines...) Expand all
166 if (needsSuspensionCallback()) 161 if (needsSuspensionCallback())
167 document()->unregisterForPageCacheSuspensionCallbacks(this); 162 document()->unregisterForPageCacheSuspensionCallbacks(this);
168 163
169 // Need to remove form association while this is still an HTMLInputElement 164 // Need to remove form association while this is still an HTMLInputElement
170 // so that virtual functions are called correctly. 165 // so that virtual functions are called correctly.
171 setForm(0); 166 setForm(0);
172 // setForm(0) may register this to a document-level radio button group. 167 // setForm(0) may register this to a document-level radio button group.
173 // We should unregister it to avoid accessing a deleted object. 168 // We should unregister it to avoid accessing a deleted object.
174 if (isRadioButton()) 169 if (isRadioButton())
175 document()->formController()->checkedRadioButtons().removeButton(this); 170 document()->formController()->checkedRadioButtons().removeButton(this);
176 #if ENABLE(TOUCH_EVENTS)
177 if (m_hasTouchEventHandler) 171 if (m_hasTouchEventHandler)
178 document()->didRemoveEventTargetNode(this); 172 document()->didRemoveEventTargetNode(this);
179 #endif
180 } 173 }
181 174
182 const AtomicString& HTMLInputElement::name() const 175 const AtomicString& HTMLInputElement::name() const
183 { 176 {
184 return m_name.isNull() ? emptyAtom : m_name; 177 return m_name.isNull() ? emptyAtom : m_name;
185 } 178 }
186 179
187 Vector<FileChooserFileInfo> HTMLInputElement::filesFromFileInputFormControlState (const FormControlState& state) 180 Vector<FileChooserFileInfo> HTMLInputElement::filesFromFileInputFormControlState (const FormControlState& state)
188 { 181 {
189 return FileInputType::filesFromFormControlState(state); 182 return FileInputType::filesFromFormControlState(state);
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 469
477 m_inputType->destroyShadowSubtree(); 470 m_inputType->destroyShadowSubtree();
478 471
479 bool wasAttached = attached(); 472 bool wasAttached = attached();
480 if (wasAttached) 473 if (wasAttached)
481 detach(); 474 detach();
482 475
483 m_inputType = newType.release(); 476 m_inputType = newType.release();
484 m_inputType->createShadowSubtree(); 477 m_inputType->createShadowSubtree();
485 478
486 #if ENABLE(TOUCH_EVENTS)
487 bool hasTouchEventHandler = m_inputType->hasTouchEventHandler(); 479 bool hasTouchEventHandler = m_inputType->hasTouchEventHandler();
488 if (hasTouchEventHandler != m_hasTouchEventHandler) { 480 if (hasTouchEventHandler != m_hasTouchEventHandler) {
489 if (hasTouchEventHandler) 481 if (hasTouchEventHandler)
490 document()->didAddTouchEventHandler(this); 482 document()->didAddTouchEventHandler(this);
491 else 483 else
492 document()->didRemoveTouchEventHandler(this); 484 document()->didRemoveTouchEventHandler(this);
493 m_hasTouchEventHandler = hasTouchEventHandler; 485 m_hasTouchEventHandler = hasTouchEventHandler;
494 } 486 }
495 #endif
496 487
497 setNeedsWillValidateCheck(); 488 setNeedsWillValidateCheck();
498 489
499 bool willStoreValue = m_inputType->storesValueSeparateFromAttribute(); 490 bool willStoreValue = m_inputType->storesValueSeparateFromAttribute();
500 491
501 if (didStoreValue && !willStoreValue && hasDirtyValue()) { 492 if (didStoreValue && !willStoreValue && hasDirtyValue()) {
502 setAttribute(valueAttr, m_valueIfDirty); 493 setAttribute(valueAttr, m_valueIfDirty);
503 m_valueIfDirty = String(); 494 m_valueIfDirty = String();
504 } 495 }
505 if (!didStoreValue && willStoreValue) { 496 if (!didStoreValue && willStoreValue) {
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 } 1116 }
1126 1117
1127 void HTMLInputElement::defaultEventHandler(Event* evt) 1118 void HTMLInputElement::defaultEventHandler(Event* evt)
1128 { 1119 {
1129 if (evt->isMouseEvent() && evt->type() == eventNames().clickEvent && static_ cast<MouseEvent*>(evt)->button() == LeftButton) { 1120 if (evt->isMouseEvent() && evt->type() == eventNames().clickEvent && static_ cast<MouseEvent*>(evt)->button() == LeftButton) {
1130 m_inputType->handleClickEvent(static_cast<MouseEvent*>(evt)); 1121 m_inputType->handleClickEvent(static_cast<MouseEvent*>(evt));
1131 if (evt->defaultHandled()) 1122 if (evt->defaultHandled())
1132 return; 1123 return;
1133 } 1124 }
1134 1125
1135 #if ENABLE(TOUCH_EVENTS)
1136 if (evt->isTouchEvent()) { 1126 if (evt->isTouchEvent()) {
1137 m_inputType->handleTouchEvent(static_cast<TouchEvent*>(evt)); 1127 m_inputType->handleTouchEvent(static_cast<TouchEvent*>(evt));
1138 if (evt->defaultHandled()) 1128 if (evt->defaultHandled())
1139 return; 1129 return;
1140 } 1130 }
1141 #endif
1142 1131
1143 if (evt->isKeyboardEvent() && evt->type() == eventNames().keydownEvent) { 1132 if (evt->isKeyboardEvent() && evt->type() == eventNames().keydownEvent) {
1144 m_inputType->handleKeydownEvent(static_cast<KeyboardEvent*>(evt)); 1133 m_inputType->handleKeydownEvent(static_cast<KeyboardEvent*>(evt));
1145 if (evt->defaultHandled()) 1134 if (evt->defaultHandled())
1146 return; 1135 return;
1147 } 1136 }
1148 1137
1149 // Call the base event handler before any of our own event handling for almo st all events in text fields. 1138 // Call the base event handler before any of our own event handling for almo st all events in text fields.
1150 // Makes editing keyboard handling take precedence over the keydown and keyp ress handling in this function. 1139 // Makes editing keyboard handling take precedence over the keydown and keyp ress handling in this function.
1151 bool callBaseClassEarly = isTextField() && (evt->type() == eventNames().keyd ownEvent || evt->type() == eventNames().keypressEvent); 1140 bool callBaseClassEarly = isTextField() && (evt->type() == eventNames().keyd ownEvent || evt->type() == eventNames().keypressEvent);
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1519 if (hasImageLoader()) 1508 if (hasImageLoader())
1520 imageLoader()->elementDidMoveToNewDocument(); 1509 imageLoader()->elementDidMoveToNewDocument();
1521 1510
1522 bool needsSuspensionCallback = this->needsSuspensionCallback(); 1511 bool needsSuspensionCallback = this->needsSuspensionCallback();
1523 if (oldDocument) { 1512 if (oldDocument) {
1524 // Always unregister for cache callbacks when leaving a document, even i f we would otherwise like to be registered 1513 // Always unregister for cache callbacks when leaving a document, even i f we would otherwise like to be registered
1525 if (needsSuspensionCallback) 1514 if (needsSuspensionCallback)
1526 oldDocument->unregisterForPageCacheSuspensionCallbacks(this); 1515 oldDocument->unregisterForPageCacheSuspensionCallbacks(this);
1527 if (isRadioButton()) 1516 if (isRadioButton())
1528 oldDocument->formController()->checkedRadioButtons().removeButton(th is); 1517 oldDocument->formController()->checkedRadioButtons().removeButton(th is);
1529 #if ENABLE(TOUCH_EVENTS)
1530 if (m_hasTouchEventHandler) 1518 if (m_hasTouchEventHandler)
1531 oldDocument->didRemoveEventTargetNode(this); 1519 oldDocument->didRemoveEventTargetNode(this);
1532 #endif
1533 } 1520 }
1534 1521
1535 if (needsSuspensionCallback) 1522 if (needsSuspensionCallback)
1536 document()->registerForPageCacheSuspensionCallbacks(this); 1523 document()->registerForPageCacheSuspensionCallbacks(this);
1537 1524
1538 #if ENABLE(TOUCH_EVENTS)
1539 if (m_hasTouchEventHandler) 1525 if (m_hasTouchEventHandler)
1540 document()->didAddTouchEventHandler(this); 1526 document()->didAddTouchEventHandler(this);
1541 #endif
1542 1527
1543 HTMLTextFormControlElement::didMoveToNewDocument(oldDocument); 1528 HTMLTextFormControlElement::didMoveToNewDocument(oldDocument);
1544 } 1529 }
1545 1530
1546 void HTMLInputElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) cons t 1531 void HTMLInputElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) cons t
1547 { 1532 {
1548 HTMLTextFormControlElement::addSubresourceAttributeURLs(urls); 1533 HTMLTextFormControlElement::addSubresourceAttributeURLs(urls);
1549 1534
1550 addSubresourceURL(urls, src()); 1535 addSubresourceURL(urls, src());
1551 } 1536 }
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1970 } 1955 }
1971 1956
1972 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 1957 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
1973 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() 1958 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer()
1974 { 1959 {
1975 return m_inputType->customStyleForRenderer(document()->styleResolver()->styl eForElement(this)); 1960 return m_inputType->customStyleForRenderer(document()->styleResolver()->styl eForElement(this));
1976 } 1961 }
1977 #endif 1962 #endif
1978 1963
1979 } // namespace 1964 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698