From 3749d61e1f7a59f5ec5067e560af1eb610c82015 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Sun, 12 Aug 2012 09:27:39 +0200 Subject: Imported WebKit commit a77350243e054f3460d1137301d8b3faee3d2052 (http://svn.webkit.org/repository/webkit/trunk@125365) New snapshot with build fixes for latest API changes in Qt and all WK1 Win MSVC fixes upstream --- Source/WebCore/html/HTMLPropertiesCollection.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'Source/WebCore/html/HTMLPropertiesCollection.cpp') diff --git a/Source/WebCore/html/HTMLPropertiesCollection.cpp b/Source/WebCore/html/HTMLPropertiesCollection.cpp index b67c4c16a..7e81766db 100644 --- a/Source/WebCore/html/HTMLPropertiesCollection.cpp +++ b/Source/WebCore/html/HTMLPropertiesCollection.cpp @@ -69,14 +69,14 @@ void HTMLPropertiesCollection::updateRefElements() const toHTMLElement(base())->getItemRefElements(m_itemRefElements); } -static Node* nextNodeWithProperty(Node* base, Node* node) +static Node* nextNodeWithProperty(Node* rootNode, Node* previous, Node* ownerNode) { // An Microdata item may contain properties which in turn are items themselves. Properties can // also themselves be groups of name-value pairs, by putting the itemscope attribute on the element // that declares the property. If the property has an itemscope attribute specified then we need // to traverse the next sibling. - return node == base || (node->isHTMLElement() && !toHTMLElement(node)->fastHasAttribute(itemscopeAttr)) - ? node->traverseNextNode(base) : node->traverseNextSibling(base); + return previous == ownerNode || (previous->isHTMLElement() && !toHTMLElement(previous)->fastHasAttribute(itemscopeAttr)) + ? previous->traverseNextNode(rootNode) : previous->traverseNextSibling(rootNode); } Element* HTMLPropertiesCollection::virtualItemAfter(unsigned& offsetInArray, Element* previousItem) const @@ -90,13 +90,14 @@ Element* HTMLPropertiesCollection::virtualItemAfter(unsigned& offsetInArray, Ele return 0; } -HTMLElement* HTMLPropertiesCollection::virtualItemAfter(HTMLElement* base, Element* previous) const +HTMLElement* HTMLPropertiesCollection::virtualItemAfter(HTMLElement* rootNode, Element* previous) const { Node* current; - current = previous ? nextNodeWithProperty(base, previous) : base; + Node* ownerNode = this->ownerNode(); + current = previous ? nextNodeWithProperty(rootNode, previous, ownerNode) : rootNode; - for (; current; current = nextNodeWithProperty(base, current)) { - if (!current->isHTMLElement()) + for (; current; current = nextNodeWithProperty(rootNode, current, ownerNode)) { + if (current == ownerNode || !current->isHTMLElement()) continue; HTMLElement* element = toHTMLElement(current); if (element->fastHasAttribute(itempropAttr) && element->itemProp()->length()) { -- cgit v1.2.1