fix parent index of focus when building nav cache

When a focused node is found while walking the DOM, the
CachedFrame tree doesn't have its parent pointer set.
Fix the focus index in the parent when fixing the parent pointer.

Also fix a debug statement so that it doesn't depend on
the focus parent.

Fixes http://b/issue?id=2048186
diff --git a/WebKit/android/nav/CachedFrame.cpp b/WebKit/android/nav/CachedFrame.cpp
index 416e880..955a439 100644
--- a/WebKit/android/nav/CachedFrame.cpp
+++ b/WebKit/android/nav/CachedFrame.cpp
@@ -578,6 +578,9 @@
         child->finishInit();
         child++;
     }
+    CachedFrame* frameParent;
+    if (mFocusIndex >= 0 && (frameParent = parent()))
+        frameParent->setFocusIndex(indexInParent());
 }
 
 const CachedNode* CachedFrame::frameDown(const CachedNode* test, const CachedNode* limit, BestData* bestData,
diff --git a/WebKit/android/nav/CachedRoot.cpp b/WebKit/android/nav/CachedRoot.cpp
index 102da39..595b4b5 100644
--- a/WebKit/android/nav/CachedRoot.cpp
+++ b/WebKit/android/nav/CachedRoot.cpp
@@ -1256,7 +1256,7 @@
         frame = parent;
     }
 #if DEBUG_NAV_UI
-    const CachedNode* focus = currentFocus();
+    const CachedNode* focus = frame->currentFocus();
     WebCore::IntRect bounds = WebCore::IntRect(0, 0, 0, 0);
     if (focus)
         bounds = focus->bounds();