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

Unified Diff: Source/core/editing/FrameSelection.cpp

Issue 106423005: Only 'form associated' elements have a potential form owner. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use 'error' instead of 'click' events when testing form ownership Created 7 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/forms/form-associated-element-expected.txt ('k') | Source/core/html/HTMLElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/FrameSelection.cpp
diff --git a/Source/core/editing/FrameSelection.cpp b/Source/core/editing/FrameSelection.cpp
index b07ac8dfa6e8f6baa4301ff12080ed53062e585d..7730282dbe71f63804be4080c1faa5022c2d6f16 100644
--- a/Source/core/editing/FrameSelection.cpp
+++ b/Source/core/editing/FrameSelection.cpp
@@ -1739,8 +1739,11 @@ static HTMLFormElement* scanForForm(Node* start)
for (; element; element = ElementTraversal::next(*element)) {
if (element->hasTagName(formTag))
return toHTMLFormElement(element);
- if (element->isHTMLElement() && toHTMLElement(element)->isFormControlElement())
- return toHTMLFormControlElement(element)->form();
+ if (element->isHTMLElement()) {
+ HTMLFormElement* owner = toHTMLElement(element)->formOwner();
+ if (owner)
+ return owner;
+ }
if (element->hasTagName(frameTag) || element->hasTagName(iframeTag)) {
Node* childDocument = toHTMLFrameElementBase(element)->contentDocument();
if (HTMLFormElement* frameResult = scanForForm(childDocument))
@@ -1763,8 +1766,11 @@ HTMLFormElement* FrameSelection::currentForm() const
for (node = start; node; node = node->parentNode()) {
if (node->hasTagName(formTag))
return toHTMLFormElement(node);
- if (node->isHTMLElement() && toHTMLElement(node)->isFormControlElement())
- return toHTMLFormControlElement(node)->form();
+ if (node->isHTMLElement()) {
+ HTMLFormElement* owner = toHTMLElement(node)->formOwner();
+ if (owner)
+ return owner;
+ }
}
// Try walking forward in the node tree to find a form element.
« no previous file with comments | « LayoutTests/fast/forms/form-associated-element-expected.txt ('k') | Source/core/html/HTMLElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698