Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 , m_isChecked(false) | 106 , m_isChecked(false) |
| 107 , m_dirtyCheckedness(false) | 107 , m_dirtyCheckedness(false) |
| 108 , m_isIndeterminate(false) | 108 , m_isIndeterminate(false) |
| 109 , m_isActivatedSubmit(false) | 109 , m_isActivatedSubmit(false) |
| 110 , m_autocomplete(Uninitialized) | 110 , m_autocomplete(Uninitialized) |
| 111 , m_hasNonEmptyList(false) | 111 , m_hasNonEmptyList(false) |
| 112 , m_stateRestored(false) | 112 , m_stateRestored(false) |
| 113 , m_parsingInProgress(createdByParser) | 113 , m_parsingInProgress(createdByParser) |
| 114 , m_valueAttributeWasUpdatedAfterParsing(false) | 114 , m_valueAttributeWasUpdatedAfterParsing(false) |
| 115 , m_canReceiveDroppedFiles(false) | 115 , m_canReceiveDroppedFiles(false) |
| 116 , m_hasTouchEventHandler(false) | |
| 117 , m_shouldRevealPassword(false) | 116 , m_shouldRevealPassword(false) |
| 118 , m_needsToUpdateViewValue(true) | 117 , m_needsToUpdateViewValue(true) |
| 119 , m_isPlaceholderVisible(false) | 118 , m_isPlaceholderVisible(false) |
| 119 , m_touchEventHandlerType(NoHandler) | |
| 120 // |m_inputType| is lazily created when constructed by the parser to avoid | 120 // |m_inputType| is lazily created when constructed by the parser to avoid |
| 121 // constructing unnecessarily a text inputType and its shadow subtree, just | 121 // constructing unnecessarily a text inputType and its shadow subtree, just |
| 122 // to destroy them when the |type| attribute gets set by the parser to | 122 // to destroy them when the |type| attribute gets set by the parser to |
| 123 // something else than 'text'. | 123 // something else than 'text'. |
| 124 , m_inputType(createdByParser ? nullptr : InputType::createText(*this)) | 124 , m_inputType(createdByParser ? nullptr : InputType::createText(*this)) |
| 125 , m_inputTypeView(m_inputType ? m_inputType->createView() : nullptr) | 125 , m_inputTypeView(m_inputType ? m_inputType->createView() : nullptr) |
| 126 { | 126 { |
| 127 setHasCustomStyleCallbacks(); | 127 setHasCustomStyleCallbacks(); |
| 128 } | 128 } |
| 129 | 129 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 398 | 398 |
| 399 void HTMLInputElement::setType(const AtomicString& type) | 399 void HTMLInputElement::setType(const AtomicString& type) |
| 400 { | 400 { |
| 401 setAttribute(typeAttr, type); | 401 setAttribute(typeAttr, type); |
| 402 } | 402 } |
| 403 | 403 |
| 404 void HTMLInputElement::updateTouchEventHandlerRegistry() | 404 void HTMLInputElement::updateTouchEventHandlerRegistry() |
| 405 { | 405 { |
| 406 ASSERT(m_inputTypeView); | 406 ASSERT(m_inputTypeView); |
| 407 | 407 |
| 408 bool hasTouchEventHandler = m_inputTypeView->hasTouchEventHandler(); | 408 TouchHandlerType touchEventHandlerType = m_inputTypeView->touchEventHandlerT ype(); |
| 409 if (hasTouchEventHandler == !!m_hasTouchEventHandler) | 409 if (touchEventHandlerType == m_touchEventHandlerType) |
| 410 return; | 410 return; |
| 411 // If the Document is being or has been stopped, don't register any handlers . | 411 // If the Document is being or has been stopped, don't register any handlers . |
| 412 if (document().frameHost() && document().lifecycle().state() < DocumentLifec ycle::Stopping) { | 412 if (document().frameHost() && document().lifecycle().state() < DocumentLifec ycle::Stopping) { |
| 413 EventHandlerRegistry& registry = document().frameHost()->eventHandlerReg istry(); | 413 EventHandlerRegistry& registry = document().frameHost()->eventHandlerReg istry(); |
| 414 // TODO(dtapuska): Make this passive touch listener see crbug.com/584438 | 414 // TODO(dtapuska): Make this passive touch listener see crbug.com/584438 |
|
majidvp
2016/08/04 21:21:58
I think this TODO is no longer applicable once you
| |
| 415 if (hasTouchEventHandler) | 415 if (touchEventHandlerType == Passive) |
| 416 registry.didAddEventHandler(*this, EventHandlerRegistry::TouchStartO rMoveEventBlocking); | 416 registry.didAddEventHandler(*this, EventHandlerRegistry::TouchStartO rMoveEventPassive); |
| 417 else | 417 else |
| 418 registry.didRemoveEventHandler(*this, EventHandlerRegistry::TouchSta rtOrMoveEventBlocking); | 418 registry.didRemoveEventHandler(*this, EventHandlerRegistry::TouchSta rtOrMoveEventPassive); |
| 419 m_hasTouchEventHandler = hasTouchEventHandler; | 419 m_touchEventHandlerType = touchEventHandlerType; |
| 420 } | 420 } |
| 421 } | 421 } |
| 422 | 422 |
| 423 void HTMLInputElement::initializeTypeInParsing() | 423 void HTMLInputElement::initializeTypeInParsing() |
| 424 { | 424 { |
| 425 ASSERT(m_parsingInProgress); | 425 ASSERT(m_parsingInProgress); |
| 426 ASSERT(!m_inputType); | 426 ASSERT(!m_inputType); |
| 427 ASSERT(!m_inputTypeView); | 427 ASSERT(!m_inputTypeView); |
| 428 | 428 |
| 429 const AtomicString& newTypeName = InputType::normalizeTypeName(fastGetAttrib ute(typeAttr)); | 429 const AtomicString& newTypeName = InputType::normalizeTypeName(fastGetAttrib ute(typeAttr)); |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1154 } | 1154 } |
| 1155 | 1155 |
| 1156 void HTMLInputElement::defaultEventHandler(Event* evt) | 1156 void HTMLInputElement::defaultEventHandler(Event* evt) |
| 1157 { | 1157 { |
| 1158 if (evt->isMouseEvent() && evt->type() == EventTypeNames::click && toMouseEv ent(evt)->button() == LeftButton) { | 1158 if (evt->isMouseEvent() && evt->type() == EventTypeNames::click && toMouseEv ent(evt)->button() == LeftButton) { |
| 1159 m_inputTypeView->handleClickEvent(toMouseEvent(evt)); | 1159 m_inputTypeView->handleClickEvent(toMouseEvent(evt)); |
| 1160 if (evt->defaultHandled()) | 1160 if (evt->defaultHandled()) |
| 1161 return; | 1161 return; |
| 1162 } | 1162 } |
| 1163 | 1163 |
| 1164 if (evt->isTouchEvent() && m_inputTypeView->hasTouchEventHandler()) { | 1164 if (evt->isTouchEvent() && m_inputTypeView->touchEventHandlerType() == Passi ve) { |
| 1165 m_inputTypeView->handleTouchEvent(toTouchEvent(evt)); | 1165 m_inputTypeView->handleTouchEvent(toTouchEvent(evt)); |
| 1166 if (evt->defaultHandled()) | 1166 if (evt->defaultHandled()) |
| 1167 return; | 1167 return; |
| 1168 } | 1168 } |
| 1169 | 1169 |
| 1170 if (evt->isKeyboardEvent() && evt->type() == EventTypeNames::keydown) { | 1170 if (evt->isKeyboardEvent() && evt->type() == EventTypeNames::keydown) { |
| 1171 m_inputTypeView->handleKeydownEvent(toKeyboardEvent(evt)); | 1171 m_inputTypeView->handleKeydownEvent(toKeyboardEvent(evt)); |
| 1172 if (evt->defaultHandled()) | 1172 if (evt->defaultHandled()) |
| 1173 return; | 1173 return; |
| 1174 } | 1174 } |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1507 treeScope().radioButtonGroupScope().removeButton(this); | 1507 treeScope().radioButtonGroupScope().removeButton(this); |
| 1508 | 1508 |
| 1509 updateTouchEventHandlerRegistry(); | 1509 updateTouchEventHandlerRegistry(); |
| 1510 | 1510 |
| 1511 HTMLTextFormControlElement::didMoveToNewDocument(oldDocument); | 1511 HTMLTextFormControlElement::didMoveToNewDocument(oldDocument); |
| 1512 } | 1512 } |
| 1513 | 1513 |
| 1514 void HTMLInputElement::removeAllEventListeners() | 1514 void HTMLInputElement::removeAllEventListeners() |
| 1515 { | 1515 { |
| 1516 HTMLTextFormControlElement::removeAllEventListeners(); | 1516 HTMLTextFormControlElement::removeAllEventListeners(); |
| 1517 m_hasTouchEventHandler = false; | 1517 m_touchEventHandlerType = NoHandler; |
| 1518 } | 1518 } |
| 1519 | 1519 |
| 1520 bool HTMLInputElement::recalcWillValidate() const | 1520 bool HTMLInputElement::recalcWillValidate() const |
| 1521 { | 1521 { |
| 1522 return m_inputType->supportsValidation() && HTMLTextFormControlElement::reca lcWillValidate(); | 1522 return m_inputType->supportsValidation() && HTMLTextFormControlElement::reca lcWillValidate(); |
| 1523 } | 1523 } |
| 1524 | 1524 |
| 1525 void HTMLInputElement::requiredAttributeChanged() | 1525 void HTMLInputElement::requiredAttributeChanged() |
| 1526 { | 1526 { |
| 1527 HTMLTextFormControlElement::requiredAttributeChanged(); | 1527 HTMLTextFormControlElement::requiredAttributeChanged(); |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1914 { | 1914 { |
| 1915 return m_inputTypeView->hasFallbackContent(); | 1915 return m_inputTypeView->hasFallbackContent(); |
| 1916 } | 1916 } |
| 1917 | 1917 |
| 1918 void HTMLInputElement::setFilesFromPaths(const Vector<String>& paths) | 1918 void HTMLInputElement::setFilesFromPaths(const Vector<String>& paths) |
| 1919 { | 1919 { |
| 1920 return m_inputType->setFilesFromPaths(paths); | 1920 return m_inputType->setFilesFromPaths(paths); |
| 1921 } | 1921 } |
| 1922 | 1922 |
| 1923 } // namespace blink | 1923 } // namespace blink |
| OLD | NEW |