RESOLVED FIXED50195
Progress and meter elements should take a form in their constructor like any other form control.
https://bugs.webkit.org/show_bug.cgi?id=50195
Summary Progress and meter elements should take a form in their constructor like any ...
Yael
Reported 2010-11-29 17:27:35 PST
Progress and meter elements should take a form in their constructor like any other form control.
Attachments
Patch. (3.44 KB, patch)
2010-11-29 17:31 PST, Yael
darin: review-
Patch. (10.12 KB, patch)
2010-11-30 06:35 PST, Yael
no flags
Patch. (10.54 KB, patch)
2010-11-30 07:38 PST, Yael
no flags
Patch. (7.57 KB, patch)
2010-11-30 14:39 PST, Yael
darin: review+
Yael
Comment 1 2010-11-29 17:31:36 PST
Darin Adler
Comment 2 2010-11-29 17:38:38 PST
Comment on attachment 75090 [details] Patch. View in context: https://bugs.webkit.org/attachment.cgi?id=75090&action=review review- because this bug does require a test case > WebCore/ChangeLog:8 > + No new tests since this is a code cleanup only. That is incorrect. The reason form elements get a form argument is so that they are correctly associated with the form in cases when the form is not an ancestor of the form element. We need to construct a test case that demonstrates this not occurring for meter elements before and happening correctly for meter elements after the patch.
Early Warning System Bot
Comment 3 2010-11-29 17:54:24 PST
Eric Seidel (no email)
Comment 4 2010-11-29 18:07:11 PST
WebKit Review Bot
Comment 5 2010-11-29 18:08:05 PST
Yael
Comment 6 2010-11-29 18:10:43 PST
(In reply to comment #2) > (From update of attachment 75090 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=75090&action=review > > review- because this bug does require a test case > > > WebCore/ChangeLog:8 > > + No new tests since this is a code cleanup only. > > That is incorrect. The reason form elements get a form argument is so that they are correctly associated with the form in cases when the form is not an ancestor of the form element. We need to construct a test case that demonstrates this not occurring for meter elements before and happening correctly for meter elements after the patch. Sorry, I thought that HTMLElement::findFormAncestor() was taking care of associating the correct form. I'll add a test. I also need to touch some header file to force a rebuild on the buildbots.
Eric Seidel (no email)
Comment 7 2010-11-29 19:03:03 PST
Yael
Comment 8 2010-11-29 19:25:14 PST
Any suggestion which file to touch in order to trigger a clean build? thanks!
Build Bot
Comment 9 2010-11-29 19:51:04 PST
WebKit Review Bot
Comment 10 2010-11-30 00:10:25 PST
Yael
Comment 11 2010-11-30 06:35:07 PST
Created attachment 75136 [details] Patch. Added tests and also touch HTMLTagNames.in, to trigger re-generating HTMLElementFactory.cpp, to keep buildbots happy. Please note that the tests are passing even without this patch because HTMLFormControlElement::insertedIntoTree will associate the form control with the form if the form was inserted first. HTMLFormElement::insertedIntoDocument will associate the form control with the form if the form is inserted after the form control.
Early Warning System Bot
Comment 12 2010-11-30 06:50:47 PST
Eric Seidel (no email)
Comment 13 2010-11-30 07:07:52 PST
WebKit Review Bot
Comment 14 2010-11-30 07:09:02 PST
Yael
Comment 15 2010-11-30 07:38:20 PST
Created attachment 75146 [details] Patch. Fix the build.
Darin Adler
Comment 16 2010-11-30 07:40:09 PST
(In reply to comment #11) > Please note that the tests are passing even without this patch because HTMLFormControlElement::insertedIntoTree will associate the form control with the form if the form was inserted first. HTMLFormElement::insertedIntoDocument will associate the form control with the form if the form is inserted after the form control. Then the tests are incorrect. The whole point is to create tests that show the behavior that requires passing the form pointer. If there is no behavior that requires passing a form pointer, then we should eliminate the form pointer from WebKit or at least eliminate it from the constructor arguments for form elements.
Darin Adler
Comment 17 2010-11-30 07:40:56 PST
Comment on attachment 75146 [details] Patch. View in context: https://bugs.webkit.org/attachment.cgi?id=75146&action=review Thanks very much for writing these tests. But we need tests that fail to prove there is a bug to fix, not tests that already pass! > LayoutTests/fast/dom/HTMLMeterElement/script-tests/meter-element-outside-form.js:1 > +description('Test that a meter element is correctly associated with its for even if the form is not its ancestor.'); Typo "with its for". > LayoutTests/fast/dom/HTMLProgressElement/script-tests/progress-element-outside-form.js:1 > +description('Test that a progress element is correctly associated with its for even if the form is not its ancestor.'); Same typo here.
Yael
Comment 18 2010-11-30 08:06:48 PST
(In reply to comment #17) > (From update of attachment 75146 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=75146&action=review > > Thanks very much for writing these tests. But we need tests that fail to prove there is a bug to fix, not tests that already pass! > Darin, could you please elaborate on the bug? It seems to me that the form association of meter element and the form is done correctly even if the constructor does not take form as an argument. This is done when the meter element is inserted into the tree. HTMLFormControlElement::insertedIntoTree() line 163 : m_form = static_cast<HTMLFormElement*>(element) If the meter element is created with createElement('meter') and not inserted into the tree, then we are not passing a form attribute to the constructor anyways. What am I missing?
Darin Adler
Comment 19 2010-11-30 10:23:00 PST
(In reply to comment #18) > Darin, could you please elaborate on the bug? To find tests that depend on passing the form in when creating an element you could change HTMLConstructionSite::createHTMLElement so it passes 0 instead of form(). Then you will see some tests fail, which might give you a hint about the types of cases that require this. Then you could make similar tests with these element types. Or just add these element types to the existing test.
Alexey Proskuryakov
Comment 20 2010-11-30 10:49:11 PST
An input can be associated with a form even when it's not a descendant of the form element in DOM. Darin's suggestion above is certainly the best way to discover more detail.
Yael
Comment 21 2010-11-30 14:39:23 PST
Created attachment 75207 [details] Patch. Thank you for the advice, it helped me find that forms were not handled correctly e.g. when they are directly inside a table. Modified tests are attached.
Yael
Comment 22 2010-11-30 16:16:11 PST
Note You need to log in before you can comment on or make changes to this bug.