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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLInputElement.cpp

Issue 2209773002: Remove the blocking touch handlers for the input[type=range] and add touch-action instead (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use better functions, structures and names Created 4 years, 4 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
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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) 116 , m_hasPassiveTouchEventHandler(false)
117 , m_shouldRevealPassword(false) 117 , m_shouldRevealPassword(false)
118 , m_needsToUpdateViewValue(true) 118 , m_needsToUpdateViewValue(true)
119 , m_isPlaceholderVisible(false) 119 , m_isPlaceholderVisible(false)
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 {
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 bool hasPassiveTouchEventHandler = m_inputTypeView->hasPassiveTouchEventHand ler();
409 if (hasTouchEventHandler == !!m_hasTouchEventHandler) 409 if (hasPassiveTouchEventHandler == !!m_hasPassiveTouchEventHandler)
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 if (hasPassiveTouchEventHandler)
415 if (hasTouchEventHandler) 415 registry.didAddEventHandler(*this, EventHandlerRegistry::TouchStartO rMoveEventPassive);
416 registry.didAddEventHandler(*this, EventHandlerRegistry::TouchStartO rMoveEventBlocking);
417 else 416 else
418 registry.didRemoveEventHandler(*this, EventHandlerRegistry::TouchSta rtOrMoveEventBlocking); 417 registry.didRemoveEventHandler(*this, EventHandlerRegistry::TouchSta rtOrMoveEventPassive);
419 m_hasTouchEventHandler = hasTouchEventHandler; 418 m_hasPassiveTouchEventHandler = hasPassiveTouchEventHandler;
420 } 419 }
421 } 420 }
422 421
423 void HTMLInputElement::initializeTypeInParsing() 422 void HTMLInputElement::initializeTypeInParsing()
424 { 423 {
425 ASSERT(m_parsingInProgress); 424 ASSERT(m_parsingInProgress);
426 ASSERT(!m_inputType); 425 ASSERT(!m_inputType);
427 ASSERT(!m_inputTypeView); 426 ASSERT(!m_inputTypeView);
428 427
429 const AtomicString& newTypeName = InputType::normalizeTypeName(fastGetAttrib ute(typeAttr)); 428 const AtomicString& newTypeName = InputType::normalizeTypeName(fastGetAttrib ute(typeAttr));
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 } 1153 }
1155 1154
1156 void HTMLInputElement::defaultEventHandler(Event* evt) 1155 void HTMLInputElement::defaultEventHandler(Event* evt)
1157 { 1156 {
1158 if (evt->isMouseEvent() && evt->type() == EventTypeNames::click && toMouseEv ent(evt)->button() == LeftButton) { 1157 if (evt->isMouseEvent() && evt->type() == EventTypeNames::click && toMouseEv ent(evt)->button() == LeftButton) {
1159 m_inputTypeView->handleClickEvent(toMouseEvent(evt)); 1158 m_inputTypeView->handleClickEvent(toMouseEvent(evt));
1160 if (evt->defaultHandled()) 1159 if (evt->defaultHandled())
1161 return; 1160 return;
1162 } 1161 }
1163 1162
1164 if (evt->isTouchEvent() && m_inputTypeView->hasTouchEventHandler()) { 1163 if (evt->isTouchEvent() && m_inputTypeView->hasPassiveTouchEventHandler()) {
1165 m_inputTypeView->handleTouchEvent(toTouchEvent(evt)); 1164 m_inputTypeView->handleTouchEvent(toTouchEvent(evt));
1166 if (evt->defaultHandled()) 1165 if (evt->defaultHandled())
1167 return; 1166 return;
1168 } 1167 }
1169 1168
1170 if (evt->isKeyboardEvent() && evt->type() == EventTypeNames::keydown) { 1169 if (evt->isKeyboardEvent() && evt->type() == EventTypeNames::keydown) {
1171 m_inputTypeView->handleKeydownEvent(toKeyboardEvent(evt)); 1170 m_inputTypeView->handleKeydownEvent(toKeyboardEvent(evt));
1172 if (evt->defaultHandled()) 1171 if (evt->defaultHandled())
1173 return; 1172 return;
1174 } 1173 }
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 treeScope().radioButtonGroupScope().removeButton(this); 1506 treeScope().radioButtonGroupScope().removeButton(this);
1508 1507
1509 updateTouchEventHandlerRegistry(); 1508 updateTouchEventHandlerRegistry();
1510 1509
1511 HTMLTextFormControlElement::didMoveToNewDocument(oldDocument); 1510 HTMLTextFormControlElement::didMoveToNewDocument(oldDocument);
1512 } 1511 }
1513 1512
1514 void HTMLInputElement::removeAllEventListeners() 1513 void HTMLInputElement::removeAllEventListeners()
1515 { 1514 {
1516 HTMLTextFormControlElement::removeAllEventListeners(); 1515 HTMLTextFormControlElement::removeAllEventListeners();
1517 m_hasTouchEventHandler = false; 1516 m_hasPassiveTouchEventHandler = false;
1518 } 1517 }
1519 1518
1520 bool HTMLInputElement::recalcWillValidate() const 1519 bool HTMLInputElement::recalcWillValidate() const
1521 { 1520 {
1522 return m_inputType->supportsValidation() && HTMLTextFormControlElement::reca lcWillValidate(); 1521 return m_inputType->supportsValidation() && HTMLTextFormControlElement::reca lcWillValidate();
1523 } 1522 }
1524 1523
1525 void HTMLInputElement::requiredAttributeChanged() 1524 void HTMLInputElement::requiredAttributeChanged()
1526 { 1525 {
1527 HTMLTextFormControlElement::requiredAttributeChanged(); 1526 HTMLTextFormControlElement::requiredAttributeChanged();
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
1914 { 1913 {
1915 return m_inputTypeView->hasFallbackContent(); 1914 return m_inputTypeView->hasFallbackContent();
1916 } 1915 }
1917 1916
1918 void HTMLInputElement::setFilesFromPaths(const Vector<String>& paths) 1917 void HTMLInputElement::setFilesFromPaths(const Vector<String>& paths)
1919 { 1918 {
1920 return m_inputType->setFilesFromPaths(paths); 1919 return m_inputType->setFilesFromPaths(paths);
1921 } 1920 }
1922 1921
1923 } // namespace blink 1922 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698