summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--WebKit/android/jni/WebViewCore.cpp20
-rw-r--r--WebKit/android/nav/CacheBuilder.cpp2
-rw-r--r--WebKit/android/nav/CachedRoot.cpp19
-rw-r--r--WebKit/android/nav/CachedRoot.h2
-rw-r--r--WebKit/android/nav/WebView.cpp4
5 files changed, 36 insertions, 11 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 29cfd3a..9cf48dd 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -1418,8 +1418,10 @@ void WebViewCore::passToJs(
int keyValue, bool down, bool cap, bool fn, bool sym)
{
WebCore::Node* focus = currentFocus();
- if (!focus)
+ if (!focus) {
+ DBG_NAV_LOG("!focus");
return;
+ }
WebCore::Frame* frame = focus->document()->frame();
// Construct the ModifierKey value
WebCore::PlatformKeyboardEvent::ModifierKey mods =
@@ -1437,14 +1439,18 @@ void WebViewCore::passToJs(
m_textGeneration = generation;
DBG_NAV_LOGD("focus=%p keyCode=%d keyValue=%d", focus, keyCode, keyValue);
WebCore::RenderObject* renderer = focus->renderer();
- if (!renderer || (!renderer->isTextField() && !renderer->isTextArea()))
+ if (!renderer || (!renderer->isTextField() && !renderer->isTextArea())) {
+ DBG_NAV_LOGD("renderer==%p || not text", renderer);
return;
+ }
setFocusControllerActive(true);
WebCore::RenderTextControl* renderText =
static_cast<WebCore::RenderTextControl*>(renderer);
WebCore::String test = renderText->text();
- if (test == current)
+ if (test == current) {
+ DBG_NAV_LOG("test == current");
return;
+ }
// If the text changed during the key event, update the UI text field.
updateTextfield(focus, false, test);
}
@@ -1656,6 +1662,9 @@ bool WebViewCore::click() {
WebCore::HitTestResult hitTestResult = m_mainFrame->eventHandler()->
hitTestResultAtPoint(pt, false);
WebCore::Node* focusNode = hitTestResult.innerNode();
+ DBG_NAV_LOGD("m_mousePos=(%d,%d) m_scrollOffset=(%d,%d) pt=(%d,%d)"
+ " focusNode=%p", m_mousePos.x(), m_mousePos.y(),
+ m_scrollOffsetX, m_scrollOffsetY, pt.x(), pt.y(), focusNode);
if (focusNode) {
keyHandled = handleMouseClick(focusNode->document()->frame(), focusNode);
}
@@ -1724,6 +1733,7 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node
webFrame->setUserInitiatedClick(true);
nodePtr->dispatchSimulatedClick(0, true, true);
webFrame->setUserInitiatedClick(false);
+ DBG_NAV_LOG("area");
return true;
}
WebCore::RenderObject* renderer = nodePtr->renderer();
@@ -1755,13 +1765,13 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node
listBoxRequest(reply, names.begin(), size, enabledArray.begin(), enabledArray.count(),
multiple, selectedArray.begin(), multiple ? selectedArray.count() :
selectElement->optionToListIndex(select->selectedIndex()));
+ DBG_NAV_LOG("menu list");
return true;
}
}
if (!valid || !framePtr)
framePtr = m_mainFrame;
webFrame->setUserInitiatedClick(true);
- DBG_NAV_LOGD("m_mousePos={%d,%d}", m_mousePos.x(), m_mousePos.y());
WebCore::PlatformMouseEvent mouseDown(m_mousePos, m_mousePos, WebCore::LeftButton,
WebCore::MouseEventPressed, 1, false, false, false, false,
WTF::currentTime());
@@ -1776,6 +1786,8 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node
// If the user clicked on a textfield, make the focusController active
// so we show the blinking cursor.
WebCore::Node* focusNode = currentFocus();
+ DBG_NAV_LOGD("m_mousePos={%d,%d} focusNode=%p handled=%s", m_mousePos.x(),
+ m_mousePos.y(), focusNode, handled ? "true" : "false");
if (focusNode) {
WebCore::RenderObject* renderer = focusNode->renderer();
if (renderer && (renderer->isTextField() || renderer->isTextArea()))
diff --git a/WebKit/android/nav/CacheBuilder.cpp b/WebKit/android/nav/CacheBuilder.cpp
index 475d2b7..ac24668 100644
--- a/WebKit/android/nav/CacheBuilder.cpp
+++ b/WebKit/android/nav/CacheBuilder.cpp
@@ -446,7 +446,7 @@ void CacheBuilder::Debug::groups() {
//print(renderer ? renderer->information().ascii() : "NO_RENDER_INFO");
if (node->isElementNode()) {
Element* element = static_cast<Element*>(node);
- NamedAttrMap* attrs = element->attributes();
+ NamedNodeMap* attrs = element->attributes();
unsigned length = attrs->length();
if (length > 0) {
newLine();
diff --git a/WebKit/android/nav/CachedRoot.cpp b/WebKit/android/nav/CachedRoot.cpp
index 7de2bfa..7da4bd3 100644
--- a/WebKit/android/nav/CachedRoot.cpp
+++ b/WebKit/android/nav/CachedRoot.cpp
@@ -694,14 +694,27 @@ int CachedRoot::getAndResetSelectionStart()
return start;
}
-void CachedRoot::getSimulatedMousePosition(WebCore::IntPoint* point)
+void CachedRoot::getSimulatedMousePosition(WebCore::IntPoint* point) const
{
#ifndef NDEBUG
ASSERT(CachedFrame::mDebug.mInUse);
#endif
const WebCore::IntRect& mouseBounds = mHistory->mMouseBounds;
- point->setX(mouseBounds.x() + (mouseBounds.width() >> 1));
- point->setY(mouseBounds.y() + (mouseBounds.height() >> 1));
+ int x = mouseBounds.x();
+ int y = mouseBounds.y();
+ int width = mouseBounds.width();
+ int height = mouseBounds.height();
+ point->setX(x + (width >> 1)); // default to box center
+ point->setY(y + (height >> 1));
+ const CachedNode* cursor = currentCursor();
+ if (cursor && cursor->bounds().contains(mHistory->mMouseBounds)) {
+ if (cursor->isTextField()) // if text field, return end of line
+ point->setX(x + width - 1);
+ else if (cursor->isTextArea()) { // if text area, return start
+ point->setX(x + 1);
+ point->setY(y + 1);
+ }
+ }
#if DEBUG_NAV_UI && !defined BROWSER_DEBUG
const WebCore::IntRect& navBounds = mHistory->mNavBounds;
LOGD("%s mHistory->mNavBounds={%d,%d,%d,%d} "
diff --git a/WebKit/android/nav/CachedRoot.h b/WebKit/android/nav/CachedRoot.h
index 1167a22..38ab2d8 100644
--- a/WebKit/android/nav/CachedRoot.h
+++ b/WebKit/android/nav/CachedRoot.h
@@ -56,7 +56,7 @@ public:
SkPicture* getPicture() { return mPicture; }
int getAndResetSelectionEnd();
int getAndResetSelectionStart();
- void getSimulatedMousePosition(WebCore::IntPoint* );
+ void getSimulatedMousePosition(WebCore::IntPoint* ) const;
void init(WebCore::Frame* , CachedHistory* );
bool innerDown(const CachedNode* , BestData* ) const;
bool innerLeft(const CachedNode* , BestData* ) const;
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index 1e36b03..a6e0d37 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -404,7 +404,7 @@ void drawMatches(SkCanvas* canvas)
void drawCursorRing(SkCanvas* canvas)
{
- CachedRoot* root = getFrameCache(AllowNewer);
+ const CachedRoot* root = getFrameCache(AllowNewer);
if (!root) {
DBG_NAV_LOG("!root");
m_followedLink = false;
@@ -1356,7 +1356,7 @@ static jint nativeCursorNodePointer(JNIEnv *env, jobject obj)
static jobject nativeCursorPosition(JNIEnv *env, jobject obj)
{
WebView* view = GET_NATIVE_VIEW(env, obj);
- CachedRoot* root = view->getFrameCache(WebView::DontAllowNewer);
+ const CachedRoot* root = view->getFrameCache(WebView::DontAllowNewer);
WebCore::IntPoint pos = WebCore::IntPoint(0, 0);
if (root)
root->getSimulatedMousePosition(&pos);