Add ElementTraversal::next/previousSibling
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Aug 2013 15:52:09 +0000 (15:52 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 12 Aug 2013 15:52:09 +0000 (15:52 +0000)
commit6d352898ca74dc93a97d2a7191e4285d9707e107
treeb5605fa1c1177555535b22376002494897cebe3e
parent40876bf58ddd78fb28ea2b465828bec91763fe83
Add ElementTraversal::next/previousSibling
https://bugs.webkit.org/show_bug.cgi?id=119681

Reviewed by Andreas Kling.

Add nextSibling/previousSibling/lastWithin to ElementTraversal namespace.

- Use them to replace internal use of Element::next/previousElementSibling DOM API for traversal.
- Replace some Node::nextSibling() usage with ElementTraversal::nextSibling() for tighter code.
- Replace ElementTraversal::nextSkippingChildren where it is used to traverse over immediate children only.

* css/SelectorChecker.cpp:
(WebCore::isFirstChildElement):
(WebCore::isLastChildElement):
(WebCore::isFirstOfType):
(WebCore::isLastOfType):
(WebCore::countElementsBefore):
(WebCore::countElementsOfTypeBefore):
(WebCore::countElementsAfter):
(WebCore::countElementsOfTypeAfter):
* dom/Element.cpp:
(WebCore::Element::lastElementChild):
(WebCore::Element::previousElementSibling):
(WebCore::Element::nextElementSibling):
* dom/Element.h:
* dom/ElementTraversal.h:
(WebCore::ElementTraversal::lastElementWithinTemplate):
(WebCore::ElementTraversal::lastWithin):
(WebCore::ElementTraversal::traverseNextSiblingElementTemplate):
(WebCore::ElementTraversal::nextSibling):
(WebCore::ElementTraversal::traversePreviousSiblingElementTemplate):
(WebCore::ElementTraversal::previousSibling):
* editing/ApplyStyleCommand.cpp:
(WebCore::isSpanWithoutAttributesOrUnstyledStyleSpan):
(WebCore::ApplyStyleCommand::cleanupUnstyledAppleStyleSpans):
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::breakOutOfEmptyListItem):
* editing/IndentOutdentCommand.cpp:
(WebCore::IndentOutdentCommand::tryIndentingAsListItem):
* editing/InsertListCommand.cpp:
(WebCore::InsertListCommand::mergeWithNeighboringLists):
* editing/markup.cpp:
(WebCore::createContextualFragment):
* html/HTMLCollection.cpp:
(WebCore::firstMatchingChildElement):
(WebCore::nextMatchingSiblingElement):
(WebCore::HTMLCollection::traverseNextElement):
(WebCore::HTMLCollection::traverseForwardToOffset):
* html/HTMLFieldSetElement.cpp:
(WebCore::HTMLFieldSetElement::childrenChanged):
(WebCore::HTMLFieldSetElement::legend):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::finishParsingChildren):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::containsJavaApplet):
* rendering/FilterEffectRenderer.cpp:
(WebCore::FilterEffectRenderer::buildReferenceFilter):
* style/StyleResolveTree.cpp:
(WebCore::Style::resolveTree):
* svg/SVGStyledElement.cpp:
(WebCore::SVGStyledElement::title):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@153942 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/WebCore/ChangeLog
Source/WebCore/css/SelectorChecker.cpp
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/ElementTraversal.h
Source/WebCore/editing/ApplyStyleCommand.cpp
Source/WebCore/editing/CompositeEditCommand.cpp
Source/WebCore/editing/IndentOutdentCommand.cpp
Source/WebCore/editing/InsertListCommand.cpp
Source/WebCore/editing/markup.cpp
Source/WebCore/html/HTMLCollection.cpp
Source/WebCore/html/HTMLFieldSetElement.cpp
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLObjectElement.cpp
Source/WebCore/rendering/FilterEffectRenderer.cpp
Source/WebCore/style/StyleResolveTree.cpp
Source/WebCore/svg/SVGStyledElement.cpp