WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
126684
Switch HTMLTableRowsCollection from Traversal<> to iterators
https://bugs.webkit.org/show_bug.cgi?id=126684
Summary
Switch HTMLTableRowsCollection from Traversal<> to iterators
Antti Koivisto
Reported
2014-01-09 01:54:45 PST
This is the last remaining client of Traversal<> outside the iterator implementation.
Attachments
patch
(7.08 KB, patch)
2014-01-09 02:09 PST
,
Antti Koivisto
kling
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Antti Koivisto
Comment 1
2014-01-09 02:09:28 PST
Created
attachment 220705
[details]
patch
Andreas Kling
Comment 2
2014-01-09 02:13:27 PST
Comment on
attachment 220705
[details]
patch Very snug.
Antti Koivisto
Comment 3
2014-01-09 02:17:06 PST
https://trac.webkit.org/r161551
Darin Adler
Comment 4
2014-01-09 07:42:39 PST
Comment on
attachment 220705
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=220705&action=review
> Source/WebCore/dom/ElementChildIterator.h:160 > + if (!isElementOfType<const ElementType>(child)) > + return end();
If this element is a child of m_parent, just not the correct type, I would expect this function to return the next child of the correct type if any, not always end(). A way to avoid this problem entirely would be to make the argument be ElementType& instead of const Element&.
Darin Adler
Comment 5
2014-01-09 07:44:27 PST
Comment on
attachment 220705
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=220705&action=review
>> Source/WebCore/dom/ElementChildIterator.h:160 >> + return end(); > > If this element is a child of m_parent, just not the correct type, I would expect this function to return the next child of the correct type if any, not always end(). > > A way to avoid this problem entirely would be to make the argument be ElementType& instead of const Element&.
I guess I’m wrong. We are using end() here as a sort of null value. But I do think that we should have a find that takes the specific element type to avoid the runtime isElementOfType check.
Darin Adler
Comment 6
2014-01-09 07:45:18 PST
Comment on
attachment 220705
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=220705&action=review
>>> Source/WebCore/dom/ElementChildIterator.h:160 >>> + return end(); >> >> If this element is a child of m_parent, just not the correct type, I would expect this function to return the next child of the correct type if any, not always end(). >> >> A way to avoid this problem entirely would be to make the argument be ElementType& instead of const Element&. > > I guess I’m wrong. We are using end() here as a sort of null value. > > But I do think that we should have a find that takes the specific element type to avoid the runtime isElementOfType check.
I guess I really don’t like find for the name of this. It sounds like something that iterates the children, when really it’s just a sort of alternate iterator constructor.
Antti Koivisto
Comment 7
2014-01-09 08:39:07 PST
(In reply to
comment #6
)
> I guess I really don’t like find for the name of this. It sounds like something that iterates the children, when really it’s just a sort of alternate iterator constructor.
I mostly added it because we had find like this already in ElementDescendantIteratorAdapter. I agree that it is a silly name and should be replaced with a constructor function. I don't want to call constructors explicitly from regular code though. Maybe FooAdapter::iteratorFor(ElementType&)?
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