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

Side by Side Diff: Source/core/html/RadioNodeList.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 unified diff | Download patch
« no previous file with comments | « Source/core/html/HTMLObjectElement.cpp ('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) 2012 Motorola Mobility, Inc. All rights reserved. 2 * Copyright (c) 2012 Motorola Mobility, Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 continue; 81 continue;
82 inputElement->setChecked(true); 82 inputElement->setChecked(true);
83 return; 83 return;
84 } 84 }
85 } 85 }
86 86
87 bool RadioNodeList::checkElementMatchesRadioNodeListFilter(Element* testElement) const 87 bool RadioNodeList::checkElementMatchesRadioNodeListFilter(Element* testElement) const
88 { 88 {
89 ASSERT(testElement->hasTagName(objectTag) || testElement->isFormControlEleme nt()); 89 ASSERT(testElement->hasTagName(objectTag) || testElement->isFormControlEleme nt());
90 if (ownerNode()->hasTagName(formTag)) { 90 if (ownerNode()->hasTagName(formTag)) {
91 HTMLFormElement* formElement = 0; 91 HTMLFormElement* formElement = toHTMLElement(testElement)->formOwner();
92 if (testElement->hasTagName(objectTag))
93 formElement = toHTMLObjectElement(testElement)->form();
94 else
95 formElement = toHTMLFormControlElement(testElement)->form();
96 if (!formElement || formElement != ownerNode()) 92 if (!formElement || formElement != ownerNode())
97 return false; 93 return false;
98 } 94 }
99 95
100 return testElement->getIdAttribute() == m_name || testElement->getNameAttrib ute() == m_name; 96 return testElement->getIdAttribute() == m_name || testElement->getNameAttrib ute() == m_name;
101 } 97 }
102 98
103 bool RadioNodeList::nodeMatches(Element* testElement) const 99 bool RadioNodeList::nodeMatches(Element* testElement) const
104 { 100 {
105 if (!testElement->hasTagName(objectTag) && !testElement->isFormControlElemen t()) 101 if (!testElement->hasTagName(objectTag) && !testElement->isFormControlElemen t())
106 return false; 102 return false;
107 103
108 if (testElement->hasTagName(inputTag) && toHTMLInputElement(testElement)->is ImageButton()) 104 if (testElement->hasTagName(inputTag) && toHTMLInputElement(testElement)->is ImageButton())
109 return false; 105 return false;
110 106
111 return checkElementMatchesRadioNodeListFilter(testElement); 107 return checkElementMatchesRadioNodeListFilter(testElement);
112 } 108 }
113 109
114 } // namspace 110 } // namspace
115 111
OLDNEW
« no previous file with comments | « Source/core/html/HTMLObjectElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698