WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
86602
[Forms] Refactor HTMLFormCollection
https://bugs.webkit.org/show_bug.cgi?id=86602
Summary
[Forms] Refactor HTMLFormCollection
Rakesh
Reported
2012-05-16 02:43:36 PDT
Refactor HTMLFormCollection to be independent of HTMLFormElement. This is needed for implementing HTMLFieldSetElement's elements attribute.
Attachments
proposed patch
(40.19 KB, patch)
2012-05-16 04:02 PDT
,
Rakesh
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ec2-cr-linux-02
(597.63 KB, application/zip)
2012-05-16 07:35 PDT
,
WebKit Review Bot
no flags
Details
updated patch
(40.66 KB, patch)
2012-05-17 07:45 PDT
,
Rakesh
no flags
Details
Formatted Diff
Diff
updated patch
(9.47 KB, patch)
2012-05-18 04:49 PDT
,
Rakesh
no flags
Details
Formatted Diff
Diff
updated patch
(10.02 KB, patch)
2012-05-21 02:30 PDT
,
Rakesh
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Rakesh
Comment 1
2012-05-16 04:02:34 PDT
Created
attachment 142214
[details]
proposed patch
Build Bot
Comment 2
2012-05-16 04:26:05 PDT
Comment on
attachment 142214
[details]
proposed patch
Attachment 142214
[details]
did not pass mac-ews (mac): Output:
http://queues.webkit.org/results/12694970
Build Bot
Comment 3
2012-05-16 05:30:55 PDT
Comment on
attachment 142214
[details]
proposed patch
Attachment 142214
[details]
did not pass win-ews (win): Output:
http://queues.webkit.org/results/12701826
WebKit Review Bot
Comment 4
2012-05-16 07:35:32 PDT
Comment on
attachment 142214
[details]
proposed patch
Attachment 142214
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/12722139
New failing tests: editing/pasteboard/paste-noscript.html editing/pasteboard/paste-noscript-xhtml.xhtml
WebKit Review Bot
Comment 5
2012-05-16 07:35:36 PDT
Created
attachment 142256
[details]
Archive of layout-test-results from ec2-cr-linux-02 The attached test failures were seen while running run-webkit-tests on the chromium-ews. Bot: ec2-cr-linux-02 Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'> Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Alexey Proskuryakov
Comment 6
2012-05-16 09:45:46 PDT
Comment on
attachment 142214
[details]
proposed patch View in context:
https://bugs.webkit.org/attachment.cgi?id=142214&action=review
Marking r- due to build breakage.
> Source/WebCore/html/HTMLFormCollection.h:38 > - static PassOwnPtr<HTMLFormCollection> create(HTMLFormElement*); > + static PassOwnPtr<HTMLFormCollection> create(Node*);
Why does this take a Node, not an Element?
Kent Tamura
Comment 7
2012-05-17 01:36:18 PDT
(In reply to
comment #0
)
> Refactor HTMLFormCollection to be independent of HTMLFormElement. > This is needed for implementing HTMLFieldSetElement's elements attribute.
Are you planing to update HTMLFieldSetElement so that it has a collection of element pointers?
Rakesh
Comment 8
2012-05-17 01:59:44 PDT
(In reply to
comment #7
)
> (In reply to
comment #0
) > > Refactor HTMLFormCollection to be independent of HTMLFormElement. > > This is needed for implementing HTMLFieldSetElement's elements attribute. > > Are you planing to update HTMLFieldSetElement so that it has a collection of element pointers?
Yes and maybe the collection can be refreshed if document version changes.
Kent Tamura
Comment 9
2012-05-17 04:57:10 PDT
(In reply to
comment #8
)
> (In reply to
comment #7
) > > (In reply to
comment #0
) > > > Refactor HTMLFormCollection to be independent of HTMLFormElement. > > > This is needed for implementing HTMLFieldSetElement's elements attribute. > > > > Are you planing to update HTMLFieldSetElement so that it has a collection of element pointers? > > Yes and maybe the collection can be refreshed if document version changes.
I see. I wondered which one was better; A) HTMLFieldSetElement has a collection of form controls, and use HTMLFormCollection. B) HTMLFieldSetElement has no collection of form controls, and use HTMLCollection. Probably A is simpler because of RadioNodeList.
Rakesh
Comment 10
2012-05-17 06:03:41 PDT
(In reply to
comment #9
)
> > I wondered which one was better; > A) HTMLFieldSetElement has a collection of form controls, and use HTMLFormCollection. > B) HTMLFieldSetElement has no collection of form controls, and use HTMLCollection. > > Probably A is simpler because of RadioNodeList.
Yes because of RadioNodeList, option A is better. Please do let me know if you have further suggestions.
Rakesh
Comment 11
2012-05-17 07:45:59 PDT
Created
attachment 142472
[details]
updated patch Fixed build and the failing tests have to addressed. Hopefully it will pass all builds.
Rakesh
Comment 12
2012-05-17 07:48:05 PDT
(In reply to
comment #6
) Thanks for review.
> Marking r- due to build breakage.
Fixed.
> Why does this take a Node, not an Element?
Updated in latest patch. (In reply to
comment #11
)
> Created an attachment (id=142472) [details] > updated patch > > Fixed build and the failing tests have to addressed. Hopefully it will pass all builds.
Typo, please read as "Fixed build and the failing tests have *been* addressed."
Build Bot
Comment 13
2012-05-17 08:15:57 PDT
Comment on
attachment 142472
[details]
updated patch
Attachment 142472
[details]
did not pass mac-ews (mac): Output:
http://queues.webkit.org/results/12723342
Kent Tamura
Comment 14
2012-05-17 22:47:32 PDT
Comment on
attachment 142472
[details]
updated patch View in context:
https://bugs.webkit.org/attachment.cgi?id=142472&action=review
> Source/WebCore/dom/Node.h:588 > + const Vector<FormAssociatedElement*>* formControlElements(); > + const Vector<HTMLImageElement*>* formImageElements(); > + unsigned numberOfFormControlElements(); > +
I don't think Node should have them. If you'd like to have common ways to get them in HTMLCollection, you should define these function like: static unsigned numberOfFormControlElements(HTMLElement* base);
> Source/WebCore/html/HTMLFormElement.h:162 > - Vector<FormAssociatedElement*> m_associatedElements; > - Vector<HTMLImageElement*> m_imageElements; > + mutable OwnPtr<Vector<FormAssociatedElement*> > m_associatedElements; > + mutable OwnPtr<Vector<HTMLImageElement*> > m_imageElements;
Why do you need to change them to OwnPtr<>? In general, ChangeLog entry should explain reasons of the change.
Rakesh
Comment 15
2012-05-18 00:44:33 PDT
(In reply to
comment #14
)
> (From update of
attachment 142472
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=142472&action=review
>
Thanks for reviewing this patch.
> I don't think Node should have them. If you'd like to have common ways to get them in HTMLCollection, you should define these function like: > static unsigned numberOfFormControlElements(HTMLElement* base);
Yes, having these functions like suggested in HTMLFormCollection would be better.
> > > Source/WebCore/html/HTMLFormElement.h:162 > > - Vector<FormAssociatedElement*> m_associatedElements; > > - Vector<HTMLImageElement*> m_imageElements; > > + mutable OwnPtr<Vector<FormAssociatedElement*> > m_associatedElements; > > + mutable OwnPtr<Vector<HTMLImageElement*> > m_imageElements; > > Why do you need to change them to OwnPtr<>?
Only reason being, able to 'return 0' in case of failed case of toFormElement()conversion. I think this would not be needed if we make the above change. We can assert if not an form element in conversion.
> In general, ChangeLog entry should explain reasons of the change.
Will surely add explanation.
Rakesh
Comment 16
2012-05-18 04:49:11 PDT
Created
attachment 142687
[details]
updated patch Updated as per reviews comments.
Kent Tamura
Comment 17
2012-05-18 05:34:57 PDT
Comment on
attachment 142687
[details]
updated patch View in context:
https://bugs.webkit.org/attachment.cgi?id=142687&action=review
> Source/WebCore/html/HTMLFormCollection.cpp:53 > +static const Vector<FormAssociatedElement*>& formControlElements(HTMLElement* base)
You moved these function to HTMLFormCollection. So we can make them member functions of HTMLFormCollection and the 'base' argument is not needed.
> Source/WebCore/html/HTMLFormCollection.cpp:55 > + ASSERT(base && base->hasTagName(formTag));
nit: You should separate this ASSERT into two. ASSERT(base); ASSERT(base->hasTagName(formTag)); in order to know which condition fails.
> Source/WebCore/html/HTMLFormElement.h:149 > > - friend class HTMLFormCollection; > - > typedef HashMap<RefPtr<AtomicStringImpl>, RefPtr<HTMLFormControlElement> > AliasMap;
great!
Rakesh
Comment 18
2012-05-21 02:30:42 PDT
Created
attachment 142974
[details]
updated patch Updated as per reviews comments.
Kent Tamura
Comment 19
2012-05-21 02:36:12 PDT
Comment on
attachment 142974
[details]
updated patch Looks nice.
WebKit Review Bot
Comment 20
2012-05-21 03:28:51 PDT
Comment on
attachment 142974
[details]
updated patch Clearing flags on attachment: 142974 Committed
r117754
: <
http://trac.webkit.org/changeset/117754
>
WebKit Review Bot
Comment 21
2012-05-21 03:28:57 PDT
All reviewed patches have been landed. Closing bug.
Rakesh
Comment 22
2012-05-21 03:48:29 PDT
(In reply to
comment #19
)
> (From update of
attachment 142974
[details]
) > Looks nice.
Thanks!!
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug