Diff
Modified: trunk/Source/WebCore/ChangeLog (153941 => 153942)
--- trunk/Source/WebCore/ChangeLog 2013-08-12 12:18:00 UTC (rev 153941)
+++ trunk/Source/WebCore/ChangeLog 2013-08-12 15:52:09 UTC (rev 153942)
@@ -1,3 +1,67 @@
+2013-08-12 Antti Koivisto <[email protected]>
+
+ 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):
+
2013-08-12 Allan Sandfeld Jensen <[email protected]>
[Qt] Add Support for canvas blend modes
Modified: trunk/Source/WebCore/css/SelectorChecker.cpp (153941 => 153942)
--- trunk/Source/WebCore/css/SelectorChecker.cpp 2013-08-12 12:18:00 UTC (rev 153941)
+++ trunk/Source/WebCore/css/SelectorChecker.cpp 2013-08-12 15:52:09 UTC (rev 153942)
@@ -31,6 +31,7 @@
#include "CSSSelector.h"
#include "CSSSelectorList.h"
#include "Document.h"
+#include "ElementTraversal.h"
#include "FocusController.h"
#include "Frame.h"
#include "FrameSelection.h"
@@ -66,17 +67,17 @@
static inline bool isFirstChildElement(const Element* element)
{
- return !element->previousElementSibling();
+ return !ElementTraversal::previousSibling(element);
}
static inline bool isLastChildElement(const Element* element)
{
- return !element->nextElementSibling();
+ return !ElementTraversal::nextSibling(element);
}
static inline bool isFirstOfType(const Element* element, const QualifiedName& type)
{
- for (const Element* sibling = element->previousElementSibling(); sibling; sibling = sibling->previousElementSibling()) {
+ for (const Element* sibling = ElementTraversal::previousSibling(element); sibling; sibling = ElementTraversal::previousSibling(sibling)) {
if (sibling->hasTagName(type))
return false;
}
@@ -85,7 +86,7 @@
static inline bool isLastOfType(const Element* element, const QualifiedName& type)
{
- for (const Element* sibling = element->nextElementSibling(); sibling; sibling = sibling->nextElementSibling()) {
+ for (const Element* sibling = ElementTraversal::nextSibling(element); sibling; sibling = ElementTraversal::nextSibling(sibling)) {
if (sibling->hasTagName(type))
return false;
}
@@ -95,7 +96,7 @@
static inline int countElementsBefore(const Element* element)
{
int count = 0;
- for (const Element* sibling = element->previousElementSibling(); sibling; sibling = sibling->previousElementSibling()) {
+ for (const Element* sibling = ElementTraversal::previousSibling(element); sibling; sibling = ElementTraversal::previousSibling(sibling)) {
unsigned index = sibling->childIndex();
if (index) {
count += index;
@@ -109,7 +110,7 @@
static inline int countElementsOfTypeBefore(const Element* element, const QualifiedName& type)
{
int count = 0;
- for (const Element* sibling = element->previousElementSibling(); sibling; sibling = sibling->previousElementSibling()) {
+ for (const Element* sibling = ElementTraversal::previousSibling(element); sibling; sibling = ElementTraversal::previousSibling(sibling)) {
if (sibling->hasTagName(type))
++count;
}
@@ -119,7 +120,7 @@
static inline int countElementsAfter(const Element* element)
{
int count = 0;
- for (const Element* sibling = element->nextElementSibling(); sibling; sibling = sibling->nextElementSibling())
+ for (const Element* sibling = ElementTraversal::nextSibling(element); sibling; sibling = ElementTraversal::nextSibling(sibling))
++count;
return count;
}
@@ -127,7 +128,7 @@
static inline int countElementsOfTypeAfter(const Element* element, const QualifiedName& type)
{
int count = 0;
- for (const Element* sibling = element->nextElementSibling(); sibling; sibling = sibling->nextElementSibling()) {
+ for (const Element* sibling = ElementTraversal::nextSibling(element); sibling; sibling = ElementTraversal::nextSibling(sibling)) {
if (sibling->hasTagName(type))
++count;
}
Modified: trunk/Source/WebCore/dom/Element.cpp (153941 => 153942)
--- trunk/Source/WebCore/dom/Element.cpp 2013-08-12 12:18:00 UTC (rev 153941)
+++ trunk/Source/WebCore/dom/Element.cpp 2013-08-12 15:52:09 UTC (rev 153942)
@@ -2378,12 +2378,19 @@
Element* Element::lastElementChild() const
{
- Node* n = lastChild();
- while (n && !n->isElementNode())
- n = n->previousSibling();
- return toElement(n);
+ return ElementTraversal::lastWithin(this);
}
+Element* Element::previousElementSibling() const
+{
+ return ElementTraversal::previousSibling(this);
+}
+
+Element* Element::nextElementSibling() const
+{
+ return ElementTraversal::nextSibling(this);
+}
+
unsigned Element::childElementCount() const
{
unsigned count = 0;
Modified: trunk/Source/WebCore/dom/Element.h (153941 => 153942)
--- trunk/Source/WebCore/dom/Element.h 2013-08-12 12:18:00 UTC (rev 153941)
+++ trunk/Source/WebCore/dom/Element.h 2013-08-12 15:52:09 UTC (rev 153942)
@@ -825,22 +825,6 @@
return parent && parent->isElementNode() ? toElement(parent) : 0;
}
-inline Element* Element::previousElementSibling() const
-{
- Node* n = previousSibling();
- while (n && !n->isElementNode())
- n = n->previousSibling();
- return static_cast<Element*>(n);
-}
-
-inline Element* Element::nextElementSibling() const
-{
- Node* n = nextSibling();
- while (n && !n->isElementNode())
- n = n->nextSibling();
- return static_cast<Element*>(n);
-}
-
inline bool Element::fastHasAttribute(const QualifiedName& name) const
{
ASSERT(fastAttributeLookupAllowed(name));
Modified: trunk/Source/WebCore/dom/ElementTraversal.h (153941 => 153942)
--- trunk/Source/WebCore/dom/ElementTraversal.h 2013-08-12 12:18:00 UTC (rev 153941)
+++ trunk/Source/WebCore/dom/ElementTraversal.h 2013-08-12 15:52:09 UTC (rev 153942)
@@ -31,9 +31,11 @@
namespace WebCore {
namespace ElementTraversal {
-// First element child of the node.
+// First or last element child of the node.
Element* firstWithin(const Node*);
Element* firstWithin(const ContainerNode*);
+Element* lastWithin(const Node*);
+Element* lastWithin(const ContainerNode*);
// Pre-order traversal skipping non-element nodes.
Element* next(const Node*);
@@ -41,6 +43,12 @@
Element* next(const ContainerNode*);
Element* next(const ContainerNode*, const Node* stayWithin);
+// Next or previous Element sibling if there is one.
+Element* nextSibling(const Node*);
+Element* nextSibling(const ContainerNode*);
+Element* previousSibling(const Node*);
+Element* previousSibling(const ContainerNode*);
+
// Like next, but skips children.
Element* nextSkippingChildren(const Node*);
Element* nextSkippingChildren(const Node*, const Node* stayWithin);
@@ -58,6 +66,7 @@
}
namespace ElementTraversal {
+
template <class NodeType>
inline Element* firstElementWithinTemplate(NodeType* current)
{
@@ -71,6 +80,17 @@
inline Element* firstWithin(const Node* current) { return firstElementWithinTemplate(current); }
template <class NodeType>
+inline Element* lastElementWithinTemplate(NodeType* current)
+{
+ Node* node = current->lastChild();
+ while (node && !node->isElementNode())
+ node = node->previousSibling();
+ return toElement(node);
+}
+inline Element* lastWithin(const ContainerNode* current) { return lastElementWithinTemplate(current); }
+inline Element* lastWithin(const Node* current) { return lastElementWithinTemplate(current); }
+
+template <class NodeType>
inline Element* traverseNextElementTemplate(NodeType* current)
{
Node* node = NodeTraversal::next(current);
@@ -93,6 +113,28 @@
inline Element* next(const Node* current, const Node* stayWithin) { return traverseNextElementTemplate(current, stayWithin); }
template <class NodeType>
+inline Element* traverseNextSiblingElementTemplate(NodeType* current)
+{
+ Node* node = current->nextSibling();
+ while (node && !node->isElementNode())
+ node = node->nextSibling();
+ return toElement(node);
+}
+inline Element* nextSibling(const ContainerNode* current) { return traverseNextSiblingElementTemplate(current); }
+inline Element* nextSibling(const Node* current) { return traverseNextSiblingElementTemplate(current); }
+
+template <class NodeType>
+inline Element* traversePreviousSiblingElementTemplate(NodeType* current)
+{
+ Node* node = current->previousSibling();
+ while (node && !node->isElementNode())
+ node = node->previousSibling();
+ return toElement(node);
+}
+inline Element* previousSibling(const ContainerNode* current) { return traversePreviousSiblingElementTemplate(current); }
+inline Element* previousSibling(const Node* current) { return traversePreviousSiblingElementTemplate(current); }
+
+template <class NodeType>
inline Element* traverseNextElementSkippingChildrenTemplate(NodeType* current)
{
Node* node = NodeTraversal::nextSkippingChildren(current);
Modified: trunk/Source/WebCore/editing/ApplyStyleCommand.cpp (153941 => 153942)
--- trunk/Source/WebCore/editing/ApplyStyleCommand.cpp 2013-08-12 12:18:00 UTC (rev 153941)
+++ trunk/Source/WebCore/editing/ApplyStyleCommand.cpp 2013-08-12 15:52:09 UTC (rev 153942)
@@ -34,6 +34,7 @@
#include "Document.h"
#include "EditingStyle.h"
#include "Editor.h"
+#include "ElementTraversal.h"
#include "Frame.h"
#include "HTMLFontElement.h"
#include "HTMLInterchange.h"
@@ -99,11 +100,11 @@
return hasNoAttributeOrOnlyStyleAttribute(toHTMLElement(element), AllowNonEmptyStyleAttribute);
}
-static inline bool isSpanWithoutAttributesOrUnstyledStyleSpan(const Node* node)
+static inline bool isSpanWithoutAttributesOrUnstyledStyleSpan(const Element* element)
{
- if (!node || !node->isHTMLElement() || !node->hasTagName(spanTag))
+ if (!element || !element->isHTMLElement() || !element->hasTagName(spanTag))
return false;
- return hasNoAttributeOrOnlyStyleAttribute(toHTMLElement(node), StyleAttributeShouldBeEmpty);
+ return hasNoAttributeOrOnlyStyleAttribute(toHTMLElement(element), StyleAttributeShouldBeEmpty);
}
bool isEmptyFontTag(const Element* element, ShouldStyleAttributeBeEmpty shouldStyleAttributeBeEmpty)
@@ -440,12 +441,11 @@
// can be propagated, which can result in more splitting. If a dummy span gets
// cloned/split, the new node is always a sibling of it. Therefore, we scan
// all the children of the dummy's parent
- Node* next;
- for (Node* node = dummySpanAncestor->firstChild(); node; node = next) {
- next = node->nextSibling();
- if (isSpanWithoutAttributesOrUnstyledStyleSpan(node))
- removeNodePreservingChildren(node);
- node = next;
+ Element* next;
+ for (Element* element = ElementTraversal::firstWithin(dummySpanAncestor); element; element = next) {
+ next = ElementTraversal::nextSibling(element);
+ if (isSpanWithoutAttributesOrUnstyledStyleSpan(element))
+ removeNodePreservingChildren(element);
}
}
Modified: trunk/Source/WebCore/editing/CompositeEditCommand.cpp (153941 => 153942)
--- trunk/Source/WebCore/editing/CompositeEditCommand.cpp 2013-08-12 12:18:00 UTC (rev 153941)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.cpp 2013-08-12 15:52:09 UTC (rev 153942)
@@ -35,6 +35,7 @@
#include "DocumentMarkerController.h"
#include "Editor.h"
#include "EditorInsertAction.h"
+#include "ElementTraversal.h"
#include "ExceptionCodePlaceholder.h"
#include "Frame.h"
#include "HTMLElement.h"
@@ -1306,8 +1307,8 @@
if (!newBlock)
newBlock = createDefaultParagraphElement(document());
- RefPtr<Node> previousListNode = emptyListItem->isElementNode() ? toElement(emptyListItem.get())->previousElementSibling(): emptyListItem->previousSibling();
- RefPtr<Node> nextListNode = emptyListItem->isElementNode() ? toElement(emptyListItem.get())->nextElementSibling(): emptyListItem->nextSibling();
+ RefPtr<Node> previousListNode = emptyListItem->isElementNode() ? ElementTraversal::previousSibling(emptyListItem.get()): emptyListItem->previousSibling();
+ RefPtr<Node> nextListNode = emptyListItem->isElementNode() ? ElementTraversal::nextSibling(emptyListItem.get()): emptyListItem->nextSibling();
if (isListItem(nextListNode.get()) || isListElement(nextListNode.get())) {
// If emptyListItem follows another list item or nested list, split the list node.
if (isListItem(previousListNode.get()) || isListElement(previousListNode.get()))
Modified: trunk/Source/WebCore/editing/IndentOutdentCommand.cpp (153941 => 153942)
--- trunk/Source/WebCore/editing/IndentOutdentCommand.cpp 2013-08-12 12:18:00 UTC (rev 153941)
+++ trunk/Source/WebCore/editing/IndentOutdentCommand.cpp 2013-08-12 15:52:09 UTC (rev 153942)
@@ -27,6 +27,7 @@
#include "IndentOutdentCommand.h"
#include "Document.h"
+#include "ElementTraversal.h"
#include "HTMLElement.h"
#include "HTMLNames.h"
#include "InsertLineBreakCommand.h"
@@ -71,8 +72,8 @@
return false;
// FIXME: previousElementSibling does not ignore non-rendered content like <span></span>. Should we?
- Element* previousList = selectedListItem->previousElementSibling();
- Element* nextList = selectedListItem->nextElementSibling();
+ Element* previousList = ElementTraversal::previousSibling(selectedListItem);
+ Element* nextList = ElementTraversal::nextSibling(selectedListItem);
RefPtr<Element> newList = document()->createElement(listNode->tagQName(), false);
insertNodeBefore(newList, selectedListItem);
Modified: trunk/Source/WebCore/editing/InsertListCommand.cpp (153941 => 153942)
--- trunk/Source/WebCore/editing/InsertListCommand.cpp 2013-08-12 12:18:00 UTC (rev 153941)
+++ trunk/Source/WebCore/editing/InsertListCommand.cpp 2013-08-12 15:52:09 UTC (rev 153942)
@@ -25,6 +25,7 @@
#include "config.h"
#include "Element.h"
+#include "ElementTraversal.h"
#include "InsertListCommand.h"
#include "ExceptionCodePlaceholder.h"
#include "htmlediting.h"
@@ -69,10 +70,13 @@
if (canMergeLists(previousList, list.get()))
mergeIdenticalElements(previousList, list);
- if (!list || !list->nextElementSibling() || !list->nextElementSibling()->isHTMLElement())
+ if (!list)
+ return 0;
+ Element* sibling = ElementTraversal::nextSibling(list.get());
+ if (!sibling || !sibling->isHTMLElement())
return list.release();
- RefPtr<HTMLElement> nextList = toHTMLElement(list->nextElementSibling());
+ RefPtr<HTMLElement> nextList = toHTMLElement(sibling);
if (canMergeLists(list.get(), nextList.get())) {
mergeIdenticalElements(list, nextList);
return nextList.release();
Modified: trunk/Source/WebCore/editing/markup.cpp (153941 => 153942)
--- trunk/Source/WebCore/editing/markup.cpp 2013-08-12 12:18:00 UTC (rev 153941)
+++ trunk/Source/WebCore/editing/markup.cpp 2013-08-12 15:52:09 UTC (rev 153942)
@@ -1053,14 +1053,14 @@
// accommodate folks passing complete HTML documents to make the
// child of an element.
- RefPtr<Node> nextNode;
- for (RefPtr<Node> node = fragment->firstChild(); node; node = nextNode) {
- nextNode = node->nextSibling();
- if (node->hasTagName(htmlTag) || node->hasTagName(headTag) || node->hasTagName(bodyTag)) {
- HTMLElement* element = toHTMLElement(node.get());
- if (Node* firstChild = element->firstChild())
- nextNode = firstChild;
- removeElementPreservingChildren(fragment, element);
+ RefPtr<Element> nextElement;
+ for (RefPtr<Element> element = ElementTraversal::firstWithin(fragment.get()); element; element = nextElement) {
+ nextElement = ElementTraversal::nextSibling(element.get());
+ if (element->hasTagName(htmlTag) || element->hasTagName(headTag) || element->hasTagName(bodyTag)) {
+ HTMLElement* htmlElement = toHTMLElement(element.get());
+ if (Element* firstChild = ElementTraversal::firstWithin(htmlElement))
+ nextElement = firstChild;
+ removeElementPreservingChildren(fragment, htmlElement);
}
}
return fragment.release();
Modified: trunk/Source/WebCore/html/HTMLCollection.cpp (153941 => 153942)
--- trunk/Source/WebCore/html/HTMLCollection.cpp 2013-08-12 12:18:00 UTC (rev 153941)
+++ trunk/Source/WebCore/html/HTMLCollection.cpp 2013-08-12 15:52:09 UTC (rev 153942)
@@ -514,14 +514,14 @@
{
Element* element = ElementTraversal::firstWithin(root);
while (element && !isMatchingElement(nodeList, element))
- element = ElementTraversal::nextSkippingChildren(element, root);
+ element = ElementTraversal::nextSibling(element);
return element;
}
-inline Element* nextMatchingChildElement(const HTMLCollection* nodeList, Element* current, ContainerNode* root)
+inline Element* nextMatchingSiblingElement(const HTMLCollection* nodeList, Element* current)
{
do {
- current = ElementTraversal::nextSkippingChildren(current, root);
+ current = ElementTraversal::nextSibling(current);
} while (current && !isMatchingElement(nodeList, current));
return current;
}
@@ -542,7 +542,7 @@
return virtualItemAfter(offsetInArray, previous);
ASSERT(!offsetInArray);
if (shouldOnlyIncludeDirectChildren())
- return nextMatchingChildElement(this, previous, root);
+ return nextMatchingSiblingElement(this, previous);
return nextMatchingElement(this, previous, root);
}
@@ -558,7 +558,7 @@
return 0;
}
if (shouldOnlyIncludeDirectChildren()) {
- while ((currentElement = nextMatchingChildElement(this, currentElement, root))) {
+ while ((currentElement = nextMatchingSiblingElement(this, currentElement))) {
if (++currentOffset == offset)
return currentElement;
}
Modified: trunk/Source/WebCore/html/HTMLFieldSetElement.cpp (153941 => 153942)
--- trunk/Source/WebCore/html/HTMLFieldSetElement.cpp 2013-08-12 12:18:00 UTC (rev 153941)
+++ trunk/Source/WebCore/html/HTMLFieldSetElement.cpp 2013-08-12 15:52:09 UTC (rev 153942)
@@ -67,7 +67,7 @@
void HTMLFieldSetElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
{
HTMLFormControlElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
- for (Element* element = ElementTraversal::firstWithin(this); element; element = ElementTraversal::nextSkippingChildren(element, this)) {
+ for (Element* element = ElementTraversal::firstWithin(this); element; element = ElementTraversal::nextSibling(element)) {
if (element->hasTagName(legendTag))
invalidateDisabledStateUnder(element);
}
@@ -91,7 +91,7 @@
HTMLLegendElement* HTMLFieldSetElement::legend() const
{
- for (Element* child = ElementTraversal::firstWithin(this); child; child = ElementTraversal::nextSkippingChildren(child, this)) {
+ for (Element* child = ElementTraversal::firstWithin(this); child; child = ElementTraversal::nextSibling(child)) {
if (child->hasTagName(legendTag))
return static_cast<HTMLLegendElement*>(child);
}
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (153941 => 153942)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2013-08-12 12:18:00 UTC (rev 153941)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2013-08-12 15:52:09 UTC (rev 153942)
@@ -41,6 +41,7 @@
#include "DiagnosticLoggingKeys.h"
#include "DocumentLoader.h"
#include "ElementShadow.h"
+#include "ElementTraversal.h"
#include "Event.h"
#include "EventNames.h"
#include "ExceptionCode.h"
@@ -534,9 +535,9 @@
#if ENABLE(VIDEO_TRACK)
if (!RuntimeEnabledFeatures::webkitVideoTrackEnabled())
return;
-
- for (Node* node = firstChild(); node; node = node->nextSibling()) {
- if (node->hasTagName(trackTag)) {
+
+ for (Element* element = ElementTraversal::firstWithin(this); element; element = ElementTraversal::nextSibling(element)) {
+ if (element->hasTagName(trackTag)) {
scheduleDelayedAction(ConfigureTextTracks);
break;
}
Modified: trunk/Source/WebCore/html/HTMLObjectElement.cpp (153941 => 153942)
--- trunk/Source/WebCore/html/HTMLObjectElement.cpp 2013-08-12 12:18:00 UTC (rev 153941)
+++ trunk/Source/WebCore/html/HTMLObjectElement.cpp 2013-08-12 15:52:09 UTC (rev 153942)
@@ -466,7 +466,7 @@
if (MIMETypeRegistry::isJavaAppletMIMEType(getAttribute(typeAttr)))
return true;
- for (Element* child = ElementTraversal::firstWithin(this); child; child = ElementTraversal::nextSkippingChildren(child, this)) {
+ for (Element* child = ElementTraversal::firstWithin(this); child; child = ElementTraversal::nextSibling(child)) {
if (child->hasTagName(paramTag)
&& equalIgnoringCase(child->getNameAttribute(), "type")
&& MIMETypeRegistry::isJavaAppletMIMEType(child->getAttribute(valueAttr).string()))
Modified: trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp (153941 => 153942)
--- trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp 2013-08-12 12:18:00 UTC (rev 153941)
+++ trunk/Source/WebCore/rendering/FilterEffectRenderer.cpp 2013-08-12 15:52:09 UTC (rev 153942)
@@ -31,6 +31,7 @@
#include "ColorSpace.h"
#include "Document.h"
+#include "ElementTraversal.h"
#include "FEColorMatrix.h"
#include "FEComponentTransfer.h"
#include "FEDropShadow.h"
@@ -159,16 +160,14 @@
// This may need a spec clarification.
RefPtr<SVGFilterBuilder> builder = SVGFilterBuilder::create(previousEffect, SourceAlpha::create(this));
- for (Node* node = filter->firstChild(); node; node = node->nextSibling()) {
- if (!node->isSVGElement())
+ for (Element* element = ElementTraversal::firstWithin(filter); element; element = ElementTraversal::nextSibling(element)) {
+ if (!element->isSVGElement())
continue;
-
- SVGElement* element = toSVGElement(node);
- if (!element->isFilterEffect())
+ SVGElement* svgElement = toSVGElement(element);
+ if (!svgElement->isFilterEffect())
continue;
+ SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFilterPrimitiveStandardAttributes*>(svgElement);
- SVGFilterPrimitiveStandardAttributes* effectElement = static_cast<SVGFilterPrimitiveStandardAttributes*>(element);
-
effect = effectElement->build(builder.get(), this);
if (!effect)
continue;
Modified: trunk/Source/WebCore/style/StyleResolveTree.cpp (153941 => 153942)
--- trunk/Source/WebCore/style/StyleResolveTree.cpp 2013-08-12 12:18:00 UTC (rev 153941)
+++ trunk/Source/WebCore/style/StyleResolveTree.cpp 2013-08-12 15:52:09 UTC (rev 153942)
@@ -28,6 +28,7 @@
#include "Element.h"
#include "ElementRareData.h"
+#include "ElementTraversal.h"
#include "NodeRenderStyle.h"
#include "NodeTraversal.h"
#include "RenderObject.h"
@@ -293,12 +294,10 @@
document->renderer()->setStyle(documentStyle.release());
}
- for (Node* child = document->firstChild(); child; child = child->nextSibling()) {
- if (!child->isElementNode())
+ for (Element* child = ElementTraversal::firstWithin(document); child; child = ElementTraversal::nextSibling(child)) {
+ if (change < Inherit && !child->childNeedsStyleRecalc() && !child->needsStyleRecalc())
continue;
- Element* elementChild = toElement(child);
- if (change >= Inherit || elementChild->childNeedsStyleRecalc() || elementChild->needsStyleRecalc())
- resolveTree(elementChild, change);
+ resolveTree(child, change);
}
}
Modified: trunk/Source/WebCore/svg/SVGStyledElement.cpp (153941 => 153942)
--- trunk/Source/WebCore/svg/SVGStyledElement.cpp 2013-08-12 12:18:00 UTC (rev 153941)
+++ trunk/Source/WebCore/svg/SVGStyledElement.cpp 2013-08-12 15:52:09 UTC (rev 153942)
@@ -102,7 +102,7 @@
// If we aren't an instance in a <use> or the <use> title was not found, then find the first
// <title> child of this element.
Element* titleElement = ElementTraversal::firstWithin(this);
- for (; titleElement; titleElement = ElementTraversal::nextSkippingChildren(titleElement, this)) {
+ for (; titleElement; titleElement = ElementTraversal::nextSibling(titleElement)) {
if (titleElement->hasTagName(SVGNames::titleTag) && titleElement->isSVGElement())
break;
}