summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
authorCary Clark <cary@android.com>2009-07-01 10:16:03 -0400
committerCary Clark <cary@android.com>2009-07-01 11:38:01 -0400
commitb65cdee14078ca0fdfd3222d0c19ef266837c72d (patch)
treeed17860b5bf3605ece15cadede52b7440832d49d /WebKit
parent1a2cd24724c522c1f5259d455d3fdec3366bd976 (diff)
downloadexternal_webkit-b65cdee14078ca0fdfd3222d0c19ef266837c72d.zip
external_webkit-b65cdee14078ca0fdfd3222d0c19ef266837c72d.tar.gz
external_webkit-b65cdee14078ca0fdfd3222d0c19ef266837c72d.tar.bz2
Update the nav cache when selected elements change or move
This helps superpudu recompute the cursor ring more frequently when the floating bar moves. It also helps update the nav cache when navigating during a page load.
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/jni/WebViewCore.cpp60
-rw-r--r--WebKit/android/jni/WebViewCore.h2
-rw-r--r--WebKit/android/nav/WebView.cpp1
3 files changed, 37 insertions, 26 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 0829050..142f0de 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -505,36 +505,15 @@ void WebViewCore::recordPictureSet(PictureSet* content)
oldBounds.x(), oldBounds.y(), oldBounds.width(), oldBounds.height(),
m_check_domtree_version ? "true" : "false",
latestVersion, m_domtree_version);
- bool update = m_lastFocused != oldFocusNode
- || m_lastFocusedBounds != oldBounds || m_findIsUp
- || (m_check_domtree_version && latestVersion != m_domtree_version)
- || m_moveGeneration != m_lastMoveGeneration;
- if (!update) { // avoid mutex when possible
- // This block is specifically for the floating bar in gmail messages
- // it has been disabled because it adversely affects the performance
- // of loading all pages.
- if (true || !m_hasCursorBounds)
- return;
- gCursorBoundsMutex.lock();
- bool hasCursorBounds = m_hasCursorBounds;
- void* cursorNode = m_cursorNode;
- IntRect bounds = m_cursorBounds;
- gCursorBoundsMutex.unlock();
- if (hasCursorBounds && cursorNode) {
- IntPoint center = IntPoint(bounds.x() + (bounds.width() >> 1),
- bounds.y() + (bounds.height() >> 1));
- HitTestResult hitTestResult = m_mainFrame->eventHandler()->
- hitTestResultAtPoint(center, false);
- DBG_NAV_LOGD("at (%d,%d) old=%p new=%p", center.x(), center.y(),
- cursorNode, hitTestResult.innerNode());
- if (cursorNode == hitTestResult.innerNode())
- return; // don't update
- }
+ if (m_lastFocused == oldFocusNode && m_lastFocusedBounds == oldBounds
+ && !m_findIsUp
+ && (!m_check_domtree_version || latestVersion == m_domtree_version))
+ {
+ return;
}
m_lastFocused = oldFocusNode;
m_lastFocusedBounds = oldBounds;
m_domtree_version = latestVersion;
- m_lastMoveGeneration = m_moveGeneration;
DBG_NAV_LOG("call updateFrameCache");
updateFrameCache();
}
@@ -1055,6 +1034,34 @@ WebCore::String WebViewCore::retrieveHref(WebCore::Frame* frame, WebCore::Node*
return anchor->href();
}
+void WebViewCore::updateCacheOnNodeChange()
+{
+ gCursorBoundsMutex.lock();
+ bool hasCursorBounds = m_hasCursorBounds;
+ Frame* frame = (Frame*) m_cursorFrame;
+ Node* node = (Node*) m_cursorNode;
+ IntRect bounds = m_cursorHitBounds;
+ gCursorBoundsMutex.unlock();
+ if (!hasCursorBounds || !node)
+ return;
+ if (CacheBuilder::validNode(m_mainFrame, frame, node)) {
+ RenderObject* renderer = node->renderer();
+ if (renderer) {
+ IntRect absBox = renderer->absoluteBoundingBoxRect();
+ int globalX, globalY;
+ CacheBuilder::GetGlobalOffset(frame, &globalX, &globalY);
+ absBox.move(globalX, globalY);
+ if (absBox == bounds)
+ return;
+ DBG_NAV_LOGD("absBox=(%d,%d,%d,%d) bounds=(%d,%d,%d,%d)",
+ absBox.x(), absBox.y(), absBox.width(), absBox.height(),
+ bounds.x(), bounds.y(), bounds.width(), bounds.height());
+ }
+ }
+ DBG_NAV_LOGD("updateFrameCache node=%p", node);
+ updateFrameCache();
+}
+
void WebViewCore::updateFrameCache()
{
if (!m_frameCacheOutOfDate) {
@@ -1232,6 +1239,7 @@ void WebViewCore::moveMouse(WebCore::Frame* frame, int x, int y)
WebCore::NoButton, WebCore::MouseEventMoved, 1, false, false, false,
false, WTF::currentTime());
frame->eventHandler()->handleMouseMoveEvent(mouseEvent);
+ updateCacheOnNodeChange();
}
static int findTextBoxIndex(WebCore::Node* node, const WebCore::IntPoint& pt)
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index 86e6dca..f076bf1 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -275,6 +275,7 @@ namespace android {
void setSnapAnchor(int x, int y);
void snapToAnchor();
void updateFrameCache();
+ void updateCacheOnNodeChange();
void dumpDomTree(bool);
void dumpRenderTree(bool);
void dumpNavTree();
@@ -336,6 +337,7 @@ namespace android {
bool m_findIsUp;
bool m_hasCursorBounds;
WebCore::IntRect m_cursorBounds;
+ WebCore::IntRect m_cursorHitBounds;
void* m_cursorFrame;
IntPoint m_cursorLocation;
void* m_cursorNode;
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index 092ae70..74acdf7 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -717,6 +717,7 @@ void updateCursorBounds(const CachedRoot* root, const CachedFrame* cachedFrame,
DBG_NAV_LOGD("new cursor bounds=(%d,%d,w=%d,h=%d)",
bounds.x(), bounds.y(), bounds.width(), bounds.height());
m_viewImpl->m_cursorBounds = cachedNode->bounds();
+ m_viewImpl->m_cursorHitBounds = cachedNode->hitBounds();
m_viewImpl->m_cursorFrame = cachedFrame->framePointer();
root->getSimulatedMousePosition(&m_viewImpl->m_cursorLocation);
m_viewImpl->m_cursorNode = cachedNode->nodePointer();