Commit 0a064cb3 authored by ch.dumez@samsung.com's avatar ch.dumez@samsung.com

Regression(r178540): Traversal<*Element>::lastWithin() is incorrect

Traversal<*Element>::lastWithin() is incorrect after r178540 because it
changed from using ElementTraversal::lastWithin() to using Node.lastChild()
when doing node traversal. The proper API for this is
NodeTraversal::lastWithin() as we want the last descendant, not the last
child.

This was not caught by layout tests because this template specialization
is currently unused. Current callers are using the simpler Traversal<Element>
template specialization.

R=abarth@chromium.org, esprehn@chromium.org

Review URL: https://codereview.chromium.org/416933002

git-svn-id: svn://svn.chromium.org/blink/trunk@179057 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 8e1efe5b
......@@ -214,9 +214,9 @@ template <class ElementType>
template <class NodeType>
inline ElementType* Traversal<ElementType>::lastWithinTemplate(NodeType& current)
{
Node* node = current.lastChild();
Node* node = NodeTraversal::lastWithin(current);
while (node && !isElementOfType<const ElementType>(*node))
node = NodeTraversal::previous(node, &current);
node = NodeTraversal::previous(*node, &current);
return toElement<ElementType>(node);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment