diff options
author | Cary Clark <cary@android.com> | 2010-11-18 09:39:19 -0500 |
---|---|---|
committer | Cary Clark <cary@android.com> | 2010-11-18 10:24:56 -0500 |
commit | 908643d12d19aa4f2d69c47d5c1d4243da8ddfb7 (patch) | |
tree | 8b692a5544675cedbcdcca2617215257efb098dc /WebKit | |
parent | f9547834d9faf8b38b60a98d57b961b97065cdcd (diff) | |
download | external_webkit-908643d12d19aa4f2d69c47d5c1d4243da8ddfb7.zip external_webkit-908643d12d19aa4f2d69c47d5c1d4243da8ddfb7.tar.gz external_webkit-908643d12d19aa4f2d69c47d5c1d4243da8ddfb7.tar.bz2 |
fix indices in cached frame
After the CachedFrame is built, it may replace the previous
node. Replace the indices stored in the CachedFrame and in the
CachedNode with the index from the overwritten node.
bug:3201246
Change-Id: Ia70f4f2c1f8009db2370e723bc8631e4a3873e75
Diffstat (limited to 'WebKit')
-rw-r--r-- | WebKit/android/nav/CacheBuilder.cpp | 8 | ||||
-rw-r--r-- | WebKit/android/nav/CachedFrame.cpp | 2 | ||||
-rw-r--r-- | WebKit/android/nav/CachedFrame.h | 6 |
3 files changed, 13 insertions, 3 deletions
diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp index 22b449a..47c7c70 100644 --- a/WebKit/android/nav/CacheBuilder.cpp +++ b/WebKit/android/nav/CacheBuilder.cpp @@ -1493,8 +1493,14 @@ bool CacheBuilder::CleanUpContainedNodes(CachedRoot* cachedRoot, if (onlyChildCached->parent() == lastCached) onlyChildCached->setParentIndex(lastCached->parentIndex()); bool hasFocus = lastCached->isFocus() || onlyChildCached->isFocus(); - if (outerIsMouseMoveOnly || onlyChild->isKeyboardFocusable(NULL)) + if (outerIsMouseMoveOnly || onlyChild->isKeyboardFocusable(NULL)) { + int index = lastCached->index(); *lastCached = *onlyChildCached; + lastCached->setIndex(index); + CachedFrame* frame = cachedFrame->hasFrame(lastCached); + if (frame) + frame->setIndexInParent(index); + } cachedFrame->removeLast(); if (hasFocus) cachedRoot->setCachedFocus(cachedFrame, cachedFrame->lastNode()); diff --git a/WebKit/android/nav/CachedFrame.cpp b/WebKit/android/nav/CachedFrame.cpp index 8f0df7a..4f9ec06 100644 --- a/WebKit/android/nav/CachedFrame.cpp +++ b/WebKit/android/nav/CachedFrame.cpp @@ -918,7 +918,7 @@ const CachedNode* CachedFrame::frameUp(const CachedNode* test, return bestData->mNode; } -const CachedFrame* CachedFrame::hasFrame(const CachedNode* node) const +CachedFrame* CachedFrame::hasFrame(const CachedNode* node) { return node->isFrame() ? &mCachedFrames[node->childFrameIndex()] : NULL; } diff --git a/WebKit/android/nav/CachedFrame.h b/WebKit/android/nav/CachedFrame.h index fdee849..8ca73cf 100644 --- a/WebKit/android/nav/CachedFrame.h +++ b/WebKit/android/nav/CachedFrame.h @@ -112,7 +112,10 @@ public: void* framePointer() const { return mFrame; } CachedNode* getIndex(int index) { return index >= 0 ? &mCachedNodes[index] : NULL; } - const CachedFrame* hasFrame(const CachedNode* node) const; + const CachedFrame* hasFrame(const CachedNode* node) const { + return const_cast<CachedFrame*>(this)->hasFrame(node); + } + CachedFrame* hasFrame(const CachedNode* node); void hideCursor(); int indexInParent() const { return mIndexInParent; } void init(const CachedRoot* root, int index, WebCore::Frame* frame); @@ -143,6 +146,7 @@ public: void setData(); bool setFocus(WebCore::Frame* , WebCore::Node* , int x, int y); void setFocusIndex(int index) { mFocusIndex = index; } + void setIndexInParent(int index) { mIndexInParent = index; } void setLocalViewBounds(const WebCore::IntRect& bounds) { mLocalViewBounds = bounds; } int size() { return mCachedNodes.size(); } const CachedInput* textInput(const CachedNode* node) const { |