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

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: Rebase harder. 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 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 } 1445 }
1445 1446
1446 void HTMLInputElement::didMoveToNewDocument(Document& oldDocument) 1447 void HTMLInputElement::didMoveToNewDocument(Document& oldDocument)
1447 { 1448 {
1448 if (hasImageLoader()) 1449 if (hasImageLoader())
1449 imageLoader()->elementDidMoveToNewDocument(); 1450 imageLoader()->elementDidMoveToNewDocument();
1450 1451
1451 if (isRadioButton()) 1452 if (isRadioButton())
1452 oldDocument.formController().radioButtonGroupScope().removeButton(this); 1453 oldDocument.formController().radioButtonGroupScope().removeButton(this);
1453 if (m_hasTouchEventHandler) 1454 if (m_hasTouchEventHandler)
1454 oldDocument.didRemoveTouchEventHandler(this); 1455 EventHandlerRegistry::from(oldDocument)->didRemoveEventHandler(*this, Ev entHandlerRegistry::TouchEvent);
1455 1456
1456 if (m_hasTouchEventHandler) 1457 if (m_hasTouchEventHandler)
1457 document().didAddTouchEventHandler(this); 1458 EventHandlerRegistry::from(document())->didAddEventHandler(*this, EventH andlerRegistry::TouchEvent);
1458 1459
1459 HTMLTextFormControlElement::didMoveToNewDocument(oldDocument); 1460 HTMLTextFormControlElement::didMoveToNewDocument(oldDocument);
1460 } 1461 }
1461 1462
1462 void HTMLInputElement::removeAllEventListeners() 1463 void HTMLInputElement::removeAllEventListeners()
1463 { 1464 {
1464 HTMLTextFormControlElement::removeAllEventListeners(); 1465 HTMLTextFormControlElement::removeAllEventListeners();
1465 m_hasTouchEventHandler = false; 1466 m_hasTouchEventHandler = false;
1466 } 1467 }
1467 1468
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1884 } 1885 }
1885 1886
1886 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 1887 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
1887 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() 1888 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer()
1888 { 1889 {
1889 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); 1890 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer());
1890 } 1891 }
1891 #endif 1892 #endif
1892 1893
1893 } // namespace 1894 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698