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

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: Fix indendation problems (added by meld?) Created 6 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 | 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "core/dom/shadow/InsertionPoint.h" 43 #include "core/dom/shadow/InsertionPoint.h"
44 #include "core/dom/shadow/ShadowRoot.h" 44 #include "core/dom/shadow/ShadowRoot.h"
45 #include "core/editing/FrameSelection.h" 45 #include "core/editing/FrameSelection.h"
46 #include "core/editing/SpellChecker.h" 46 #include "core/editing/SpellChecker.h"
47 #include "core/events/BeforeTextInsertedEvent.h" 47 #include "core/events/BeforeTextInsertedEvent.h"
48 #include "core/events/KeyboardEvent.h" 48 #include "core/events/KeyboardEvent.h"
49 #include "core/events/MouseEvent.h" 49 #include "core/events/MouseEvent.h"
50 #include "core/events/ScopedEventQueue.h" 50 #include "core/events/ScopedEventQueue.h"
51 #include "core/events/TouchEvent.h" 51 #include "core/events/TouchEvent.h"
52 #include "core/fileapi/FileList.h" 52 #include "core/fileapi/FileList.h"
53 #include "core/frame/EventHandlerRegistry.h"
53 #include "core/frame/FrameHost.h" 54 #include "core/frame/FrameHost.h"
54 #include "core/frame/FrameView.h" 55 #include "core/frame/FrameView.h"
55 #include "core/frame/LocalFrame.h" 56 #include "core/frame/LocalFrame.h"
56 #include "core/frame/UseCounter.h" 57 #include "core/frame/UseCounter.h"
57 #include "core/html/HTMLCollection.h" 58 #include "core/html/HTMLCollection.h"
58 #include "core/html/HTMLDataListElement.h" 59 #include "core/html/HTMLDataListElement.h"
59 #include "core/html/HTMLFormElement.h" 60 #include "core/html/HTMLFormElement.h"
60 #include "core/html/HTMLImageLoader.h" 61 #include "core/html/HTMLImageLoader.h"
61 #include "core/html/HTMLOptionElement.h" 62 #include "core/html/HTMLOptionElement.h"
62 #include "core/html/forms/ColorInputType.h" 63 #include "core/html/forms/ColorInputType.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 HTMLInputElement::~HTMLInputElement() 169 HTMLInputElement::~HTMLInputElement()
169 { 170 {
170 #if !ENABLE(OILPAN) 171 #if !ENABLE(OILPAN)
171 // Need to remove form association while this is still an HTMLInputElement 172 // Need to remove form association while this is still an HTMLInputElement
172 // so that virtual functions are called correctly. 173 // so that virtual functions are called correctly.
173 setForm(0); 174 setForm(0);
174 // setForm(0) may register this to a document-level radio button group. 175 // setForm(0) may register this to a document-level radio button group.
175 // We should unregister it to avoid accessing a deleted object. 176 // We should unregister it to avoid accessing a deleted object.
176 if (isRadioButton()) 177 if (isRadioButton())
177 document().formController().radioButtonGroupScope().removeButton(this); 178 document().formController().radioButtonGroupScope().removeButton(this);
178 if (m_hasTouchEventHandler) 179 if (m_hasTouchEventHandler && document().frameHost())
179 document().didRemoveTouchEventHandler(this); 180 document().frameHost()->eventHandlerRegistry().didRemoveEventHandler(*th is, EventHandlerRegistry::TouchEvent);
180 #endif 181 #endif
181 } 182 }
182 183
183 const AtomicString& HTMLInputElement::name() const 184 const AtomicString& HTMLInputElement::name() const
184 { 185 {
185 return m_name.isNull() ? emptyAtom : m_name; 186 return m_name.isNull() ? emptyAtom : m_name;
186 } 187 }
187 188
188 Vector<FileChooserFileInfo> HTMLInputElement::filesFromFileInputFormControlState (const FormControlState& state) 189 Vector<FileChooserFileInfo> HTMLInputElement::filesFromFileInputFormControlState (const FormControlState& state)
189 { 190 {
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 416
416 m_inputType = newType.release(); 417 m_inputType = newType.release();
417 if (hasAuthorShadowRoot()) 418 if (hasAuthorShadowRoot())
418 m_inputTypeView = InputTypeView::create(*this); 419 m_inputTypeView = InputTypeView::create(*this);
419 else 420 else
420 m_inputTypeView = m_inputType; 421 m_inputTypeView = m_inputType;
421 m_inputTypeView->createShadowSubtree(); 422 m_inputTypeView->createShadowSubtree();
422 423
423 bool hasTouchEventHandler = m_inputTypeView->hasTouchEventHandler(); 424 bool hasTouchEventHandler = m_inputTypeView->hasTouchEventHandler();
424 if (hasTouchEventHandler != m_hasTouchEventHandler) { 425 if (hasTouchEventHandler != m_hasTouchEventHandler) {
425 if (hasTouchEventHandler) 426 // If the Document is being or has been stopped, don't register any hand lers.
426 document().didAddTouchEventHandler(this); 427 if (document().frameHost() && document().lifecycle().state() < DocumentL ifecycle::Stopping) {
427 else 428 EventHandlerRegistry& registry = document().frameHost()->eventHandle rRegistry();
428 document().didRemoveTouchEventHandler(this); 429 if (hasTouchEventHandler)
430 registry.didAddEventHandler(*this, EventHandlerRegistry::TouchEv ent);
431 else
432 registry.didRemoveEventHandler(*this, EventHandlerRegistry::Touc hEvent);
433 }
429 m_hasTouchEventHandler = hasTouchEventHandler; 434 m_hasTouchEventHandler = hasTouchEventHandler;
430 } 435 }
431 436
432 setNeedsWillValidateCheck(); 437 setNeedsWillValidateCheck();
433 438
434 bool willStoreValue = m_inputType->storesValueSeparateFromAttribute(); 439 bool willStoreValue = m_inputType->storesValueSeparateFromAttribute();
435 440
436 if (didStoreValue && !willStoreValue && hasDirtyValue()) { 441 if (didStoreValue && !willStoreValue && hasDirtyValue()) {
437 setAttribute(valueAttr, AtomicString(m_valueIfDirty)); 442 setAttribute(valueAttr, AtomicString(m_valueIfDirty));
438 m_valueIfDirty = String(); 443 m_valueIfDirty = String();
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 resetListAttributeTargetObserver(); 1450 resetListAttributeTargetObserver();
1446 } 1451 }
1447 1452
1448 void HTMLInputElement::didMoveToNewDocument(Document& oldDocument) 1453 void HTMLInputElement::didMoveToNewDocument(Document& oldDocument)
1449 { 1454 {
1450 if (hasImageLoader()) 1455 if (hasImageLoader())
1451 imageLoader()->elementDidMoveToNewDocument(); 1456 imageLoader()->elementDidMoveToNewDocument();
1452 1457
1453 if (isRadioButton()) 1458 if (isRadioButton())
1454 oldDocument.formController().radioButtonGroupScope().removeButton(this); 1459 oldDocument.formController().radioButtonGroupScope().removeButton(this);
1455 if (m_hasTouchEventHandler)
1456 oldDocument.didRemoveTouchEventHandler(this);
1457
1458 if (m_hasTouchEventHandler)
1459 document().didAddTouchEventHandler(this);
1460 1460
1461 HTMLTextFormControlElement::didMoveToNewDocument(oldDocument); 1461 HTMLTextFormControlElement::didMoveToNewDocument(oldDocument);
1462 } 1462 }
1463 1463
1464 void HTMLInputElement::removeAllEventListeners() 1464 void HTMLInputElement::removeAllEventListeners()
1465 { 1465 {
1466 HTMLTextFormControlElement::removeAllEventListeners(); 1466 HTMLTextFormControlElement::removeAllEventListeners();
1467 m_hasTouchEventHandler = false; 1467 m_hasTouchEventHandler = false;
1468 } 1468 }
1469 1469
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
1880 { 1880 {
1881 return m_inputType->shouldDispatchFormControlChangeEvent(oldValue, newValue) ; 1881 return m_inputType->shouldDispatchFormControlChangeEvent(oldValue, newValue) ;
1882 } 1882 }
1883 1883
1884 void HTMLInputElement::didNotifySubtreeInsertionsToDocument() 1884 void HTMLInputElement::didNotifySubtreeInsertionsToDocument()
1885 { 1885 {
1886 listAttributeTargetChanged(); 1886 listAttributeTargetChanged();
1887 } 1887 }
1888 1888
1889 } // namespace 1889 } // 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