[webkit-reviews] review requested: [Bug 207816] Revise DOM iterators implementation and usage : [Attachment 391374] Patch
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Feb 21 12:50:51 PST 2020
Darin Adler <darin at apple.com> has asked for review:
Bug 207816: Revise DOM iterators implementation and usage
https://bugs.webkit.org/show_bug.cgi?id=207816
Attachment 391374: Patch
https://bugs.webkit.org/attachment.cgi?id=391374&action=review
--- Comment #19 from Darin Adler <darin at apple.com> ---
Comment on attachment 391374
--> https://bugs.webkit.org/attachment.cgi?id=391374
Patch
View in context: https://bugs.webkit.org/attachment.cgi?id=391374&action=review
I’m going to change this back to review?, since the only reason you gave for
review- is a misunderstanding. I hope you will take another look.
> Source/WebCore/dom/ElementAncestorIterator.h:114
> + return ElementAncestorRange<const
ElementType>(&downcast<ElementType>(first));
Here’s where we make a code change for lineageOfType so we retain the const
correctness. Note here that because the argument is const, the template
argument for the range (and indirectly for the iterator) is a const type. This
is what makes the const correctness work.
> Source/WebCore/dom/ElementAncestorIterator.h:127
> + return ElementAncestorRange<const
ElementType>(findElementAncestorOfType<const ElementType>(descendant));
And here is where we do it for ancestorsOfType.
> Source/WebCore/dom/ElementChildIterator.h:129
> + return ElementChildRange<const ElementType>(parent);
Here is where we do it for childrenOfType.
> Source/WebCore/dom/TypedElementDescendantIterator.h:256
> + return ElementDescendantRange<const ElementType>(root);
Here’s where we make a code change so we retain the const correctness. Note
here that because the argument is const, the template argument for the range
(and indirectly for the iterator) is a const type. This is what makes the const
correctness work.
More information about the webkit-reviews
mailing list