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

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

Issue 206603002: Add EventHandlerRegistry (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More comments. Created 6 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
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 19 matching lines...) Expand all
30 #include "core/html/HTMLInputElement.h" 30 #include "core/html/HTMLInputElement.h"
31 31
32 #include "CSSPropertyNames.h" 32 #include "CSSPropertyNames.h"
33 #include "HTMLNames.h" 33 #include "HTMLNames.h"
34 #include "RuntimeEnabledFeatures.h" 34 #include "RuntimeEnabledFeatures.h"
35 #include "bindings/v8/ExceptionMessages.h" 35 #include "bindings/v8/ExceptionMessages.h"
36 #include "bindings/v8/ExceptionState.h" 36 #include "bindings/v8/ExceptionState.h"
37 #include "bindings/v8/ScriptEventListener.h" 37 #include "bindings/v8/ScriptEventListener.h"
38 #include "core/accessibility/AXObjectCache.h" 38 #include "core/accessibility/AXObjectCache.h"
39 #include "core/dom/Document.h" 39 #include "core/dom/Document.h"
40 #include "core/dom/EventHandlerRegistry.h"
40 #include "core/dom/ExceptionCode.h" 41 #include "core/dom/ExceptionCode.h"
41 #include "core/dom/IdTargetObserver.h" 42 #include "core/dom/IdTargetObserver.h"
42 #include "core/dom/shadow/ElementShadow.h" 43 #include "core/dom/shadow/ElementShadow.h"
43 #include "core/dom/shadow/InsertionPoint.h" 44 #include "core/dom/shadow/InsertionPoint.h"
44 #include "core/dom/shadow/ShadowRoot.h" 45 #include "core/dom/shadow/ShadowRoot.h"
45 #include "core/editing/FrameSelection.h" 46 #include "core/editing/FrameSelection.h"
46 #include "core/editing/SpellChecker.h" 47 #include "core/editing/SpellChecker.h"
47 #include "core/events/BeforeTextInsertedEvent.h" 48 #include "core/events/BeforeTextInsertedEvent.h"
48 #include "core/events/KeyboardEvent.h" 49 #include "core/events/KeyboardEvent.h"
49 #include "core/events/MouseEvent.h" 50 #include "core/events/MouseEvent.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 HTMLInputElement::~HTMLInputElement() 161 HTMLInputElement::~HTMLInputElement()
161 { 162 {
162 // Need to remove form association while this is still an HTMLInputElement 163 // Need to remove form association while this is still an HTMLInputElement
163 // so that virtual functions are called correctly. 164 // so that virtual functions are called correctly.
164 setForm(0); 165 setForm(0);
165 // setForm(0) may register this to a document-level radio button group. 166 // setForm(0) may register this to a document-level radio button group.
166 // We should unregister it to avoid accessing a deleted object. 167 // We should unregister it to avoid accessing a deleted object.
167 if (isRadioButton()) 168 if (isRadioButton())
168 document().formController().radioButtonGroupScope().removeButton(this); 169 document().formController().radioButtonGroupScope().removeButton(this);
169 if (m_hasTouchEventHandler) 170 if (m_hasTouchEventHandler)
170 document().didRemoveTouchEventHandler(this); 171 EventHandlerRegistry::from(document())->didRemoveEventHandler(*this, Eve ntHandlerRegistry::TouchEvent);
171 } 172 }
172 173
173 const AtomicString& HTMLInputElement::name() const 174 const AtomicString& HTMLInputElement::name() const
174 { 175 {
175 return m_name.isNull() ? emptyAtom : m_name; 176 return m_name.isNull() ? emptyAtom : m_name;
176 } 177 }
177 178
178 Vector<FileChooserFileInfo> HTMLInputElement::filesFromFileInputFormControlState (const FormControlState& state) 179 Vector<FileChooserFileInfo> HTMLInputElement::filesFromFileInputFormControlState (const FormControlState& state)
179 { 180 {
180 return FileInputType::filesFromFormControlState(state); 181 return FileInputType::filesFromFormControlState(state);
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 m_inputType = newType.release(); 425 m_inputType = newType.release();
425 if (hasAuthorShadowRoot()) 426 if (hasAuthorShadowRoot())
426 m_inputTypeView = InputTypeView::create(*this); 427 m_inputTypeView = InputTypeView::create(*this);
427 else 428 else
428 m_inputTypeView = m_inputType; 429 m_inputTypeView = m_inputType;
429 m_inputTypeView->createShadowSubtree(); 430 m_inputTypeView->createShadowSubtree();
430 431
431 bool hasTouchEventHandler = m_inputTypeView->hasTouchEventHandler(); 432 bool hasTouchEventHandler = m_inputTypeView->hasTouchEventHandler();
432 if (hasTouchEventHandler != m_hasTouchEventHandler) { 433 if (hasTouchEventHandler != m_hasTouchEventHandler) {
433 if (hasTouchEventHandler) 434 if (hasTouchEventHandler)
434 document().didAddTouchEventHandler(this); 435 EventHandlerRegistry::from(document())->didAddEventHandler(*this, Ev entHandlerRegistry::TouchEvent);
435 else 436 else
436 document().didRemoveTouchEventHandler(this); 437 EventHandlerRegistry::from(document())->didRemoveEventHandler(*this, EventHandlerRegistry::TouchEvent);
437 m_hasTouchEventHandler = hasTouchEventHandler; 438 m_hasTouchEventHandler = hasTouchEventHandler;
438 } 439 }
439 440
440 setNeedsWillValidateCheck(); 441 setNeedsWillValidateCheck();
441 442
442 bool willStoreValue = m_inputType->storesValueSeparateFromAttribute(); 443 bool willStoreValue = m_inputType->storesValueSeparateFromAttribute();
443 444
444 if (didStoreValue && !willStoreValue && hasDirtyValue()) { 445 if (didStoreValue && !willStoreValue && hasDirtyValue()) {
445 setAttribute(valueAttr, AtomicString(m_valueIfDirty)); 446 setAttribute(valueAttr, AtomicString(m_valueIfDirty));
446 m_valueIfDirty = String(); 447 m_valueIfDirty = String();
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 } 1443 }
1443 1444
1444 void HTMLInputElement::didMoveToNewDocument(Document& oldDocument) 1445 void HTMLInputElement::didMoveToNewDocument(Document& oldDocument)
1445 { 1446 {
1446 if (hasImageLoader()) 1447 if (hasImageLoader())
1447 imageLoader()->elementDidMoveToNewDocument(); 1448 imageLoader()->elementDidMoveToNewDocument();
1448 1449
1449 if (isRadioButton()) 1450 if (isRadioButton())
1450 oldDocument.formController().radioButtonGroupScope().removeButton(this); 1451 oldDocument.formController().radioButtonGroupScope().removeButton(this);
1451 if (m_hasTouchEventHandler) 1452 if (m_hasTouchEventHandler)
1452 oldDocument.didRemoveTouchEventHandler(this); 1453 EventHandlerRegistry::from(oldDocument)->didRemoveEventHandler(*this, Ev entHandlerRegistry::TouchEvent);
1453 1454
1454 if (m_hasTouchEventHandler) 1455 if (m_hasTouchEventHandler)
1455 document().didAddTouchEventHandler(this); 1456 EventHandlerRegistry::from(document())->didAddEventHandler(*this, EventH andlerRegistry::TouchEvent);
1456 1457
1457 HTMLTextFormControlElement::didMoveToNewDocument(oldDocument); 1458 HTMLTextFormControlElement::didMoveToNewDocument(oldDocument);
1458 } 1459 }
1459 1460
1460 void HTMLInputElement::removeAllEventListeners() 1461 void HTMLInputElement::removeAllEventListeners()
1461 { 1462 {
1462 HTMLTextFormControlElement::removeAllEventListeners(); 1463 HTMLTextFormControlElement::removeAllEventListeners();
1463 m_hasTouchEventHandler = false; 1464 m_hasTouchEventHandler = false;
1464 } 1465 }
1465 1466
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1882 } 1883 }
1883 1884
1884 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 1885 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
1885 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() 1886 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer()
1886 { 1887 {
1887 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); 1888 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer());
1888 } 1889 }
1889 #endif 1890 #endif
1890 1891
1891 } // namespace 1892 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698