summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp4
-rw-r--r--WebKit/android/WebCoreSupport/WebRequestContext.cpp3
-rw-r--r--WebKit/android/nav/FindCanvas.cpp79
-rw-r--r--WebKit/android/nav/WebView.cpp75
4 files changed, 77 insertions, 84 deletions
diff --git a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
index 95673d7..d4f45a8 100644
--- a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
+++ b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp
@@ -909,8 +909,12 @@ void FrameLoaderClientAndroid::transitionToCommittedForNewPage() {
IntRect visBounds = oldWebFrameView->getVisibleBounds();
IntRect windowBounds = oldWebFrameView->getWindowBounds();
WebCore::FrameView* oldFrameView = oldWebFrameView->view();
+ const float oldZoomFactor = oldFrameView->zoomFactor();
m_frame->createView(bounds.size(), oldFrameView->baseBackgroundColor(), oldFrameView->isTransparent(),
oldFrameView->fixedLayoutSize(), oldFrameView->useFixedLayout());
+ if (oldZoomFactor != 1.0f && oldZoomFactor != m_frame->view()->zoomFactor()) {
+ m_frame->view()->setZoomFactor(oldZoomFactor, ZoomTextOnly);
+ }
// Create a new WebFrameView for the new FrameView
WebFrameView* newFrameView = new WebFrameView(m_frame->view(), webViewCore);
diff --git a/WebKit/android/WebCoreSupport/WebRequestContext.cpp b/WebKit/android/WebCoreSupport/WebRequestContext.cpp
index 1b7a5ee..9a8c9a0 100644
--- a/WebKit/android/WebCoreSupport/WebRequestContext.cpp
+++ b/WebKit/android/WebCoreSupport/WebRequestContext.cpp
@@ -35,6 +35,7 @@
#include <net/base/ssl_config_service.h>
#include <net/http/http_cache.h>
#include <net/http/http_network_layer.h>
+#include <net/http/http_auth_handler_factory.h>
#include <net/proxy/proxy_service.h>
#include <wtf/text/CString.h>
@@ -117,7 +118,7 @@ WebRequestContext* WebRequestContext::GetAndroidContextForPath(const char* cooki
scoped_refptr<base::MessageLoopProxy> cacheMessageLoopProxy = base::MessageLoopProxy::CreateForCurrentThread();
// Todo: check if the context takes ownership of the cache
net::HttpCache::DefaultBackend* defaultBackend = new net::HttpCache::DefaultBackend(net::DISK_CACHE, cachePath, 20 * 1024 * 1024, cacheMessageLoopProxy);
- androidContext->http_transaction_factory_ = new net::HttpCache(androidContext->host_resolver(), net::ProxyService::CreateNull(), net::SSLConfigService::CreateSystemSSLConfigService(), 0, 0, 0, defaultBackend);
+ androidContext->http_transaction_factory_ = new net::HttpCache(androidContext->host_resolver(), net::ProxyService::CreateNull(), net::SSLConfigService::CreateSystemSSLConfigService(), net::HttpAuthHandlerFactory::CreateDefault(), 0, 0, defaultBackend);
scoped_refptr<SQLitePersistentCookieStore> cookieDb = new SQLitePersistentCookieStore(cookiePath);
diff --git a/WebKit/android/nav/FindCanvas.cpp b/WebKit/android/nav/FindCanvas.cpp
index 8eaaaef..d60fffd 100644
--- a/WebKit/android/nav/FindCanvas.cpp
+++ b/WebKit/android/nav/FindCanvas.cpp
@@ -361,48 +361,40 @@ void FindCanvas::findHelper(const void* text, size_t byteLength,
// We need an SkIRect for SkRegion operations.
SkIRect iRect;
rect.roundOut(&iRect);
- // If the rectangle is partially clipped, assume that the text is
- // not visible, so skip this match.
- if (getTotalClip().contains(iRect)) {
- // Want to outset the drawn rectangle by the same amount as
- // mOutset
- iRect.inset(-INTEGER_OUTSET, -INTEGER_OUTSET);
- SkRegion regionToAdd(iRect);
- if (!mWorkingRegion.isEmpty()) {
- // If this is on the same line as our working region, make
- // sure that they are close enough together that they are
- // supposed to be part of the same text string.
- // The width of two spaces has arbitrarily been chosen.
- const SkIRect& workingBounds = mWorkingRegion.getBounds();
- if (workingBounds.fTop <= iRect.fBottom &&
- workingBounds.fBottom >= iRect.fTop &&
- SkIntToScalar(iRect.fLeft - workingBounds.fRight) >
- approximateSpaceWidth(paint)) {
- index = -1; // Will increase to 0 on next run
- // In this case, we need to start from the beginning of
- // the text being searched and our search term.
- j = 0;
- mWorkingIndex = 0;
- mWorkingRegion.setEmpty();
- continue;
- }
- // Add the mWorkingRegion, which contains rectangles from
- // the previous line(s).
- regionToAdd.op(mWorkingRegion, SkRegion::kUnion_Op);
+ // Want to outset the drawn rectangle by the same amount as
+ // mOutset
+ iRect.inset(-INTEGER_OUTSET, -INTEGER_OUTSET);
+ SkRegion regionToAdd(iRect);
+ if (!mWorkingRegion.isEmpty()) {
+ // If this is on the same line as our working region, make
+ // sure that they are close enough together that they are
+ // supposed to be part of the same text string.
+ // The width of two spaces has arbitrarily been chosen.
+ const SkIRect& workingBounds = mWorkingRegion.getBounds();
+ if (workingBounds.fTop <= iRect.fBottom &&
+ workingBounds.fBottom >= iRect.fTop &&
+ SkIntToScalar(iRect.fLeft - workingBounds.fRight) >
+ approximateSpaceWidth(paint)) {
+ index = -1; // Will increase to 0 on next run
+ // In this case, we need to start from the beginning of
+ // the text being searched and our search term.
+ j = 0;
+ mWorkingIndex = 0;
+ mWorkingRegion.setEmpty();
+ continue;
}
- insertMatchInfo(regionToAdd);
+ // Add the mWorkingRegion, which contains rectangles from
+ // the previous line(s).
+ regionToAdd.op(mWorkingRegion, SkRegion::kUnion_Op);
+ }
+ insertMatchInfo(regionToAdd);
#if INCLUDE_SUBSTRING_MATCHES
- // Reset index to the location of the match and reset j to the
- // beginning, so that on the next iteration of the loop, index
- // will advance by 1 and we will compare the next character in
- // chars to the first character in the GlyphSet.
- index = matchIndex;
+ // Reset index to the location of the match and reset j to the
+ // beginning, so that on the next iteration of the loop, index
+ // will advance by 1 and we will compare the next character in
+ // chars to the first character in the GlyphSet.
+ index = matchIndex;
#endif
- } else {
- // This match was clipped out, so begin looking at the next
- // character from our hidden match
- index = matchIndex;
- }
// Whether the clip contained it or not, we need to start over
// with our recording canvas
resetWorkingCanvas();
@@ -443,12 +435,9 @@ void FindCanvas::findHelper(const void* text, size_t byteLength,
partial.inset(mOutset, mOutset);
SkIRect dest;
partial.roundOut(&dest);
- // Only save a partial if it is in the current clip.
- if (getTotalClip().contains(dest)) {
- mWorkingRegion.op(dest, SkRegion::kUnion_Op);
- mWorkingIndex = j;
- return;
- }
+ mWorkingRegion.op(dest, SkRegion::kUnion_Op);
+ mWorkingIndex = j;
+ return;
}
// This string doesn't go into the next drawText, so reset our working
// variables
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index a15ef39..c061461 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -172,7 +172,6 @@ WebView(JNIEnv* env, jobject javaWebView, int viewImpl) :
m_navPictureUI = 0;
m_generation = 0;
m_heightCanMeasure = false;
- m_ring.m_followedLink = false;
m_lastDx = 0;
m_lastDxTime = 0;
m_ringAnimationEnd = 0;
@@ -266,7 +265,7 @@ void nativeRecordButtons(bool hasFocus, bool pressed, bool invalidate)
// button
if (!hasFocus) {
state = WebCore::RenderSkinAndroid::kNormal;
- } else if (m_ring.m_followedLink || pressed) {
+ } else if (pressed) {
state = WebCore::RenderSkinAndroid::kPressed;
} else {
state = WebCore::RenderSkinAndroid::kFocused;
@@ -341,7 +340,7 @@ void calcOurContentVisibleRect(SkRect* r)
void resetCursorRing()
{
- m_ring.m_followedLink = false;
+ m_ringAnimationEnd = 0;
m_viewImpl->m_hasCursorBounds = false;
}
@@ -363,12 +362,15 @@ bool drawCursorPreamble(CachedRoot* root)
m_ring.m_root = root;
m_ring.m_frame = frame;
m_ring.m_node = node;
+ SkMSec time = SkTime::GetMSecs();
+ m_ring.m_isPressed = time < m_ringAnimationEnd
+ && m_ringAnimationEnd != UINT_MAX;
return true;
}
void drawCursorPostamble()
{
- if (!m_ring.m_isButton && m_ring.m_flavor < CursorRing::NORMAL_ANIMATING)
+ if (m_ringAnimationEnd == UINT_MAX)
return;
SkMSec time = SkTime::GetMSecs();
if (time < m_ringAnimationEnd) {
@@ -377,11 +379,7 @@ void drawCursorPostamble()
invalBounds.intersect(m_ring.m_absBounds);
postInvalidateDelayed(m_ringAnimationEnd - time, invalBounds);
} else {
- if (m_ring.m_followedLink)
- hideCursor();
- m_ring.m_followedLink = false;
- m_ring.m_flavor = static_cast<CursorRing::Flavor>
- (m_ring.m_flavor - CursorRing::NORMAL_ANIMATING);
+ hideCursor();
}
}
@@ -710,8 +708,6 @@ bool moveCursor(int keyCode, int count, bool ignoreScroll)
int dx = 0;
int dy = 0;
int counter = count;
- if (!cursor || !m_ring.m_followedLink)
- root->setScrollOnly(m_ring.m_followedLink);
while (--counter >= 0) {
WebCore::IntPoint scroll = WebCore::IntPoint(0, 0);
cachedNode = root->moveCursor(direction, &cachedFrame, &scroll);
@@ -743,13 +739,13 @@ bool moveCursor(int keyCode, int count, bool ignoreScroll)
}
bool result = false;
if (cachedNode) {
+ showCursorUntimed();
m_viewImpl->updateCursorBounds(root, cachedFrame, cachedNode);
root->setCursor(const_cast<CachedFrame*>(cachedFrame),
const_cast<CachedNode*>(cachedNode));
bool disableFocusController = cachedNode != root->currentFocus()
&& cachedNode->wantsKeyEvents();
sendMoveMouseIfLatest(disableFocusController);
- viewInvalidate();
} else {
int docHeight = root->documentHeight();
int docWidth = root->documentWidth();
@@ -816,16 +812,17 @@ void selectBestAt(const WebCore::IntRect& rect)
m_viewImpl->m_hasCursorBounds = false;
if (root)
root->setCursor(0, 0);
+ viewInvalidate();
} else {
DBG_NAV_LOGD("CachedNode:%p (%d)", node, node->index());
WebCore::IntRect bounds = node->bounds(frame);
root->rootHistory()->setMouseBounds(frame->unadjustBounds(node, bounds));
m_viewImpl->updateCursorBounds(root, frame, node);
+ showCursorTimed();
root->setCursor(const_cast<CachedFrame*>(frame),
const_cast<CachedNode*>(node));
}
sendMoveMouseIfLatest(false);
- viewInvalidate();
}
WebCore::IntRect getNavBounds()
@@ -861,7 +858,6 @@ bool pointInNavCache(int x, int y, int slop)
bool motionUp(int x, int y, int slop)
{
bool pageScrolled = false;
- m_ring.m_followedLink = false;
IntRect rect = IntRect(x - slop, y - slop, slop * 2, slop * 2);
int rx, ry;
CachedRoot* root = getFrameCache(AllowNewer);
@@ -894,19 +890,18 @@ bool motionUp(int x, int y, int slop)
m_viewImpl->updateCursorBounds(root, frame, result);
root->setCursor(const_cast<CachedFrame*>(frame),
const_cast<CachedNode*>(result));
- bool syntheticLink = result->isSyntheticLink();
- if (!syntheticLink) {
+ if (result->isSyntheticLink())
+ overrideUrlLoading(result->getExport());
+ else {
sendMotionUp(
(WebCore::Frame*) frame->framePointer(),
(WebCore::Node*) result->nodePointer(), rx, ry);
}
- viewInvalidate();
- if (!result->isTextInput()) {
- if (!result->isSelect() && !result->isContentEditable())
- setFollowedLink(true);
- if (syntheticLink)
- overrideUrlLoading(result->getExport());
- }
+ if (result->isTextInput() || result->isSelect()
+ || result->isContentEditable()) {
+ showCursorUntimed();
+ } else
+ showCursorTimed();
return pageScrolled;
}
@@ -952,12 +947,18 @@ void setFindIsEmpty()
m_findOnPage.clearCurrentLocation();
}
-void setFollowedLink(bool followed)
+void showCursorTimed()
{
- if ((m_ring.m_followedLink = followed) != false) {
- m_ringAnimationEnd = SkTime::GetMSecs() + 500;
- viewInvalidate();
- }
+ DBG_NAV_LOG("");
+ m_ringAnimationEnd = SkTime::GetMSecs() + 500;
+ viewInvalidate();
+}
+
+void showCursorUntimed()
+{
+ DBG_NAV_LOG("");
+ m_ringAnimationEnd = UINT_MAX;
+ viewInvalidate();
}
void setHeightCanMeasure(bool measure)
@@ -1222,8 +1223,10 @@ static void copyScrollPositionRecursive(const LayerAndroid* from,
void setBaseLayer(BaseLayerAndroid* layer)
{
- copyScrollPositionRecursive(compositeRoot(),
+ if (layer) {
+ copyScrollPositionRecursive(compositeRoot(),
static_cast<LayerAndroid*>(layer->getChild(0)));
+ }
delete m_baseLayer;
m_baseLayer = layer;
CachedRoot* root = getFrameCache(DontAllowNewer);
@@ -1802,14 +1805,9 @@ static void nativeSetFindIsEmpty(JNIEnv *env, jobject obj)
GET_NATIVE_VIEW(env, obj)->setFindIsEmpty();
}
-static void nativeSetFollowedLink(JNIEnv *env, jobject obj, bool followed)
+static void nativeShowCursorTimed(JNIEnv *env, jobject obj)
{
- const CachedNode* cursor = getCursorNode(env, obj);
- if (cursor && !cursor->isSelect() && ! cursor->isContentEditable()) {
- WebView* view = GET_NATIVE_VIEW(env, obj);
- LOG_ASSERT(view, "view not set in %s", __FUNCTION__);
- view->setFollowedLink(followed);
- }
+ GET_NATIVE_VIEW(env, obj)->showCursorTimed();
}
static void nativeSetHeightCanMeasure(JNIEnv *env, jobject obj, bool measure)
@@ -1957,6 +1955,7 @@ static bool nativeMoveCursorToNextTextInput(JNIEnv *env, jobject obj)
const WebCore::IntRect& bounds = next->bounds(frame);
root->rootHistory()->setMouseBounds(frame->unadjustBounds(next, bounds));
view->getWebViewCore()->updateCursorBounds(root, frame, next);
+ view->showCursorUntimed();
root->setCursor(const_cast<CachedFrame*>(frame),
const_cast<CachedNode*>(next));
view->sendMoveFocus(static_cast<WebCore::Frame*>(frame->framePointer()),
@@ -2250,8 +2249,6 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeSetFindIsEmpty },
{ "nativeSetFindIsUp", "(Z)V",
(void*) nativeSetFindIsUp },
- { "nativeSetFollowedLink", "(Z)V",
- (void*) nativeSetFollowedLink },
{ "nativeSetHeightCanMeasure", "(Z)V",
(void*) nativeSetHeightCanMeasure },
{ "nativeSetBaseLayer", "(I)V",
@@ -2264,6 +2261,8 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeHasContent },
{ "nativeSetSelectionPointer", "(ZFII)V",
(void*) nativeSetSelectionPointer },
+ { "nativeShowCursorTimed", "()V",
+ (void*) nativeShowCursorTimed },
{ "nativeStartSelection", "(II)Z",
(void*) nativeStartSelection },
{ "nativeSubtractLayers", "(Landroid/graphics/Rect;)Landroid/graphics/Rect;",