diff options
| author | Cary Clark <cary@android.com> | 2009-11-30 15:15:04 -0500 |
|---|---|---|
| committer | Cary Clark <cary@android.com> | 2009-11-30 15:15:04 -0500 |
| commit | b72d8281f4bbdb36f2d4a57c71fd266c41399c21 (patch) | |
| tree | 3e4ab3ab41e8878e2a8e012d86593f30df5eccb5 /WebKit/android | |
| parent | db239ca3504af9998d5717708fdef4676e286602 (diff) | |
| download | external_webkit-b72d8281f4bbdb36f2d4a57c71fd266c41399c21.zip external_webkit-b72d8281f4bbdb36f2d4a57c71fd266c41399c21.tar.gz external_webkit-b72d8281f4bbdb36f2d4a57c71fd266c41399c21.tar.bz2 | |
fix bugs in nav cache dump
Fix errors in empty frames, escape character sequences,
and characters outside the ascii range. These fixes are
specific to dumping the nav cache and are commented out
in all builds.
Diffstat (limited to 'WebKit/android')
| -rw-r--r-- | WebKit/android/nav/CacheBuilder.cpp | 14 | ||||
| -rw-r--r-- | WebKit/android/nav/CachedNode.cpp | 14 |
2 files changed, 20 insertions, 8 deletions
diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp index 4682620..37bdc9a 100644 --- a/WebKit/android/nav/CacheBuilder.cpp +++ b/WebKit/android/nav/CacheBuilder.cpp @@ -141,7 +141,9 @@ void CacheBuilder::Debug::flush() { break; len++; } - while (mBuffer[len] == '\\' || mBuffer[len] == '"') + while (len > 0 && mBuffer[len - 1] == '\\') + len--; + while (mBuffer[len] == '"') len++; } const char* prefix = mPrefix; @@ -347,8 +349,11 @@ void CacheBuilder::Debug::groups() { } while ((node = node->traverseNextNode()) != NULL); int focusIndex = -1; if (atLeastOne == false) { - DUMP_NAV_LOGD("#define TEST%s_RECTS NULL\n", name); - DUMP_NAV_LOGD("static int TEST%s_RECT_COUNT = 0; // no focusable nodes\n", name); + DUMP_NAV_LOGD("static DebugTestNode TEST%s_RECTS[] = {\n" + "{{0, 0, 0, 0}, \"\", 0, -1, \"\", {0, 0, 0, 0}, false, 0}\n" + "};\n\n", name); + DUMP_NAV_LOGD("static int TEST%s_RECT_COUNT = 1;" + " // no focusable nodes\n", name); DUMP_NAV_LOGD("#define TEST%s_RECTPARTS NULL\n", name); } else { node = doc; @@ -433,6 +438,7 @@ void CacheBuilder::Debug::groups() { snprintf(scratch, sizeof(scratch), ", {%d, %d, %d, %d}, %s" ", %d},",absB.x(), absB.y(), absB.width(), absB.height(), renderer->hasOverflowClip() ? "true" : "false", tabindex); + // TODO: add renderer->style()->visibility() print(scratch); } else print(", {0, 0, 0, 0}, false, 0},"); @@ -545,7 +551,7 @@ void CacheBuilder::Debug::groups() { int contentsHeight = layer->height(); DUMP_NAV_LOGD("static int TEST%s_FOCUS = %d;\n", name, focusIndex); DUMP_NAV_LOGD("static int TEST%s_WIDTH = %d;\n", name, contentsWidth); - DUMP_NAV_LOGD("static int TEST%s_HEIGHT = %d;\n", name, contentsHeight); + DUMP_NAV_LOGD("static int TEST%s_HEIGHT = %d;\n\n", name, contentsHeight); } bool CacheBuilder::Debug::isFocusable(Node* node) { diff --git a/WebKit/android/nav/CachedNode.cpp b/WebKit/android/nav/CachedNode.cpp index c8938ab..7ac39ea 100644 --- a/WebKit/android/nav/CachedNode.cpp +++ b/WebKit/android/nav/CachedNode.cpp @@ -316,13 +316,19 @@ void CachedNode::Debug::print() const char scratch[256]; size_t index = snprintf(scratch, sizeof(scratch), "// char* mExport=\""); const UChar* ch = b->mExport.characters(); - while (ch && *ch && index < sizeof(scratch)) - scratch[index++] = *ch++; + while (ch && *ch && index < sizeof(scratch)) { + UChar c = *ch++; + if (c < ' ' || c >= 0x7f) c = ' '; + scratch[index++] = c; + } DUMP_NAV_LOGD("%.*s\"\n", index, scratch); index = snprintf(scratch, sizeof(scratch), "// char* mName=\""); ch = b->mName.characters(); - while (ch && *ch && index < sizeof(scratch)) - scratch[index++] = *ch++; + while (ch && *ch && index < sizeof(scratch)) { + UChar c = *ch++; + if (c < ' ' || c >= 0x7f) c = ' '; + scratch[index++] = c; + } DUMP_NAV_LOGD("%.*s\"\n", index, scratch); DEBUG_PRINT_RECT(mBounds); DEBUG_PRINT_RECT(mHitBounds); |
