WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
dump also a document of a frame
bug-61727-20110530221009.patch (text/plain), 4.52 KB, created by
Hayato Ito
on 2011-05-30 06:10:11 PDT
(
hide
)
Description:
dump also a document of a frame
Filename:
MIME Type:
Creator:
Hayato Ito
Created:
2011-05-30 06:10:11 PDT
Size:
4.52 KB
patch
obsolete
>Subversion Revision: 87361 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 7f05d7f7aefaf7470cdfb463c6bdb9d7ad38fbc1..c584cafb1b941495ca4eab77d52dc2ca3a34b97d 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,21 @@ >+2011-05-30 Hayato Ito <hayato@chromium.org> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a utility function, Node::showTreeForThisAcrossFrame, for dumping a tree for the Node. >+ Similar to an existing Node::showTreeForThis() function, but dumps also a document of a frame element. >+ >+ https://bugs.webkit.org/show_bug.cgi?id=61727 >+ >+ No new tests since a added function is only available in debug build. >+ >+ * dom/Node.cpp: >+ (WebCore::shadowRoot): >+ (WebCore::Node::parentOrHostOrFrameOwner): >+ (WebCore::Node::traverseNextNodeAcrossFrame): >+ (WebCore::Node::showTreeForThisAcrossFrame): >+ * dom/Node.h: >+ > 2011-05-25 James Simonsen <simonjam@chromium.org> > > Reviewed by Adam Barth. >diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp >index 7cf32664751f58b7e296d09a5f73fc93527318af..aa9d4c40f2aec475a43b73514aff6fa01c28cac1 100644 >--- a/Source/WebCore/dom/Node.cpp >+++ b/Source/WebCore/dom/Node.cpp >@@ -57,6 +57,7 @@ > #include "Frame.h" > #include "FrameView.h" > #include "HTMLElement.h" >+#include "HTMLFrameOwnerElement.h" > #include "HTMLNames.h" > #include "InspectorInstrumentation.h" > #include "KeyboardEvent.h" >@@ -847,7 +848,7 @@ bool Node::hasNonEmptyBoundingBox() const > return false; > } > >-inline static ShadowRoot* shadowRoot(Node* node) >+inline static ShadowRoot* shadowRoot(const Node* node) > { > return node->isElementNode() ? toElement(node)->shadowRoot() : 0; > } >@@ -2375,6 +2376,51 @@ void Node::formatForDebugger(char* buffer, unsigned length) const > strncpy(buffer, result.utf8().data(), length - 1); > } > >+ContainerNode* Node::parentOrHostOrFrameOwner() const >+{ >+ ContainerNode* parent = parentOrHostNode(); >+ if (!parent && document()->frame()) >+ parent = document()->frame()->ownerElement(); >+ return parent; >+} >+ >+Node* Node::traverseNextNodeAcrossFrame() const >+{ >+ if (isFrameOwnerElement()) >+ return static_cast<const HTMLFrameOwnerElement*>(this)->contentDocument(); >+ if (ShadowRoot* shadow = shadowRoot(this)) >+ return shadow->traverseNextNodeAcrossFrame(); >+ if (firstChild()) >+ return firstChild(); >+ if (nextSibling()) >+ return nextSibling(); >+ const Node* n = this; >+ while (n && !n->nextSibling()) >+ n = n->parentOrHostOrFrameOwner(); >+ if (n) >+ return n->nextSibling(); >+ return 0; >+} >+ >+void Node::showTreeForThisAcrossFrame() const >+{ >+ const Node* markedNode = this; >+ const char* markedLabel = "*"; >+ const Node* node = this; >+ while (node->parentOrHostOrFrameOwner()) >+ node = node->parentOrHostOrFrameOwner(); >+ const Node* rootNode = node; >+ for (; node; node = node->traverseNextNodeAcrossFrame()) { >+ if (node == markedNode) >+ fprintf(stderr, "%s", markedLabel); >+ String indent; >+ for (const Node* tmpNode = node; tmpNode && tmpNode != rootNode; tmpNode = tmpNode->parentOrHostOrFrameOwner()) >+ indent += "\t"; >+ fprintf(stderr, "%s", indent.utf8().data()); >+ node->showNode(); >+ } >+} >+ > #endif > > // -------- >diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h >index b9da94f208fb573be5a73e818fea115997d320ab..91abbe294c46dba5aa20ec430f54aae7bd0ef376 100644 >--- a/Source/WebCore/dom/Node.h >+++ b/Source/WebCore/dom/Node.h >@@ -501,6 +501,8 @@ public: > void showNode(const char* prefix = "") const; > void showTreeForThis() const; > void showTreeAndMark(const Node* markedNode1, const char* markedLabel1, const Node* markedNode2 = 0, const char* markedLabel2 = 0) const; >+ // Like showTreeForThis, but also shows a document of a frame element. >+ void showTreeForThisAcrossFrame() const; > #endif > > void removeNodeListCacheIfPossible(); >@@ -714,6 +716,13 @@ protected: > void setHasRareSVGData() { setFlag(HasSVGRareDataFlag); } > void clearHasRareSVGData() { clearFlag(HasSVGRareDataFlag); } > #endif >+ >+#ifndef NDEBUG >+ // In addition to parentOrHost, also up to a FrameOwnerElement of the current frame. >+ ContainerNode* parentOrHostOrFrameOwner() const; >+ // Like traversalNextNode, but traverses also into a document of a frame element. >+ Node* traverseNextNodeAcrossFrame() const; >+#endif > }; > > // Used in Node::addSubresourceAttributeURLs() and in addSubresourceStyleURLs()
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 61727
:
95342
|
95392
|
95398