Bug 120358 - Remove branch from DescendantIteratorAdapter::begin() when invoking for ContainerNode
Summary: Remove branch from DescendantIteratorAdapter::begin() when invoking for Conta...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-27 06:34 PDT by Antti Koivisto
Modified: 2013-08-27 23:15 PDT (History)
4 users (show)

See Also:


Attachments
patch (4.38 KB, patch)
2013-08-27 06:41 PDT, Antti Koivisto
kling: review+
Details | Formatted Diff | Diff
Simpler patch (3.85 KB, patch)
2013-08-27 07:34 PDT, Antti Koivisto
kling: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2013-08-27 06:34:32 PDT
Currently we have an unnecessary branch in begin().
Comment 1 Antti Koivisto 2013-08-27 06:41:17 PDT
Created attachment 209764 [details]
patch
Comment 2 Andreas Kling 2013-08-27 06:58:02 PDT
Comment on attachment 209764 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=209764&action=review

r=me I guess.

> Source/WebCore/dom/ContainerNode.h:150
> +    bool isContainerNode() WTF_DELETED_FUNCTION;

Does this do the right thing? Node::isContainerNode() is a const function.
Comment 3 Antti Koivisto 2013-08-27 07:34:00 PDT
Created attachment 209771 [details]
Simpler patch
Comment 4 Antti Koivisto 2013-08-27 07:39:00 PDT
https://trac.webkit.org/r154682
Comment 5 Darin Adler 2013-08-27 09:25:41 PDT
Comment on attachment 209771 [details]
Simpler patch

View in context: https://bugs.webkit.org/attachment.cgi?id=209771&action=review

> Source/WebCore/dom/DescendantIterator.h:41
> -    DescendantIterator(const ContainerNode* root);
> -    DescendantIterator(const ContainerNode* root, ElementType* current);
> +    DescendantIterator(const Node* root);
> +    DescendantIterator(const Node* root, ElementType* current);

Why is this a good change? I understand it’s only used for equality comparison, but are there really callers that need to use this with a Node*?
Comment 6 Antti Koivisto 2013-08-27 23:15:34 PDT
(In reply to comment #5)
> Why is this a good change? I understand it’s only used for equality comparison, but are there really callers that need to use this with a Node*?

Yeah, for now. But it is true that it might be better to just fix the call sites.