diff options
author | Cary Clark <cary@android.com> | 2009-06-24 11:27:13 -0400 |
---|---|---|
committer | Cary Clark <cary@android.com> | 2009-06-24 14:12:54 -0400 |
commit | 0181faa1ffede024c2712df19ae7c855a8cf64e3 (patch) | |
tree | b8bc2dd39718cfd707195fd95031c564d602162d /WebKit/android/nav | |
parent | 8520036e325f7e1ef2351410a555610f05d15957 (diff) | |
download | external_webkit-0181faa1ffede024c2712df19ae7c855a8cf64e3.zip external_webkit-0181faa1ffede024c2712df19ae7c855a8cf64e3.tar.gz external_webkit-0181faa1ffede024c2712df19ae7c855a8cf64e3.tar.bz2 |
set trackball click to the edge of the text field, not the middle
Add clicking, key debug statements in WebViewCore.cpp.
Fix dumping nav tree to use NamedNodeMap.
Set click point to be start of text field, end of text area, middle
of others.
Make CachedRoot::getSimulatedMousePosition, callers const
Diffstat (limited to 'WebKit/android/nav')
-rw-r--r-- | WebKit/android/nav/CacheBuilder.cpp | 2 | ||||
-rw-r--r-- | WebKit/android/nav/CachedRoot.cpp | 19 | ||||
-rw-r--r-- | WebKit/android/nav/CachedRoot.h | 2 | ||||
-rw-r--r-- | WebKit/android/nav/WebView.cpp | 4 |
4 files changed, 20 insertions, 7 deletions
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); |