WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch v2
bug-31288-20091130173459.patch (text/plain), 4.31 KB, created by
Shinichiro Hamaji
on 2009-11-30 00:35:01 PST
(
hide
)
Description:
Patch v2
Filename:
MIME Type:
Creator:
Shinichiro Hamaji
Created:
2009-11-30 00:35:01 PST
Size:
4.31 KB
patch
obsolete
>diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog >index 8561b20..f6d3e14 100644 >--- a/WebCore/ChangeLog >+++ b/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2009-11-29 Shinichiro Hamaji <hamaji@chromium.org> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add a function to show render tree for debugging >+ https://bugs.webkit.org/show_bug.cgi?id=31288 >+ >+ No new tests because this just adds a function for debugging. >+ >+ * rendering/RenderObject.cpp: >+ (WebCore::RenderObject::showRenderObject): >+ (WebCore::RenderObject::showRenderTreeAndMark): >+ (showRenderTree): >+ * rendering/RenderObject.h: >+ > 2009-11-29 Brent Fulgham <bfulgham@webkit.org> > > Build fix. >diff --git a/WebCore/rendering/RenderObject.cpp b/WebCore/rendering/RenderObject.cpp >index 1e8e19f..5f8d3b7 100644 >--- a/WebCore/rendering/RenderObject.cpp >+++ b/WebCore/rendering/RenderObject.cpp >@@ -1335,6 +1335,50 @@ void RenderObject::showTreeForThis() const > node()->showTreeForThis(); > } > >+void RenderObject::showRenderObject() const >+{ >+ showRenderObject(0); >+} >+ >+void RenderObject::showRenderObject(int printedCharacters) const >+{ >+ // As this function is intended to be used when debugging, the >+ // this pointer may be 0. >+ if (!this) { >+ fputs("(null)\n", stderr); >+ return; >+ } >+ >+ printedCharacters += fprintf(stderr, "%s %p", renderName(), this); >+ >+ if (node()) { >+ if (printedCharacters) >+ for (; printedCharacters < 39; printedCharacters++) >+ fputc(' ', stderr); >+ fputc('\t', stderr); >+ node()->showNode(); >+ } else >+ fputc('\n', stderr); >+} >+ >+void RenderObject::showRenderTreeAndMark(const RenderObject* markedObject1, const char* markedLabel1, const RenderObject* markedObject2, const char* markedLabel2, int depth) const >+{ >+ int printedCharacters = 0; >+ if (markedObject1 == this && markedLabel1) >+ printedCharacters += fprintf(stderr, "%s", markedLabel1); >+ if (markedObject2 == this && markedLabel2) >+ printedCharacters += fprintf(stderr, "%s", markedLabel2); >+ for (; printedCharacters < depth * 2; printedCharacters++) >+ fputc(' ', stderr); >+ >+ showRenderObject(printedCharacters); >+ if (!this) >+ return; >+ >+ for (const WebCore::RenderObject* child = firstChild(); child; child = child->nextSibling()) >+ child->showRenderTreeAndMark(markedObject1, markedLabel1, markedObject2, markedLabel2, depth + 1); >+} >+ > #endif // NDEBUG > > Color RenderObject::selectionBackgroundColor() const >@@ -2470,4 +2514,19 @@ void showTree(const WebCore::RenderObject* ro) > ro->showTreeForThis(); > } > >+void showRenderTree(const WebCore::RenderObject* object1) >+{ >+ showRenderTree(object1, 0); >+} >+ >+void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderObject* object2) >+{ >+ if (object1) { >+ const WebCore::RenderObject* root = object1; >+ while (root->parent()) >+ root = root->parent(); >+ root->showRenderTreeAndMark(object1, "*", object2, "-", 0); >+ } >+} >+ > #endif >diff --git a/WebCore/rendering/RenderObject.h b/WebCore/rendering/RenderObject.h >index 649a2de..d40ae6d 100644 >--- a/WebCore/rendering/RenderObject.h >+++ b/WebCore/rendering/RenderObject.h >@@ -231,6 +231,12 @@ private: > public: > #ifndef NDEBUG > void showTreeForThis() const; >+ >+ void showRenderObject() const; >+ // We don't make printedCharacters an optional parameter so that >+ // showRenderObject can be called from gdb easily. >+ void showRenderObject(int printedCharacters) const; >+ void showRenderTreeAndMark(const RenderObject* markedObject1 = 0, const char* markedLabel1 = 0, const RenderObject* markedObject2 = 0, const char* markedLabel2 = 0, int depth = 0) const; > #endif > > static RenderObject* createObject(Node*, RenderStyle*); >@@ -1036,6 +1042,10 @@ inline void adjustFloatQuadForAbsoluteZoom(FloatQuad& quad, RenderObject* render > #ifndef NDEBUG > // Outside the WebCore namespace for ease of invocation from gdb. > void showTree(const WebCore::RenderObject*); >+void showRenderTree(const WebCore::RenderObject* object1); >+// We don't make object2 an optional parameter so that showRenderTree >+// can be called from gdb easily. >+void showRenderTree(const WebCore::RenderObject* object1, const WebCore::RenderObject* object2); > #endif > > #endif // RenderObject_h
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
Flags:
darin
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 31288
:
42851
| 44009