summaryrefslogtreecommitdiffstats
path: root/WebKit/android/nav
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android/nav')
-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
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);