summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2009-06-30 11:27:10 -0400
committerLeon Scroggins <scroggo@google.com>2009-06-30 13:44:38 -0400
commit1b973c4067dbc67aa157b2ca800fa22decd00f75 (patch)
tree96ca93c17d98623b935252694eb8b3d244de285d /WebKit
parentafe025b1a864e6ee82626dbdffffe5c3377c7ae0 (diff)
downloadexternal_webkit-1b973c4067dbc67aa157b2ca800fa22decd00f75.zip
external_webkit-1b973c4067dbc67aa157b2ca800fa22decd00f75.tar.gz
external_webkit-1b973c4067dbc67aa157b2ca800fa22decd00f75.tar.bz2
Fix a WebView longpress bug.
Longpressing on a WebView while the WebTextView is up calls WebTextView::performLongPress(). This used to be fine, but now we may still leave the WebTextView up while the user is longpressing on something else. Check to ensure that the focus is the same as the cursor before calling WebTextView's version. Also, send a click if the user longpresses on a different WebTextView, so it will now behave appropriately. Requires a change in frameworks/base. Provide a setter on CachedHistory to set the mousebounds, and set it in selectBestAt, so that getSimulatedMousePosition uses the correct information. Also edit some comments to refer to the cursor rather than the focus. In WebView.cpp, use the delete TypingCommand, making deleting and cutting work once again.
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/jni/WebViewCore.cpp8
-rw-r--r--WebKit/android/nav/CachedHistory.h7
-rw-r--r--WebKit/android/nav/WebView.cpp2
3 files changed, 7 insertions, 10 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index dd81eab..0829050 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -1410,13 +1410,7 @@ void WebViewCore::deleteSelection(int start, int end)
WebCore::Node* focus = currentFocus();
if (!focus)
return;
- WebCore::Frame* frame = focus->document()->frame();
- WebCore::PlatformKeyboardEvent downEvent(kKeyCodeDel, 0,
- true, 0, false, false, false);
- frame->eventHandler()->keyEvent(downEvent);
- WebCore::PlatformKeyboardEvent upEvent(kKeyCodeDel, 0,
- false, 0, false, false, false);
- frame->eventHandler()->keyEvent(upEvent);
+ WebCore::TypingCommand::deleteSelection(focus->document());
}
void WebViewCore::replaceTextfieldText(int oldStart,
diff --git a/WebKit/android/nav/CachedHistory.h b/WebKit/android/nav/CachedHistory.h
index c60f416..1ae62b9 100644
--- a/WebKit/android/nav/CachedHistory.h
+++ b/WebKit/android/nav/CachedHistory.h
@@ -50,6 +50,7 @@ public:
const WebCore::IntRect& navBounds() const { return mNavBounds; }
const WebCore::IntRect& priorBounds() const { return mPriorBounds; }
void setDidFirstLayout(bool did) { mDidFirstLayout = did; }
+ void setMouseBounds(const WebCore::IntRect& loc) { mMouseBounds = loc; }
void setNavBounds(const WebCore::IntRect& loc) { mNavBounds = loc; }
void setWorking(CachedFrame::Direction , const CachedNode* focus,
const WebCore::IntRect& viewBounds);
@@ -60,9 +61,9 @@ private:
const CachedNode* mNode;
CachedFrame::Direction mDirection;
} mVisited[NAVIGATION_VISIT_DEPTH];
- WebCore::IntRect mMouseBounds; // constricted bounds, if focus ring is partially visible
- WebCore::IntRect mNavBounds; // focus ring bounds plus optional keystroke movement
- WebCore::IntRect mPriorBounds; // prior chosen focus ring (for reversing narrowing)
+ WebCore::IntRect mMouseBounds; // constricted bounds, if cursor ring is partially visible
+ WebCore::IntRect mNavBounds; // cursor ring bounds plus optional keystroke movement
+ WebCore::IntRect mPriorBounds; // prior chosen cursor ring (for reversing narrowing)
bool mDirectionChange;
bool mDidFirstLayout; // set true when page is newly laid out
CachedFrame::Direction mLastMove;
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index b220617..092ae70 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -862,6 +862,7 @@ void selectBestAt(const WebCore::IntRect& rect)
bool disableFocusController = false;
CachedRoot* root = getFrameCache(DontAllowNewer);
const CachedNode* node = findAt(root, rect, &frame, &rx, &ry);
+
if (!node) {
DBG_NAV_LOGD("no nodes found root=%p", root);
disableFocusController = true;
@@ -870,6 +871,7 @@ void selectBestAt(const WebCore::IntRect& rect)
root->setCursor(0, 0);
} else {
DBG_NAV_LOGD("CachedNode:%p (%d)", node, node->index());
+ root->rootHistory()->setMouseBounds(node->bounds());
updateCursorBounds(root, frame, node);
root->setCursor(const_cast<CachedFrame*>(frame),
const_cast<CachedNode*>(node));