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

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

Issue 27746003: Have InputType factories take an HTMLInputElement reference in parameter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 2 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 | « no previous file | Source/core/html/forms/BaseButtonInputType.h » ('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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 , m_hasType(false) 109 , m_hasType(false)
110 , m_isActivatedSubmit(false) 110 , m_isActivatedSubmit(false)
111 , m_autocomplete(Uninitialized) 111 , m_autocomplete(Uninitialized)
112 , m_hasNonEmptyList(false) 112 , m_hasNonEmptyList(false)
113 , m_stateRestored(false) 113 , m_stateRestored(false)
114 , m_parsingInProgress(createdByParser) 114 , m_parsingInProgress(createdByParser)
115 , m_valueAttributeWasUpdatedAfterParsing(false) 115 , m_valueAttributeWasUpdatedAfterParsing(false)
116 , m_wasModifiedByUser(false) 116 , m_wasModifiedByUser(false)
117 , m_canReceiveDroppedFiles(false) 117 , m_canReceiveDroppedFiles(false)
118 , m_hasTouchEventHandler(false) 118 , m_hasTouchEventHandler(false)
119 , m_inputType(InputType::createText(this)) 119 , m_inputType(InputType::createText(*this))
120 , m_inputTypeView(m_inputType) 120 , m_inputTypeView(m_inputType)
121 { 121 {
122 ASSERT(hasTagName(inputTag) || hasTagName(isindexTag)); 122 ASSERT(hasTagName(inputTag) || hasTagName(isindexTag));
123 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 123 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
124 setHasCustomStyleCallbacks(); 124 setHasCustomStyleCallbacks();
125 #endif 125 #endif
126 ScriptWrappable::init(this); 126 ScriptWrappable::init(this);
127 } 127 }
128 128
129 PassRefPtr<HTMLInputElement> HTMLInputElement::create(const QualifiedName& tagNa me, Document& document, HTMLFormElement* form, bool createdByParser) 129 PassRefPtr<HTMLInputElement> HTMLInputElement::create(const QualifiedName& tagNa me, Document& document, HTMLFormElement* form, bool createdByParser)
(...skipping 12 matching lines...) Expand all
142 142
143 void HTMLInputElement::didAddUserAgentShadowRoot(ShadowRoot*) 143 void HTMLInputElement::didAddUserAgentShadowRoot(ShadowRoot*)
144 { 144 {
145 m_inputType->createShadowSubtree(); 145 m_inputType->createShadowSubtree();
146 } 146 }
147 147
148 void HTMLInputElement::didAddShadowRoot(ShadowRoot& root) 148 void HTMLInputElement::didAddShadowRoot(ShadowRoot& root)
149 { 149 {
150 if (!root.isOldestAuthorShadowRoot()) 150 if (!root.isOldestAuthorShadowRoot())
151 return; 151 return;
152 m_inputTypeView = InputTypeView::create(this); 152 m_inputTypeView = InputTypeView::create(*this);
153 } 153 }
154 154
155 HTMLInputElement::~HTMLInputElement() 155 HTMLInputElement::~HTMLInputElement()
156 { 156 {
157 // Need to remove form association while this is still an HTMLInputElement 157 // Need to remove form association while this is still an HTMLInputElement
158 // so that virtual functions are called correctly. 158 // so that virtual functions are called correctly.
159 setForm(0); 159 setForm(0);
160 // setForm(0) may register this to a document-level radio button group. 160 // setForm(0) may register this to a document-level radio button group.
161 // We should unregister it to avoid accessing a deleted object. 161 // We should unregister it to avoid accessing a deleted object.
162 if (isRadioButton()) 162 if (isRadioButton())
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 if (m_inputType->formControlType() == newTypeName) 404 if (m_inputType->formControlType() == newTypeName)
405 return; 405 return;
406 406
407 if (hadType && !InputType::canChangeFromAnotherType(newTypeName)) { 407 if (hadType && !InputType::canChangeFromAnotherType(newTypeName)) {
408 // Set the attribute back to the old value. 408 // Set the attribute back to the old value.
409 // Useful in case we were called from inside parseAttribute. 409 // Useful in case we were called from inside parseAttribute.
410 setAttribute(typeAttr, type()); 410 setAttribute(typeAttr, type());
411 return; 411 return;
412 } 412 }
413 413
414 RefPtr<InputType> newType = InputType::create(this, newTypeName); 414 RefPtr<InputType> newType = InputType::create(*this, newTypeName);
415 removeFromRadioButtonGroup(); 415 removeFromRadioButtonGroup();
416 416
417 bool didStoreValue = m_inputType->storesValueSeparateFromAttribute(); 417 bool didStoreValue = m_inputType->storesValueSeparateFromAttribute();
418 bool didRespectHeightAndWidth = m_inputType->shouldRespectHeightAndWidthAttr ibutes(); 418 bool didRespectHeightAndWidth = m_inputType->shouldRespectHeightAndWidthAttr ibutes();
419 419
420 m_inputType->destroyShadowSubtree(); 420 m_inputType->destroyShadowSubtree();
421 421
422 bool wasAttached = confusingAndOftenMisusedAttached(); 422 bool wasAttached = confusingAndOftenMisusedAttached();
423 if (wasAttached) 423 if (wasAttached)
424 detach(); 424 detach();
425 425
426 m_inputType = newType.release(); 426 m_inputType = newType.release();
427 if (hasAuthorShadowRoot()) 427 if (hasAuthorShadowRoot())
428 m_inputTypeView = InputTypeView::create(this); 428 m_inputTypeView = InputTypeView::create(*this);
429 else 429 else
430 m_inputTypeView = m_inputType; 430 m_inputTypeView = m_inputType;
431 m_inputType->createShadowSubtree(); 431 m_inputType->createShadowSubtree();
432 432
433 bool hasTouchEventHandler = m_inputTypeView->hasTouchEventHandler(); 433 bool hasTouchEventHandler = m_inputTypeView->hasTouchEventHandler();
434 if (hasTouchEventHandler != m_hasTouchEventHandler) { 434 if (hasTouchEventHandler != m_hasTouchEventHandler) {
435 if (hasTouchEventHandler) 435 if (hasTouchEventHandler)
436 document().didAddTouchEventHandler(this); 436 document().didAddTouchEventHandler(this);
437 else 437 else
438 document().didRemoveTouchEventHandler(this); 438 document().didRemoveTouchEventHandler(this);
(...skipping 1425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1864 } 1864 }
1865 1865
1866 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 1866 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
1867 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer() 1867 PassRefPtr<RenderStyle> HTMLInputElement::customStyleForRenderer()
1868 { 1868 {
1869 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer()); 1869 return m_inputTypeView->customStyleForRenderer(originalStyleForRenderer());
1870 } 1870 }
1871 #endif 1871 #endif
1872 1872
1873 } // namespace 1873 } // namespace
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/forms/BaseButtonInputType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698