Title: [89021] trunk/Source/WebCore
Revision
89021
Author
[email protected]
Date
2011-06-16 02:12:14 -0700 (Thu, 16 Jun 2011)

Log Message

2011-06-16  Hayato Ito  <[email protected]>

        Reviewed by Hajime Morita.

        Show child elements of a shadow host in Node::showTreeForThisAcrossFrame.
        https://bugs.webkit.org/show_bug.cgi?id=62782

        To make an implementation simple, get rid of traverseNextNodeAcrossFrame
        and traverse each Node recursively.

        No new tests since the function is only available in debug builds.

        * dom/Node.cpp:
        (WebCore::showSubTreeAcrossFrame):
        (WebCore::Node::showTreeForThisAcrossFrame):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (89020 => 89021)


--- trunk/Source/WebCore/ChangeLog	2011-06-16 09:09:49 UTC (rev 89020)
+++ trunk/Source/WebCore/ChangeLog	2011-06-16 09:12:14 UTC (rev 89021)
@@ -1,3 +1,19 @@
+2011-06-16  Hayato Ito  <[email protected]>
+
+        Reviewed by Hajime Morita.
+
+        Show child elements of a shadow host in Node::showTreeForThisAcrossFrame.
+        https://bugs.webkit.org/show_bug.cgi?id=62782
+
+        To make an implementation simple, get rid of traverseNextNodeAcrossFrame
+        and traverse each Node recursively.
+
+        No new tests since the function is only available in debug builds.
+
+        * dom/Node.cpp:
+        (WebCore::showSubTreeAcrossFrame):
+        (WebCore::Node::showTreeForThisAcrossFrame):
+
 2011-06-16  Gyuyoung Kim  <[email protected]>
 
         Reviewed by Kent Tamura.

Modified: trunk/Source/WebCore/dom/Node.cpp (89020 => 89021)


--- trunk/Source/WebCore/dom/Node.cpp	2011-06-16 09:09:49 UTC (rev 89020)
+++ trunk/Source/WebCore/dom/Node.cpp	2011-06-16 09:12:14 UTC (rev 89021)
@@ -2364,21 +2364,18 @@
     return parent;
 }
 
-static Node* traverseNextNodeAcrossFrame(Node* node)
+static void showSubTreeAcrossFrame(Node* node, const Node* markedNode, const String& indent)
 {
+    if (node == markedNode)
+        fputs("*", stderr);
+    fputs(indent.utf8().data(), stderr);
+    node->showNode();
     if (node->isFrameOwnerElement())
-        return static_cast<HTMLFrameOwnerElement*>(node)->contentDocument();
+        showSubTreeAcrossFrame(static_cast<HTMLFrameOwnerElement*>(node)->contentDocument(), markedNode, indent + "\t");
     if (ShadowRoot* shadow = shadowRoot(node))
-        return shadow;
-    if (node->firstChild())
-        return node->firstChild();
-    if (node->nextSibling())
-        return node->nextSibling();
-    while (node && !node->nextSibling())
-        node = parentOrHostOrFrameOwner(node);
-    if (node)
-        return node->nextSibling();
-    return 0;
+        showSubTreeAcrossFrame(shadow, markedNode, indent + "\t");
+    for (Node* child = node->firstChild(); child; child = child->nextSibling())
+        showSubTreeAcrossFrame(child, markedNode, indent + "\t");
 }
 
 void Node::showTreeForThisAcrossFrame() const
@@ -2386,15 +2383,7 @@
     Node* rootNode = const_cast<Node*>(this);
     while (parentOrHostOrFrameOwner(rootNode))
         rootNode = parentOrHostOrFrameOwner(rootNode);
-    for (Node* node = rootNode; node; node = traverseNextNodeAcrossFrame(node)) {
-        if (node == this)
-            fputs("*", stderr);
-        String indent;
-        for (Node* tmpNode = node; tmpNode && tmpNode != rootNode; tmpNode = parentOrHostOrFrameOwner(tmpNode))
-            indent += "\t";
-        fputs(indent.utf8().data(), stderr);
-        node->showNode();
-    }
+    showSubTreeAcrossFrame(rootNode, this, "");
 }
 
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to