summaryrefslogtreecommitdiffstats
path: root/WebKit/android
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android')
-rw-r--r--WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp8
-rw-r--r--WebKit/android/WebCoreSupport/ChromeClientAndroid.h3
-rw-r--r--WebKit/android/jni/WebViewCore.cpp48
-rw-r--r--WebKit/android/jni/WebViewCore.h9
4 files changed, 66 insertions, 2 deletions
diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
index 93869c3..6f8b7fe 100644
--- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.cpp
@@ -333,6 +333,14 @@ void ChromeClientAndroid::reachedMaxAppCacheSize(int64_t spaceNeeded)
}
#endif
+void ChromeClientAndroid::populateVisitedLinks()
+{
+ Page* page = m_webFrame->page();
+ Frame* mainFrame = page->mainFrame();
+ FrameView* view = mainFrame->view();
+ android::WebViewCore::getWebViewCore(view)->populateVisitedLinks(&page->group());
+}
+
void ChromeClientAndroid::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geolocation)
{
ASSERT(geolocation);
diff --git a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h
index 82a0164..4ac3d6c 100644
--- a/WebKit/android/WebCoreSupport/ChromeClientAndroid.h
+++ b/WebKit/android/WebCoreSupport/ChromeClientAndroid.h
@@ -120,6 +120,9 @@ namespace android {
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
#endif
+
+ virtual void populateVisitedLinks();
+
// Methods used to request and provide Geolocation permissions.
virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*);
// Android-specific
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 0885c07..7ab598c 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -66,6 +66,7 @@
#include "KeyboardCodes.h"
#include "Node.h"
#include "Page.h"
+#include "PageGroup.h"
#include "PlatformKeyboardEvent.h"
#include "PlatformString.h"
#include "PluginWidgetAndroid.h"
@@ -180,6 +181,7 @@ struct WebViewCore::JavaGlue {
jmethodID m_requestKeyboard;
jmethodID m_exceededDatabaseQuota;
jmethodID m_reachedMaxAppCacheSize;
+ jmethodID m_populateVisitedLinks;
jmethodID m_geolocationPermissionsShowPrompt;
jmethodID m_geolocationPermissionsHidePrompt;
jmethodID m_addMessageToConsole;
@@ -255,6 +257,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
m_javaGlue->m_requestKeyboard = GetJMethod(env, clazz, "requestKeyboard", "(Z)V");
m_javaGlue->m_exceededDatabaseQuota = GetJMethod(env, clazz, "exceededDatabaseQuota", "(Ljava/lang/String;Ljava/lang/String;JJ)V");
m_javaGlue->m_reachedMaxAppCacheSize = GetJMethod(env, clazz, "reachedMaxAppCacheSize", "(J)V");
+ m_javaGlue->m_populateVisitedLinks = GetJMethod(env, clazz, "populateVisitedLinks", "()[Ljava/lang/String;");
m_javaGlue->m_geolocationPermissionsShowPrompt = GetJMethod(env, clazz, "geolocationPermissionsShowPrompt", "(Ljava/lang/String;)V");
m_javaGlue->m_geolocationPermissionsHidePrompt = GetJMethod(env, clazz, "geolocationPermissionsHidePrompt", "()V");
m_javaGlue->m_addMessageToConsole = GetJMethod(env, clazz, "addMessageToConsole", "(Ljava/lang/String;ILjava/lang/String;)V");
@@ -266,6 +269,8 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
m_scrollOffsetX = m_scrollOffsetY = 0;
+ PageGroup::setShouldTrackVisitedLinks(true);
+
reset(true);
}
@@ -314,6 +319,8 @@ void WebViewCore::reset(bool fromConstructor)
m_lastFocused = 0;
m_lastFocusedBounds = WebCore::IntRect(0,0,0,0);
+ m_lastFocusedSelStart = 0;
+ m_lastFocusedSelEnd = 0;
m_lastMoveGeneration = 0;
clearContent();
m_updatedFrameCache = true;
@@ -517,8 +524,20 @@ void WebViewCore::recordPictureSet(PictureSet* content)
} // WebViewCoreRecordTimeCounter
WebCore::Node* oldFocusNode = currentFocus();
m_frameCacheOutOfDate = true;
- WebCore::IntRect oldBounds = oldFocusNode ?
- oldFocusNode->getRect() : WebCore::IntRect(0,0,0,0);
+ WebCore::IntRect oldBounds;
+ int oldSelStart = 0;
+ int oldSelEnd = 0;
+ if (oldFocusNode) {
+ oldBounds = oldFocusNode->getRect();
+ RenderObject* renderer = oldFocusNode->renderer();
+ if (renderer && (renderer->isTextArea() || renderer->isTextField())) {
+ WebCore::RenderTextControl* rtc =
+ static_cast<WebCore::RenderTextControl*>(renderer);
+ oldSelStart = rtc->selectionStart();
+ oldSelEnd = rtc->selectionEnd();
+ }
+ } else
+ oldBounds = WebCore::IntRect(0,0,0,0);
unsigned latestVersion = 0;
if (m_check_domtree_version) {
// as domTreeVersion only increment, we can just check the sum to see
@@ -529,14 +548,18 @@ void WebViewCore::recordPictureSet(PictureSet* content)
}
DBG_NAV_LOGD("m_lastFocused=%p oldFocusNode=%p"
" m_lastFocusedBounds={%d,%d,%d,%d} oldBounds={%d,%d,%d,%d}"
+ " m_lastFocusedSelection={%d,%d} oldSelection={%d,%d}"
" m_check_domtree_version=%s latestVersion=%d m_domtree_version=%d",
m_lastFocused, oldFocusNode,
m_lastFocusedBounds.x(), m_lastFocusedBounds.y(),
m_lastFocusedBounds.width(), m_lastFocusedBounds.height(),
oldBounds.x(), oldBounds.y(), oldBounds.width(), oldBounds.height(),
+ m_lastFocusedSelStart, m_lastFocusedSelEnd, oldSelStart, oldSelEnd,
m_check_domtree_version ? "true" : "false",
latestVersion, m_domtree_version);
if (m_lastFocused == oldFocusNode && m_lastFocusedBounds == oldBounds
+ && m_lastFocusedSelStart == oldSelStart
+ && m_lastFocusedSelEnd == oldSelEnd
&& !m_findIsUp
&& (!m_check_domtree_version || latestVersion == m_domtree_version))
{
@@ -544,6 +567,8 @@ void WebViewCore::recordPictureSet(PictureSet* content)
}
m_lastFocused = oldFocusNode;
m_lastFocusedBounds = oldBounds;
+ m_lastFocusedSelStart = oldSelStart;
+ m_lastFocusedSelEnd = oldSelEnd;
m_domtree_version = latestVersion;
DBG_NAV_LOG("call updateFrameCache");
updateFrameCache();
@@ -2054,6 +2079,25 @@ void WebViewCore::reachedMaxAppCacheSize(const unsigned long long spaceNeeded)
#endif
}
+void WebViewCore::populateVisitedLinks(WebCore::PageGroup* group)
+{
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ jobjectArray array = static_cast<jobjectArray>(env->CallObjectMethod(m_javaGlue->object(env).get(), m_javaGlue->m_populateVisitedLinks));
+ if (!array)
+ return;
+ jsize len = env->GetArrayLength(array);
+ for (jsize i = 0; i < len; i++) {
+ jstring item = static_cast<jstring>(env->GetObjectArrayElement(array, i));
+ const UChar* str = static_cast<const UChar*>(env->GetStringChars(item, NULL));
+ jsize len = env->GetStringLength(item);
+ group->addVisitedLink(str, len);
+ env->ReleaseStringChars(item, str);
+ env->DeleteLocalRef(item);
+ }
+ env->DeleteLocalRef(array);
+}
+
+
void WebViewCore::geolocationPermissionsShowPrompt(const WebCore::String& origin)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index 7dd8763..1a86482 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -53,6 +53,7 @@ namespace WebCore {
class RenderTextControl;
class ScrollView;
class TimerBase;
+ class PageGroup;
}
struct PluginWidgetAndroid;
@@ -216,6 +217,12 @@ namespace android {
*/
void reachedMaxAppCacheSize(const unsigned long long spaceNeeded);
+ /**
+ * Set up the PageGroup's idea of which links have been visited, with the browser history.
+ * @param group the object to deliver the links to.
+ */
+ void populateVisitedLinks(WebCore::PageGroup*);
+
/**
* Instruct the browser to show a Geolocation permission prompt for the
* specified origin.
@@ -444,6 +451,8 @@ namespace android {
WebCoreReply* m_popupReply;
WebCore::Node* m_lastFocused;
WebCore::IntRect m_lastFocusedBounds;
+ int m_lastFocusedSelStart;
+ int m_lastFocusedSelEnd;
int m_lastMoveGeneration;
static Mutex m_contentMutex; // protects ui/core thread pictureset access
PictureSet m_content; // the set of pictures to draw (accessed by UI too)