Changeset 154682 in webkit


Ignore:
Timestamp:
Aug 27, 2013, 7:39:46 AM (12 years ago)
Author:
Antti Koivisto
Message:

Remove branch from DescendantIteratorAdapter::begin() when invoking for ContainerNode
https://bugs.webkit.org/show_bug.cgi?id=120358

Reviewed by Andreas Kling.

  • dom/ContainerNode.h:


Delete isContainerNode() so it can't be called if there is static knowledge that the object is a ContainerNode.

  • dom/DescendantIterator.h:

(WebCore::::DescendantIterator):

Make DescendantIterator use Node* as root instead of ContainerNode*. It is only used for equality comparison.

(WebCore::::begin):

Remove branch. Rely on ElementTraversal specialization for ContainerNodes.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/Source/WebCore/ChangeLog

    r154681 r154682  
     12013-08-27  Antti Koivisto  <antti@apple.com>
     2
     3        Remove branch from DescendantIteratorAdapter::begin() when invoking for ContainerNode
     4        https://bugs.webkit.org/show_bug.cgi?id=120358
     5
     6        Reviewed by Andreas Kling.
     7
     8        * dom/ContainerNode.h:
     9       
     10            Delete isContainerNode() so it can't be called if there is static knowledge that the object is a ContainerNode.
     11
     12        * dom/DescendantIterator.h:
     13        (WebCore::::DescendantIterator):
     14
     15            Make DescendantIterator use Node* as root instead of ContainerNode*. It is only used for equality comparison.
     16
     17        (WebCore::::begin):
     18       
     19            Remove branch. Rely on ElementTraversal specialization for ContainerNodes.
     20
    1212013-08-27  Joseph Pecoraro  <pecoraro@apple.com>
    222
  • TabularUnified trunk/Source/WebCore/dom/ContainerNode.h

    r154371 r154682  
    148148    bool getLowerRightCorner(FloatPoint&) const;
    149149
     150    bool isContainerNode() const WTF_DELETED_FUNCTION;
     151
    150152    Node* m_firstChild;
    151153    Node* m_lastChild;
  • TabularUnified trunk/Source/WebCore/dom/DescendantIterator.h

    r154581 r154682  
    3838class DescendantIterator {
    3939public:
    40     DescendantIterator(const ContainerNode* root);
    41     DescendantIterator(const ContainerNode* root, ElementType* current);
     40    DescendantIterator(const Node* root);
     41    DescendantIterator(const Node* root, ElementType* current);
    4242    DescendantIterator& operator++();
    4343    ElementType& operator*() { return *m_current; }
     
    4646
    4747private:
    48     const ContainerNode* m_root;
     48    const Node* m_root;
    4949    ElementType* m_current;
    5050#ifndef NDEBUG
     
    7171
    7272template <typename ElementType>
    73 inline DescendantIterator<ElementType>::DescendantIterator(const ContainerNode* root)
     73inline DescendantIterator<ElementType>::DescendantIterator(const Node* root)
    7474    : m_root(root)
    7575    , m_current(nullptr)
     
    8181
    8282template <typename ElementType>
    83 inline DescendantIterator<ElementType>::DescendantIterator(const ContainerNode* root, ElementType* current)
     83inline DescendantIterator<ElementType>::DescendantIterator(const Node* root, ElementType* current)
    8484    : m_root(root)
    8585    , m_current(current)
     
    116116inline DescendantIterator<ElementType> DescendantIteratorAdapter<ElementType, ContainerType>::begin()
    117117{
    118     if (!m_root->isContainerNode())
    119         return DescendantIterator<ElementType>(m_root);
    120     return DescendantIterator<ElementType>(m_root, Traversal<ElementType>::firstWithin(static_cast<ContainerNode*>(m_root)));
     118    return DescendantIterator<ElementType>(m_root, Traversal<ElementType>::firstWithin(m_root));
    121119}
    122120
Note: See TracChangeset for help on using the changeset viewer.