summaryrefslogtreecommitdiffstats
path: root/WebKit/android
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-01-22 00:13:42 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-01-22 00:13:42 -0800
commitf7e76168422a049a356179665d34ddfb74184920 (patch)
treefcec0de1891e83e86d93259cc2b46b6cee499b64 /WebKit/android
parent528e2187562372a650037bc65fc4446ac2ff0772 (diff)
downloadexternal_webkit-f7e76168422a049a356179665d34ddfb74184920.zip
external_webkit-f7e76168422a049a356179665d34ddfb74184920.tar.gz
external_webkit-f7e76168422a049a356179665d34ddfb74184920.tar.bz2
auto import from //branches/cupcake/...@127436
Diffstat (limited to 'WebKit/android')
-rw-r--r--WebKit/android/jni/WebViewCore.cpp25
-rw-r--r--WebKit/android/nav/CachedFrame.cpp22
-rw-r--r--WebKit/android/nav/CachedFrame.h2
-rw-r--r--WebKit/android/nav/WebView.cpp25
4 files changed, 41 insertions, 33 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 6aa92cb..64bfd8f 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -1684,20 +1684,21 @@ void WebViewCore::touchUp(int touchGeneration, int buildGeneration,
bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* nodePtr)
{
- if (framePtr && !FrameLoaderClientAndroid::get(m_mainFrame)->getCacheBuilder().validNode(framePtr, nodePtr))
- return false;
+ bool valid = framePtr == NULL || FrameLoaderClientAndroid::get(
+ m_mainFrame)->getCacheBuilder().validNode(framePtr, nodePtr);
WebFrame* webFrame = WebFrame::getWebFrame(m_mainFrame);
+ if (valid && nodePtr) {
// Need to special case area tags because an image map could have an area element in the middle
// so when attempting to get the default, the point chosen would be follow the wrong link.
- if (nodePtr && nodePtr->hasTagName(WebCore::HTMLNames::areaTag)) {
- webFrame->setUserInitiatedClick(true);
- WebCore::EventTargetNodeCast(nodePtr)->dispatchSimulatedClick(0, true, true);
- webFrame->setUserInitiatedClick(false);
- return true;
- }
- WebCore::RenderObject* renderer = nodePtr ? nodePtr->renderer() : 0;
- if (renderer) {
- if (renderer->isMenuList()) {
+ if (nodePtr->hasTagName(WebCore::HTMLNames::areaTag)) {
+ webFrame->setUserInitiatedClick(true);
+ WebCore::EventTargetNodeCast(nodePtr)->dispatchSimulatedClick(0,
+ true, true);
+ webFrame->setUserInitiatedClick(false);
+ return true;
+ }
+ WebCore::RenderObject* renderer = nodePtr->renderer();
+ if (renderer && renderer->isMenuList()) {
WebCore::HTMLSelectElement* select = static_cast<WebCore::HTMLSelectElement*>(nodePtr);
const WTF::Vector<WebCore::HTMLElement*>& listItems = select->listItems();
SkTDArray<const uint16_t*> names;
@@ -1727,7 +1728,7 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node
return true;
}
}
- if (!framePtr)
+ if (!valid || !framePtr)
framePtr = m_mainFrame;
webFrame->setUserInitiatedClick(true);
DBG_NAV_LOGD("m_mousePos={%d,%d}", m_mousePos.x(), m_mousePos.y());
diff --git a/WebKit/android/nav/CachedFrame.cpp b/WebKit/android/nav/CachedFrame.cpp
index 9365d06..0231394 100644
--- a/WebKit/android/nav/CachedFrame.cpp
+++ b/WebKit/android/nav/CachedFrame.cpp
@@ -287,18 +287,6 @@ int CachedFrame::compare(BestData& testData, const BestData& bestData, const Cac
return UNDECIDED;
}
-bool CachedFrame::containsFrame(const CachedFrame* test) const
-{
- if (this == test)
- return true;
- for (const CachedFrame* frame = mCachedFrames.begin();
- frame != mCachedFrames.end(); frame++) {
- if (frame->containsFrame(test))
- return true;
- }
- return false;
-}
-
const CachedNode* CachedFrame::currentFocus(const CachedFrame** framePtr) const
{
if (framePtr)
@@ -910,6 +898,16 @@ void CachedFrame::resetClippedOut()
}
}
+bool CachedFrame::sameFrame(const CachedFrame* test) const
+{
+ ASSERT(test);
+ if (mIndex != test->mIndex)
+ return false;
+ if (mIndex == -1) // index within parent's array of children, or -1 if root
+ return true;
+ return mParent->sameFrame(test->mParent);
+}
+
void CachedFrame::setData()
{
if (this != mRoot) {
diff --git a/WebKit/android/nav/CachedFrame.h b/WebKit/android/nav/CachedFrame.h
index 1347f62..8e77470 100644
--- a/WebKit/android/nav/CachedFrame.h
+++ b/WebKit/android/nav/CachedFrame.h
@@ -66,7 +66,6 @@ public:
bool checkVisited(const CachedNode* , CachedFrame::Direction ) const;
size_t childCount() { return mCachedFrames.size(); }
void clearFocus();
- bool containsFrame(const CachedFrame* ) const;
const CachedNode* currentFocus() const { return currentFocus(NULL); }
const CachedNode* currentFocus(const CachedFrame** ) const;
bool directionChange() const;
@@ -92,6 +91,7 @@ public:
CachedFrame* lastChild() { return &mCachedFrames.last(); }
const CachedFrame* parent() const { return mParent; }
CachedFrame* parent() { return mParent; }
+ bool sameFrame(const CachedFrame* ) const;
void removeLast() { mCachedNodes.removeLast(); }
void resetClippedOut();
void setContentsSize(int width, int height) { mContents.setWidth(width);
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index c645f72..64876ab 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -776,14 +776,12 @@ OutOfFocusFix fixOutOfDateFocus(bool useReplay)
const WebCore::IntRect& cachedBounds = m_frameCacheUI->rootHistory()->focusBounds();
const CachedFrame* webFrame = 0;
const CachedNode* webFocusNode = webRoot->currentFocus(&webFrame);
- if (webFocusNode && webRoot->containsFrame(cachedFrame)) {
+ if (webFocusNode && webFrame && webFrame->sameFrame(cachedFrame)) {
if (useReplay && !m_replay.count()) {
DBG_NAV_LOG("!m_replay.count()");
return DoNothing;
}
- if (webFocusNode->index() == cachedFocusNode->index() &&
- webFrame->indexInParent() == cachedFrame->indexInParent())
- {
+ if (webFocusNode->index() == cachedFocusNode->index()) {
DBG_NAV_LOG("index ==");
return DoNothing;
}
@@ -796,7 +794,18 @@ OutOfFocusFix fixOutOfDateFocus(bool useReplay)
DBG_NAV_LOG("webBounds contains");
return DoNothing;
}
- }
+ DBG_NAV_LOGD("cachedBounds=(%d,%d,w=%d,h=%d) webBounds=(%d,%d,w=%d,"
+ "%h=d)", cachedBounds.x(), cachedBounds.y(),
+ cachedBounds.width(), cachedBounds.height(), webBounds.x(),
+ webBounds.y(), webBounds.width(), webBounds.height());
+ } else
+ DBG_NAV_LOGD("cachedBounds=(%d,%d,w=%d,h=%d) cachedFrame=%p (%d)"
+ " webFocusNode=%p (%d) webFrame=%p (%d)",
+ cachedBounds.x(), cachedBounds.y(),
+ cachedBounds.width(), cachedBounds.height(),
+ cachedFrame, cachedFrame ? cachedFrame->indexInParent() : -1,
+ webFocusNode, webFocusNode ? webFocusNode->index() : -1,
+ webFrame, webFrame ? webFrame->indexInParent() : -1);
const CachedFrame* foundFrame = 0;
int x, y;
const CachedNode* found = findAt(webRoot, cachedBounds, &foundFrame, &x, &y);
@@ -806,9 +815,9 @@ OutOfFocusFix fixOutOfDateFocus(bool useReplay)
foundFrame, foundFrame ? foundFrame->indexInParent() : -1);
if (found) {
WebCore::IntRect newBounds = found->bounds();
- DBG_NAV_LOGD("cachedBounds=(%d,%d,%d,%d) found=(%d,%d,%d,%d)",
- cachedBounds.x(), cachedBounds.y(), cachedBounds.width(), cachedBounds.height(),
- newBounds.x(), newBounds.y(), newBounds.width(), newBounds.height());
+ DBG_NAV_LOGD("found=(%d,%d,w=%d,h=%d) x=%d y=%d",
+ newBounds.x(), newBounds.y(), newBounds.width(),
+ newBounds.height(), x, y);
}
#endif
webRoot->setCachedFocus(const_cast<CachedFrame*>(foundFrame),