summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebKit/android/nav/CacheBuilder.cpp17
-rw-r--r--WebKit/android/nav/CacheBuilder.h1
-rw-r--r--WebKit/android/nav/CachedFrame.cpp2
3 files changed, 12 insertions, 8 deletions
diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp
index 37bdc9a..58be0e8 100644
--- a/WebKit/android/nav/CacheBuilder.cpp
+++ b/WebKit/android/nav/CacheBuilder.cpp
@@ -824,6 +824,16 @@ void CacheBuilder::buildCache(CachedRoot* root)
setData((CachedFrame*) root);
}
+static Node* ParentWithChildren(Node* node)
+{
+ Node* parent = node;
+ while ((parent = parent->parentNode())) {
+ if (parent->childNodeCount() > 1)
+ return parent;
+ }
+ return 0;
+}
+
static Node* OneAfter(Node* node)
{
Node* parent = node;
@@ -917,8 +927,6 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
lastChildIndex = last->mCachedNodeIndex;
last = &tracker.last();
}
- if (node == last->mParentLastChild)
- last->mParentLastChild = NULL;
do {
const ClipColumnTracker* lastClip = &clipTracker.last();
if (node != lastClip->mLastChild)
@@ -1211,9 +1219,7 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
cachedNode.setMaxLength(maxLength);
cachedNode.setName(name);
cachedNode.setParentIndex(last->mCachedNodeIndex);
- if (last->mParentLastChild == NULL)
- last->mParentLastChild = OneAfter(node->parentNode()->lastChild());
- cachedNode.setParentGroup(last->mParentLastChild);
+ cachedNode.setParentGroup(ParentWithChildren(node));
cachedNode.setTabIndex(tabIndex);
cachedNode.setTextSize(textSize);
cachedNode.setType(type);
@@ -1235,7 +1241,6 @@ void CacheBuilder::BuildFrame(Frame* root, Frame* frame,
Tracker& working = tracker.last();
working.mCachedNodeIndex = lastIndex;
working.mLastChild = OneAfter(lastChild);
- working.mParentLastChild = OneAfter(node->parentNode()->lastChild());
last = &tracker.at(tracker.size() - 2);
working.mSomeParentTakesFocus = last->mSomeParentTakesFocus | takesFocus;
}
diff --git a/WebKit/android/nav/CacheBuilder.h b/WebKit/android/nav/CacheBuilder.h
index 784302c..0c12699 100644
--- a/WebKit/android/nav/CacheBuilder.h
+++ b/WebKit/android/nav/CacheBuilder.h
@@ -200,7 +200,6 @@ private:
int mCachedNodeIndex;
int mTabIndex;
Node* mLastChild;
- Node* mParentLastChild;
bool mSomeParentTakesFocus;
};
void adjustForColumns(const ClipColumnTracker& track,
diff --git a/WebKit/android/nav/CachedFrame.cpp b/WebKit/android/nav/CachedFrame.cpp
index 953eed4..54c295d 100644
--- a/WebKit/android/nav/CachedFrame.cpp
+++ b/WebKit/android/nav/CachedFrame.cpp
@@ -687,7 +687,7 @@ int CachedFrame::frameNodeCommon(BestData& testData, const CachedNode* test, Bes
// return REJECT_TEST;
// }
void* par = cursor ? cursor->parentGroup() : NULL;
- testData.mCursorChild = test->parentGroup() == par;
+ testData.mCursorChild = par ? test->parentGroup() == par : false;
#if 0 // not debugged
if (cursor && cursor->hasMouseOver() && test->hasMouseOver() == false &&
cursor->bounds().contains(test->bounds()))