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

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

Issue 672163002: Fix bug where form/fieldset :valid/:invalid won't be recalculated upon control's willValidate change Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add layout tests to catch the problem Created 6 years, 1 month 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 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 setForm(form); 142 setForm(form);
143 form->didAssociateByParser(); 143 form->didAssociateByParser();
144 } 144 }
145 } 145 }
146 146
147 void FormAssociatedElement::setForm(HTMLFormElement* newForm) 147 void FormAssociatedElement::setForm(HTMLFormElement* newForm)
148 { 148 {
149 if (m_form.get() == newForm) 149 if (m_form.get() == newForm)
150 return; 150 return;
151 willChangeForm(); 151 willChangeForm();
152 #if ENABLE(OILPAN)
153 HTMLFormElement* oldForm = m_form;
154 #else
155 HTMLFormElement* oldForm = m_form.get();
156 #endif
152 if (m_form) 157 if (m_form)
153 m_form->disassociate(*this); 158 m_form->disassociate(*this);
154 if (newForm) { 159 if (newForm) {
155 #if ENABLE(OILPAN) 160 #if ENABLE(OILPAN)
156 m_form = newForm; 161 m_form = newForm;
157 #else 162 #else
158 m_form = newForm->createWeakPtr(); 163 m_form = newForm->createWeakPtr();
159 #endif 164 #endif
160 m_form->associate(*this); 165 m_form->associate(*this);
161 } else { 166 } else {
162 #if ENABLE(OILPAN) 167 #if ENABLE(OILPAN)
163 m_form = nullptr; 168 m_form = nullptr;
164 #else 169 #else
165 m_form = WeakPtr<HTMLFormElement>(); 170 m_form = WeakPtr<HTMLFormElement>();
166 #endif 171 #endif
167 } 172 }
168 didChangeForm(); 173 didChangeForm(oldForm);
169 } 174 }
170 175
171 void FormAssociatedElement::willChangeForm() 176 void FormAssociatedElement::willChangeForm()
172 { 177 {
173 } 178 }
174 179
175 void FormAssociatedElement::didChangeForm() 180 void FormAssociatedElement::didChangeForm(HTMLFormElement* oldForm)
176 { 181 {
177 } 182 }
178 183
179 void FormAssociatedElement::resetFormOwner() 184 void FormAssociatedElement::resetFormOwner()
180 { 185 {
181 m_formWasSetByParser = false; 186 m_formWasSetByParser = false;
182 HTMLElement* element = toHTMLElement(this); 187 HTMLElement* element = toHTMLElement(this);
183 const AtomicString& formId(element->fastGetAttribute(formAttr)); 188 const AtomicString& formId(element->fastGetAttribute(formAttr));
184 HTMLFormElement* nearestForm = element->findFormAncestor(); 189 HTMLFormElement* nearestForm = element->findFormAncestor();
185 // 1. If the element's form owner is not null, and either the element is not 190 // 1. If the element's form owner is not null, and either the element is not
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 visitor->trace(m_element); 357 visitor->trace(m_element);
353 IdTargetObserver::trace(visitor); 358 IdTargetObserver::trace(visitor);
354 } 359 }
355 360
356 void FormAttributeTargetObserver::idTargetChanged() 361 void FormAttributeTargetObserver::idTargetChanged()
357 { 362 {
358 m_element->formAttributeTargetChanged(); 363 m_element->formAttributeTargetChanged();
359 } 364 }
360 365
361 } // namespace blink 366 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698