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

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

Issue 225903009: Migrate touch events to EventHandlerRegistry (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed HTMLInputElement adding handler at document destruction and removed dead oilpan code. Created 6 years, 5 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
« no previous file with comments | « Source/core/frame/LocalDOMWindow.cpp ('k') | Source/core/page/EventHandler.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "core/dom/shadow/InsertionPoint.h" 42 #include "core/dom/shadow/InsertionPoint.h"
43 #include "core/dom/shadow/ShadowRoot.h" 43 #include "core/dom/shadow/ShadowRoot.h"
44 #include "core/editing/FrameSelection.h" 44 #include "core/editing/FrameSelection.h"
45 #include "core/editing/SpellChecker.h" 45 #include "core/editing/SpellChecker.h"
46 #include "core/events/BeforeTextInsertedEvent.h" 46 #include "core/events/BeforeTextInsertedEvent.h"
47 #include "core/events/KeyboardEvent.h" 47 #include "core/events/KeyboardEvent.h"
48 #include "core/events/MouseEvent.h" 48 #include "core/events/MouseEvent.h"
49 #include "core/events/ScopedEventQueue.h" 49 #include "core/events/ScopedEventQueue.h"
50 #include "core/events/TouchEvent.h" 50 #include "core/events/TouchEvent.h"
51 #include "core/fileapi/FileList.h" 51 #include "core/fileapi/FileList.h"
52 #include "core/frame/EventHandlerRegistry.h"
52 #include "core/frame/FrameHost.h" 53 #include "core/frame/FrameHost.h"
53 #include "core/frame/FrameView.h" 54 #include "core/frame/FrameView.h"
54 #include "core/frame/LocalFrame.h" 55 #include "core/frame/LocalFrame.h"
55 #include "core/frame/UseCounter.h" 56 #include "core/frame/UseCounter.h"
56 #include "core/html/HTMLCollection.h" 57 #include "core/html/HTMLCollection.h"
57 #include "core/html/HTMLDataListElement.h" 58 #include "core/html/HTMLDataListElement.h"
58 #include "core/html/HTMLFormElement.h" 59 #include "core/html/HTMLFormElement.h"
59 #include "core/html/HTMLImageLoader.h" 60 #include "core/html/HTMLImageLoader.h"
60 #include "core/html/HTMLOptionElement.h" 61 #include "core/html/HTMLOptionElement.h"
61 #include "core/html/forms/ColorInputType.h" 62 #include "core/html/forms/ColorInputType.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 HTMLInputElement::~HTMLInputElement() 168 HTMLInputElement::~HTMLInputElement()
168 { 169 {
169 #if !ENABLE(OILPAN) 170 #if !ENABLE(OILPAN)
170 // Need to remove form association while this is still an HTMLInputElement 171 // Need to remove form association while this is still an HTMLInputElement
171 // so that virtual functions are called correctly. 172 // so that virtual functions are called correctly.
172 setForm(0); 173 setForm(0);
173 // setForm(0) may register this to a document-level radio button group. 174 // setForm(0) may register this to a document-level radio button group.
174 // We should unregister it to avoid accessing a deleted object. 175 // We should unregister it to avoid accessing a deleted object.
175 if (isRadioButton()) 176 if (isRadioButton())
176 document().formController().radioButtonGroupScope().removeButton(this); 177 document().formController().radioButtonGroupScope().removeButton(this);
177 if (m_hasTouchEventHandler) 178 if (m_hasTouchEventHandler && document().frameHost())
178 document().didRemoveTouchEventHandler(this); 179 document().frameHost()->eventHandlerRegistry().didRemoveEventHandler(*th is, EventHandlerRegistry::TouchEvent);
179 #endif 180 #endif
180 } 181 }
181 182
182 const AtomicString& HTMLInputElement::name() const 183 const AtomicString& HTMLInputElement::name() const
183 { 184 {
184 return m_name.isNull() ? emptyAtom : m_name; 185 return m_name.isNull() ? emptyAtom : m_name;
185 } 186 }
186 187
187 Vector<FileChooserFileInfo> HTMLInputElement::filesFromFileInputFormControlState (const FormControlState& state) 188 Vector<FileChooserFileInfo> HTMLInputElement::filesFromFileInputFormControlState (const FormControlState& state)
188 { 189 {
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 420
420 m_inputType = newType.release(); 421 m_inputType = newType.release();
421 if (hasAuthorShadowRoot()) 422 if (hasAuthorShadowRoot())
422 m_inputTypeView = InputTypeView::create(*this); 423 m_inputTypeView = InputTypeView::create(*this);
423 else 424 else
424 m_inputTypeView = m_inputType; 425 m_inputTypeView = m_inputType;
425 m_inputTypeView->createShadowSubtree(); 426 m_inputTypeView->createShadowSubtree();
426 427
427 bool hasTouchEventHandler = m_inputTypeView->hasTouchEventHandler(); 428 bool hasTouchEventHandler = m_inputTypeView->hasTouchEventHandler();
428 if (hasTouchEventHandler != m_hasTouchEventHandler) { 429 if (hasTouchEventHandler != m_hasTouchEventHandler) {
429 if (hasTouchEventHandler) 430 if (document().frameHost() && document().isActive()) {
Rick Byers 2014/07/01 18:21:33 Looks like this change will also skip updating the
430 document().didAddTouchEventHandler(this); 431 EventHandlerRegistry& registry = document().frameHost()->eventHandle rRegistry();
431 else 432 if (hasTouchEventHandler)
432 document().didRemoveTouchEventHandler(this); 433 registry.didAddEventHandler(*this, EventHandlerRegistry::TouchEv ent);
434 else
435 registry.didRemoveEventHandler(*this, EventHandlerRegistry::Touc hEvent);
436 }
433 m_hasTouchEventHandler = hasTouchEventHandler; 437 m_hasTouchEventHandler = hasTouchEventHandler;
434 } 438 }
435 439
436 setNeedsWillValidateCheck(); 440 setNeedsWillValidateCheck();
437 441
438 bool willStoreValue = m_inputType->storesValueSeparateFromAttribute(); 442 bool willStoreValue = m_inputType->storesValueSeparateFromAttribute();
439 443
440 if (didStoreValue && !willStoreValue && hasDirtyValue()) { 444 if (didStoreValue && !willStoreValue && hasDirtyValue()) {
441 setAttribute(valueAttr, AtomicString(m_valueIfDirty)); 445 setAttribute(valueAttr, AtomicString(m_valueIfDirty));
442 m_valueIfDirty = String(); 446 m_valueIfDirty = String();
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 resetListAttributeTargetObserver(); 1432 resetListAttributeTargetObserver();
1429 } 1433 }
1430 1434
1431 void HTMLInputElement::didMoveToNewDocument(Document& oldDocument) 1435 void HTMLInputElement::didMoveToNewDocument(Document& oldDocument)
1432 { 1436 {
1433 if (hasImageLoader()) 1437 if (hasImageLoader())
1434 imageLoader()->elementDidMoveToNewDocument(); 1438 imageLoader()->elementDidMoveToNewDocument();
1435 1439
1436 if (isRadioButton()) 1440 if (isRadioButton())
1437 oldDocument.formController().radioButtonGroupScope().removeButton(this); 1441 oldDocument.formController().radioButtonGroupScope().removeButton(this);
1438 if (m_hasTouchEventHandler)
1439 oldDocument.didRemoveTouchEventHandler(this);
1440
1441 if (m_hasTouchEventHandler)
1442 document().didAddTouchEventHandler(this);
1443 1442
1444 HTMLTextFormControlElement::didMoveToNewDocument(oldDocument); 1443 HTMLTextFormControlElement::didMoveToNewDocument(oldDocument);
1445 } 1444 }
1446 1445
1447 void HTMLInputElement::removeAllEventListeners() 1446 void HTMLInputElement::removeAllEventListeners()
1448 { 1447 {
1449 HTMLTextFormControlElement::removeAllEventListeners(); 1448 HTMLTextFormControlElement::removeAllEventListeners();
1450 m_hasTouchEventHandler = false; 1449 m_hasTouchEventHandler = false;
1451 } 1450 }
1452 1451
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1858 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); 1857 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer());
1859 } 1858 }
1860 #endif 1859 #endif
1861 1860
1862 bool HTMLInputElement::shouldDispatchFormControlChangeEvent(String& oldValue, St ring& newValue) 1861 bool HTMLInputElement::shouldDispatchFormControlChangeEvent(String& oldValue, St ring& newValue)
1863 { 1862 {
1864 return m_inputType->shouldDispatchFormControlChangeEvent(oldValue, newValue) ; 1863 return m_inputType->shouldDispatchFormControlChangeEvent(oldValue, newValue) ;
1865 } 1864 }
1866 1865
1867 } // namespace 1866 } // namespace
OLDNEW
« no previous file with comments | « Source/core/frame/LocalDOMWindow.cpp ('k') | Source/core/page/EventHandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698