diff options
| author | Cary Clark <cary@android.com> | 2010-04-06 16:07:01 -0400 |
|---|---|---|
| committer | Cary Clark <cary@android.com> | 2010-04-06 16:07:01 -0400 |
| commit | be312690095b3ccc1f52336b69c11bf42d4eb9e5 (patch) | |
| tree | 7b3aea0c7fa5d388927ff4b27415fa56e9ba8940 /WebKit/android/nav | |
| parent | c0cc84d6a4d0db0b39a9036bdbeb67f6c7e9e56e (diff) | |
| download | external_webkit-be312690095b3ccc1f52336b69c11bf42d4eb9e5.zip external_webkit-be312690095b3ccc1f52336b69c11bf42d4eb9e5.tar.gz external_webkit-be312690095b3ccc1f52336b69c11bf42d4eb9e5.tar.bz2 | |
keep frames associated with regular hits and direct hits
The hit test on the nav cache returns a node/frame pair.
It looks for the closest hit, but gives priority to a direct
hit. Track the frame associated with the direct hit
separately, so that the correct node/frame pair is returned.
Change-Id: Icb1e3de4a0aad3c6dd9b2b81669f9c7bbb260282
http://b/2316138
Diffstat (limited to 'WebKit/android/nav')
| -rw-r--r-- | WebKit/android/nav/CachedFrame.cpp | 8 | ||||
| -rw-r--r-- | WebKit/android/nav/CachedFrame.h | 3 | ||||
| -rw-r--r-- | WebKit/android/nav/CachedRoot.cpp | 3 |
3 files changed, 9 insertions, 5 deletions
diff --git a/WebKit/android/nav/CachedFrame.cpp b/WebKit/android/nav/CachedFrame.cpp index bd36bfb..21a4115 100644 --- a/WebKit/android/nav/CachedFrame.cpp +++ b/WebKit/android/nav/CachedFrame.cpp @@ -355,6 +355,7 @@ CachedNode* CachedFrame::find(WebCore::Node* node) // !!! probably debugging onl const CachedNode* CachedFrame::findBestAt(const WebCore::IntRect& rect, int* best, bool* inside, const CachedNode** directHit, + const CachedFrame** directHitFramePtr, const CachedFrame** framePtr, int* x, int* y, bool checkForHiddenStart) const { @@ -392,7 +393,7 @@ const CachedNode* CachedFrame::findBestAt(const WebCore::IntRect& rect, // We have a direct hit. if (*directHit == NULL) { *directHit = test; - *framePtr = this; + *directHitFramePtr = this; *x = center.x(); *y = center.y(); } else { @@ -402,7 +403,7 @@ const CachedNode* CachedFrame::findBestAt(const WebCore::IntRect& rect, // This rectangle is inside the other one, so it is // the best one. *directHit = test; - *framePtr = this; + *directHitFramePtr = this; } } } @@ -444,12 +445,13 @@ const CachedNode* CachedFrame::findBestAt(const WebCore::IntRect& rect, for (const CachedFrame* frame = mCachedFrames.begin(); frame != mCachedFrames.end(); frame++) { const CachedNode* frameResult = frame->findBestAt(rect, best, inside, - directHit, framePtr, x, y, checkForHiddenStart); + directHit, directHitFramePtr, framePtr, x, y, checkForHiddenStart); if (NULL != frameResult) result = frameResult; } if (NULL != *directHit) { result = *directHit; + *framePtr = *directHitFramePtr; } return result; } diff --git a/WebKit/android/nav/CachedFrame.h b/WebKit/android/nav/CachedFrame.h index f7276c1..ed76583 100644 --- a/WebKit/android/nav/CachedFrame.h +++ b/WebKit/android/nav/CachedFrame.h @@ -92,7 +92,8 @@ public: const CachedNode* document() const { return mCachedNodes.begin(); } bool empty() const { return mCachedNodes.size() < 2; } // must have 1 past doc const CachedNode* findBestAt(const WebCore::IntRect& , int* best, - bool* inside, const CachedNode** , const CachedFrame** , int* x, + bool* inside, const CachedNode** , const CachedFrame** directFrame, + const CachedFrame** resultFrame, int* x, int* y, bool checkForHidden) const; const CachedFrame* findBestFrameAt(int x, int y) const; const CachedNode* findBestHitAt(const WebCore::IntRect& , diff --git a/WebKit/android/nav/CachedRoot.cpp b/WebKit/android/nav/CachedRoot.cpp index 0941c7c..71c0993 100644 --- a/WebKit/android/nav/CachedRoot.cpp +++ b/WebKit/android/nav/CachedRoot.cpp @@ -780,9 +780,10 @@ const CachedNode* CachedRoot::findAt(const WebCore::IntRect& rect, int best = INT_MAX; bool inside = false; (const_cast<CachedRoot*>(this))->resetClippedOut(); + const CachedFrame* directHitFramePtr; const CachedNode* directHit = NULL; const CachedNode* node = findBestAt(rect, &best, &inside, &directHit, - framePtr, x, y, checkForHidden); + &directHitFramePtr, framePtr, x, y, checkForHidden); DBG_NAV_LOGD("node=%d (%p)", node == NULL ? 0 : node->index(), node == NULL ? NULL : node->nodePointer()); if (node == NULL) { |
