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

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

Issue 1204353004: Fix form association behavior when a form and a control with form= are removed from a document toge… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | « LayoutTests/fast/forms/form-attribute-expected.txt ('k') | no next file » | 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 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 return; 92 return;
93 93
94 HTMLElement* element = toHTMLElement(this); 94 HTMLElement* element = toHTMLElement(this);
95 if (element->fastHasAttribute(formAttr)) 95 if (element->fastHasAttribute(formAttr))
96 resetFormAttributeTargetObserver(); 96 resetFormAttributeTargetObserver();
97 } 97 }
98 98
99 void FormAssociatedElement::removedFrom(ContainerNode* insertionPoint) 99 void FormAssociatedElement::removedFrom(ContainerNode* insertionPoint)
100 { 100 {
101 HTMLElement* element = toHTMLElement(this); 101 HTMLElement* element = toHTMLElement(this);
102 if (insertionPoint->inDocument() && element->fastHasAttribute(formAttr)) 102 if (insertionPoint->inDocument() && element->fastHasAttribute(formAttr)) {
103 setFormAttributeTargetObserver(nullptr); 103 setFormAttributeTargetObserver(nullptr);
104 resetFormOwner();
105 ASSERT(!m_form);
tkent 2015/06/26 02:01:44 Some tests hit this. Investigating...
tkent 2015/06/26 03:49:16 According to the specification, ancestor form can
tkent 2015/06/26 03:51:54 Removed in Patch Set 2. PTAL.
106 return;
107 }
104 // If the form and element are both in the same tree, preserve the connectio n to the form. 108 // If the form and element are both in the same tree, preserve the connectio n to the form.
105 // Otherwise, null out our form and remove ourselves from the form's list of elements. 109 // Otherwise, null out our form and remove ourselves from the form's list of elements.
106 if (m_form && NodeTraversal::highestAncestorOrSelf(*element) != NodeTraversa l::highestAncestorOrSelf(*m_form.get())) 110 if (m_form && NodeTraversal::highestAncestorOrSelf(*element) != NodeTraversa l::highestAncestorOrSelf(*m_form.get()))
107 resetFormOwner(); 111 resetFormOwner();
108 } 112 }
109 113
110 HTMLFormElement* FormAssociatedElement::findAssociatedForm(const HTMLElement* el ement) 114 HTMLFormElement* FormAssociatedElement::findAssociatedForm(const HTMLElement* el ement)
111 { 115 {
112 const AtomicString& formId(element->fastGetAttribute(formAttr)); 116 const AtomicString& formId(element->fastGetAttribute(formAttr));
113 // 3. If the element is reassociateable, has a form content attribute, and 117 // 3. If the element is reassociateable, has a form content attribute, and
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 visitor->trace(m_element); 354 visitor->trace(m_element);
351 IdTargetObserver::trace(visitor); 355 IdTargetObserver::trace(visitor);
352 } 356 }
353 357
354 void FormAttributeTargetObserver::idTargetChanged() 358 void FormAttributeTargetObserver::idTargetChanged()
355 { 359 {
356 m_element->formAttributeTargetChanged(); 360 m_element->formAttributeTargetChanged();
357 } 361 }
358 362
359 } // namespace blink 363 } // namespace blink
OLDNEW
« no previous file with comments | « LayoutTests/fast/forms/form-attribute-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698