summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--LayoutTests/platform/android/fast/dom/Geolocation/disconnected-frame-expected.txt22
-rw-r--r--LayoutTests/platform/android/fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt30
-rw-r--r--WebCore/platform/graphics/android/android_graphics.cpp40
-rw-r--r--WebCore/platform/graphics/android/android_graphics.h11
-rw-r--r--WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp4
-rw-r--r--WebKit/android/WebCoreSupport/WebRequest.cpp55
-rw-r--r--WebKit/android/WebCoreSupport/WebRequest.h11
-rw-r--r--WebKit/android/WebCoreSupport/WebRequestContext.cpp3
-rw-r--r--WebKit/android/nav/FindCanvas.cpp79
-rw-r--r--WebKit/android/nav/WebView.cpp76
-rw-r--r--WebKitTools/DumpRenderTree/android/get_layout_tests_dir_contents.php78
11 files changed, 227 insertions, 182 deletions
diff --git a/LayoutTests/platform/android/fast/dom/Geolocation/disconnected-frame-expected.txt b/LayoutTests/platform/android/fast/dom/Geolocation/disconnected-frame-expected.txt
index ae10f02..674ebdc 100644
--- a/LayoutTests/platform/android/fast/dom/Geolocation/disconnected-frame-expected.txt
+++ b/LayoutTests/platform/android/fast/dom/Geolocation/disconnected-frame-expected.txt
@@ -1,11 +1,11 @@
-Tests that when a request is made on a Geolocation object and its Frame is disconnected before a callback is made, the error callback is invoked with the correct error message.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS error.code is 2
-PASS error.message is "Geolocation cannot be used in frameless documents"
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
+Tests that when a request is made on a Geolocation object and its Frame is disconnected before a callback is made, the error callback is invoked with the correct error message.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS error.code is 2
+PASS error.message is "Geolocation cannot be used in frameless documents"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/android/fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt b/LayoutTests/platform/android/fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt
index 18abab4..94ec9a4 100644
--- a/LayoutTests/platform/android/fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt
+++ b/LayoutTests/platform/android/fast/dom/Geolocation/disconnected-frame-permission-denied-expected.txt
@@ -1,15 +1,15 @@
-Tests that when a request is made on a Geolocation object, permission is denied and its Frame is disconnected before a callback is made, the error callback is invoked with PERMISSION_DENIED.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS error.code is error.PERMISSION_DENIED
-PASS error.message is "User denied Geolocation"
-
-PASS error.code is error.PERMISSION_DENIED
-PASS error.message is "User denied Geolocation"
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
+Tests that when a request is made on a Geolocation object, permission is denied and its Frame is disconnected before a callback is made, the error callback is invoked with PERMISSION_DENIED.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS error.code is error.PERMISSION_DENIED
+PASS error.message is "User denied Geolocation"
+
+PASS error.code is error.PERMISSION_DENIED
+PASS error.message is "User denied Geolocation"
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/WebCore/platform/graphics/android/android_graphics.cpp b/WebCore/platform/graphics/android/android_graphics.cpp
index f8032c4..a584f0b 100644
--- a/WebCore/platform/graphics/android/android_graphics.cpp
+++ b/WebCore/platform/graphics/android/android_graphics.cpp
@@ -51,7 +51,6 @@ void CursorRing::draw(SkCanvas* canvas, LayerAndroid* layer)
DBG_NAV_LOGD("canvas->quickReject cursorNode=%d (nodePointer=%p)"
" bounds=(%d,%d,w=%d,h=%d)", m_node->index(), m_node->nodePointer(),
m_bounds.x(), m_bounds.y(), m_bounds.width(), m_bounds.height());
- m_followedLink = false;
return;
}
const CachedColor& colors = m_frame->color(m_node);
@@ -75,13 +74,11 @@ void CursorRing::draw(SkCanvas* canvas, LayerAndroid* layer)
SkIntToScalar(colors.radius())))->unref();
SkColor outer;
SkColor inner;
- if (m_flavor >= NORMAL_ANIMATING) { // pressed
+ if (m_isPressed) {
SkColor pressed;
pressed = colors.fillColor();
paint.setColor(pressed);
canvas->drawPath(path, paint);
- }
- if (m_flavor >= NORMAL_ANIMATING) {
outer = colors.pressedOuterColor();
inner = colors.pressedInnerColor();
} else {
@@ -138,30 +135,21 @@ bool CursorRing::setup()
m_absBounds.inflate(SkScalarCeil(colors.outerWidth()));
if (!m_node->hasCursorRing() || (m_node->isPlugin() && m_node->isFocus()))
return false;
- m_flavor = NORMAL_FLAVOR;
- if (!m_isButton) {
- m_flavor = m_node->isSyntheticLink() ? FAKE_FLAVOR : NORMAL_FLAVOR;
- if (m_followedLink) {
- m_flavor = static_cast<Flavor>(m_flavor + NORMAL_ANIMATING);
- }
#if DEBUG_NAV_UI
- const WebCore::IntRect& ring = m_rings[0];
- DBG_NAV_LOGD("cursorNode=%d (nodePointer=%p) flavor=%s rings=%d"
- " (%d, %d, %d, %d) isPlugin=%s",
- m_node->index(), m_node->nodePointer(),
- m_flavor == FAKE_FLAVOR ? "FAKE_FLAVOR" :
- m_flavor == NORMAL_ANIMATING ? "NORMAL_ANIMATING" :
- m_flavor == FAKE_ANIMATING ? "FAKE_ANIMATING" : "NORMAL_FLAVOR",
- m_rings.size(), ring.x(), ring.y(), ring.width(), ring.height(),
- m_node->isPlugin() ? "true" : "false");
- DBG_NAV_LOGD("[%d] inner=%d outer=%d outset=%d radius=%d"
- " fill=0x%08x pin=0x%0x08x pout=0x%0x08x sin=0x%08x sout=0x%08x",
- m_node->colorIndex(), colors.innerWidth(), colors.outerWidth(),
- colors.outset(), colors.radius(), colors.fillColor(),
- colors.pressedInnerColor(), colors.pressedOuterColor(),
- colors.selectedInnerColor(), colors.selectedInnerColor());
+ const WebCore::IntRect& ring = m_rings[0];
+ DBG_NAV_LOGD("cursorNode=%d (nodePointer=%p) pressed=%s rings=%d"
+ " (%d, %d, %d, %d) isPlugin=%s",
+ m_node->index(), m_node->nodePointer(),
+ m_isPressed ? "true" : "false",
+ m_rings.size(), ring.x(), ring.y(), ring.width(), ring.height(),
+ m_node->isPlugin() ? "true" : "false");
+ DBG_NAV_LOGD("[%d] inner=%d outer=%d outset=%d radius=%d"
+ " fill=0x%08x pin=0x%08x pout=0x%08x sin=0x%08x sout=0x%08x",
+ m_node->colorIndex(), colors.innerWidth(), colors.outerWidth(),
+ colors.outset(), colors.radius(), colors.fillColor(),
+ colors.pressedInnerColor(), colors.pressedOuterColor(),
+ colors.selectedInnerColor(), colors.selectedInnerColor());
#endif
- }
return true;
}
diff --git a/WebCore/platform/graphics/android/android_graphics.h b/WebCore/platform/graphics/android/android_graphics.h
index 09482bd..e147634 100644
--- a/WebCore/platform/graphics/android/android_graphics.h
+++ b/WebCore/platform/graphics/android/android_graphics.h
@@ -51,14 +51,6 @@ class WebViewCore;
class CursorRing : public DrawExtra {
public:
- enum Flavor {
- NORMAL_FLAVOR,
- FAKE_FLAVOR,
- NORMAL_ANIMATING,
- FAKE_ANIMATING,
- ANIMATING_COUNT = 2
- };
-
CursorRing(WebViewCore* core) : m_viewImpl(core) {}
virtual ~CursorRing() {}
virtual void draw(SkCanvas* , LayerAndroid* );
@@ -72,9 +64,8 @@ private:
const CachedRoot* m_root;
const CachedFrame* m_frame;
const CachedNode* m_node;
- Flavor m_flavor;
- bool m_followedLink;
bool m_isButton;
+ bool m_isPressed;
};
}
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/WebRequest.cpp b/WebKit/android/WebCoreSupport/WebRequest.cpp
index 5e760ae..a712fb0 100644
--- a/WebKit/android/WebCoreSupport/WebRequest.cpp
+++ b/WebKit/android/WebCoreSupport/WebRequest.cpp
@@ -32,6 +32,7 @@
#include "WebResourceRequest.h"
#include "jni.h"
+#include <cutils/log.h>
#include <net/base/data_url.h>
#include <net/base/io_buffer.h>
#include <net/http/http_response_headers.h>
@@ -45,6 +46,16 @@ extern android::AssetManager* globalAssetManager();
// - Finish the file upload. Testcase is mobile buzz
// - Add network throttle needed by Android plugins
+// TODO: Turn off asserts crashing before release
+// http://b/issue?id=2951985
+#undef ASSERT
+#define ASSERT(assertion, ...) do \
+ if (!(assertion)) { \
+ android_printLog(ANDROID_LOG_ERROR, __FILE__, __VA_ARGS__); \
+ CRASH(); \
+ } \
+while (0)
+
namespace android {
namespace {
@@ -55,6 +66,7 @@ WebRequest::WebRequest(WebUrlLoaderClient* loader, WebResourceRequest webResourc
: m_urlLoader(loader)
, m_inputStream(0)
, m_androidUrl(false)
+ , m_loadState(Created)
{
m_url = webResourceRequest.url();
GURL gurl(webResourceRequest.url());
@@ -70,8 +82,8 @@ WebRequest::WebRequest(WebUrlLoaderClient* loader, WebResourceRequest webResourc
// for data and send to WebCore
WebRequest::WebRequest(WebUrlLoaderClient* loader, WebResourceRequest webResourceRequest, int inputStream)
: m_urlLoader(loader)
- , m_request(0)
, m_androidUrl(true)
+ , m_loadState(Created)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
m_inputStream = (int)env->NewGlobalRef((_jobject*)inputStream);
@@ -80,6 +92,9 @@ WebRequest::WebRequest(WebUrlLoaderClient* loader, WebResourceRequest webResourc
WebRequest::~WebRequest()
{
+ ASSERT(m_loadState == Finished, "dtor called on a WebRequest in a different state than finished (%d)", m_loadState);
+
+ m_loadState = Deleted;
JNIEnv* env = JSC::Bindings::getJNIEnv();
if (m_inputStream)
env->DeleteGlobalRef((_jobject*)m_inputStream);
@@ -87,6 +102,9 @@ WebRequest::~WebRequest()
void WebRequest::finish(bool success)
{
+ ASSERT(m_loadState < Finished, "called finish on an already finished WebRequest (%d)", m_loadState);
+
+ m_loadState = Finished;
if (success) {
LoaderData* loaderData = new LoaderData(m_urlLoader);
m_urlLoader->maybeCallOnMainThread(WebUrlLoaderClient::didFinishLoading, loaderData);
@@ -101,12 +119,17 @@ void WebRequest::finish(bool success)
void WebRequest::AppendBytesToUpload(const char* bytes, int bytesLen)
{
- // This should always be called after start and before finish.
+ // AppendBytesToUpload is only valid before calling start
+ ASSERT(m_loadState == Created, "Start called on a WebRequest not in CREATED state: (%s)", m_url.c_str());
m_request->AppendBytesToUpload(bytes, bytesLen);
}
void WebRequest::start(bool isPrivateBrowsing)
{
+ ASSERT(m_loadState == Created, "Start called on a WebRequest not in CREATED state: (%s)", m_url.c_str());
+
+ m_loadState = Started;
+
if (m_androidUrl)
return handleAndroidURL();
@@ -127,11 +150,18 @@ void WebRequest::start(bool isPrivateBrowsing)
void WebRequest::cancel()
{
+ ASSERT(m_loadState >= Started, "Cancel called on a not started WebRequest: (%s)", m_url.c_str());
+ ASSERT(m_loadState != Cancelled, "Cancel called on an already cancelled WebRequest: (%s)", m_url.c_str());
+
// There is a possible race condition between the IO thread finishing the request and
// the WebCore thread cancelling it. If the request has already finished, do
// nothing to avoid sending duplicate finish messages to WebCore.
- if (!m_request)
+ if (m_loadState > Cancelled) {
return;
+ }
+ ASSERT(m_request, "Request set to 0 before it is finished");
+
+ m_loadState = Cancelled;
m_request->Cancel();
finish(true);
@@ -141,12 +171,14 @@ void WebRequest::handleAndroidURL()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
if (m_inputStream == 0) {
+ m_loadState = Finished;
WebResponse webResponse(m_url, "", 0, "", 0);
LoaderData* loaderData = new LoaderData(m_urlLoader, webResponse);
m_urlLoader->maybeCallOnMainThread(WebUrlLoaderClient::didFail, loaderData);
return;
}
+ m_loadState = Response;
WebResponse webResponse(m_url, "", 0, "", 200);
LoaderData* loaderResponse = new LoaderData(m_urlLoader, webResponse);
m_urlLoader->maybeCallOnMainThread(WebUrlLoaderClient::didReceiveResponse, loaderResponse);
@@ -167,6 +199,7 @@ void WebRequest::handleAndroidURL()
data->reserve(size);
env->GetByteArrayRegion(jb, 0, size, (jbyte*)&data->front());
+ m_loadState = GotData;
// Passes ownership of data
LoaderData* loaderData = new LoaderData(m_urlLoader, data, size);
m_urlLoader->maybeCallOnMainThread(WebUrlLoaderClient::didReceiveAndroidFileData, loaderData);
@@ -187,11 +220,13 @@ void WebRequest::handleDataURL(GURL url)
if (net::DataURL::Parse(url, &mimeType, &charset, data.get())) {
// PopulateURLResponse from chrome implementation
// weburlloader_impl.cc
+ m_loadState = Response;
WebResponse webResponse(url.spec(), mimeType, data->size(), charset, 200);
LoaderData* loaderResponse = new LoaderData(m_urlLoader, webResponse);
m_urlLoader->maybeCallOnMainThread(WebUrlLoaderClient::didReceiveResponse, loaderResponse);
if (!data->empty()) {
+ m_loadState = GotData;
LoaderData* loaderData = new LoaderData(m_urlLoader, data.leakPtr());
m_urlLoader->maybeCallOnMainThread(WebUrlLoaderClient::didReceiveDataUrl, loaderData);
}
@@ -235,6 +270,8 @@ void WebRequest::handleBrowserURL(GURL url)
// deferring redirect.
void WebRequest::OnReceivedRedirect(URLRequest* newRequest, const GURL& newUrl, bool* deferRedirect)
{
+ ASSERT(m_loadState < Response, "Redirect after receiving response");
+
if (newRequest && newRequest->status().is_success()) {
WebResponse webResponse(newRequest);
webResponse.setUrl(newUrl.spec());
@@ -270,6 +307,9 @@ void WebRequest::OnAuthRequired(URLRequest* request, net::AuthChallengeInfo* aut
// response headers if this is a request for a HTTP resource.
void WebRequest::OnResponseStarted(URLRequest* request)
{
+ ASSERT(m_loadState == Started, "Got response after receiving response");
+
+ m_loadState = Response;
if (request && request->status().is_success()) {
WebResponse webResponse(request);
LoaderData* loaderData = new LoaderData(m_urlLoader, webResponse);
@@ -284,6 +324,8 @@ void WebRequest::OnResponseStarted(URLRequest* request)
void WebRequest::startReading()
{
+ ASSERT(m_loadState == Response || m_loadState == GotData, "StartReading in state other than RESPONSE and GOTDATA");
+
int bytesRead = 0;
// chrome only does one read, and schedules the next on the same thread
@@ -295,6 +337,7 @@ void WebRequest::startReading()
break;
}
+ m_loadState = GotData;
// Read ok, forward buffer to webcore
m_networkBuffer->AddRef();
LoaderData* loaderData = new LoaderData(m_urlLoader, m_networkBuffer.get(), bytesRead);
@@ -314,6 +357,9 @@ void WebRequest::startReading()
bool WebRequest::read(int* bytesRead)
{
+ ASSERT(m_loadState == Response || m_loadState == GotData, "read in state other than RESPONSE and GOTDATA");
+ ASSERT(m_networkBuffer == 0, "Read called with a nonzero buffer");
+
// TODO: when asserts work, check that the buffer is 0 here
m_networkBuffer = new net::IOBuffer(kInitialReadBufSize);
return m_request->Read(m_networkBuffer, kInitialReadBufSize, bytesRead);
@@ -330,7 +376,10 @@ bool WebRequest::read(int* bytesRead)
// and bytes read will be -1.
void WebRequest::OnReadCompleted(URLRequest* request, int bytesRead)
{
+ ASSERT(m_loadState == Response || m_loadState == GotData, "OnReadCompleted in state other than RESPONSE and GOTDATA");
+
if (request->status().is_success()) {
+ m_loadState = GotData;
m_networkBuffer->AddRef();
LoaderData* loaderData = new LoaderData(m_urlLoader, m_networkBuffer.get(), bytesRead);
// m_networkBuffer->Release() on main thread
diff --git a/WebKit/android/WebCoreSupport/WebRequest.h b/WebKit/android/WebCoreSupport/WebRequest.h
index b6b3ae2..26cfcbb 100644
--- a/WebKit/android/WebCoreSupport/WebRequest.h
+++ b/WebKit/android/WebCoreSupport/WebRequest.h
@@ -35,6 +35,16 @@ class MessageLoop;
namespace android {
+enum LoadState {
+ Created,
+ Started,
+ Response,
+ GotData,
+ Cancelled,
+ Finished,
+ Deleted
+};
+
class WebResourceRequest;
// All methods in this class must be called on the io thread
@@ -80,6 +90,7 @@ private:
int m_inputStream;
bool m_androidUrl;
std::string m_url;
+ LoadState m_loadState;
};
} // namespace android
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..e12dc52 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 || m_ring.m_isPressed) {
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,19 @@ 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_ring.m_isPressed = false;
+ m_ringAnimationEnd = UINT_MAX;
+ viewInvalidate();
}
void setHeightCanMeasure(bool measure)
@@ -1222,8 +1224,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 +1806,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 +1956,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 +2250,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 +2262,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;",
diff --git a/WebKitTools/DumpRenderTree/android/get_layout_tests_dir_contents.php b/WebKitTools/DumpRenderTree/android/get_layout_tests_dir_contents.php
index 84b4ace..28a1a8a 100644
--- a/WebKitTools/DumpRenderTree/android/get_layout_tests_dir_contents.php
+++ b/WebKitTools/DumpRenderTree/android/get_layout_tests_dir_contents.php
@@ -18,17 +18,16 @@
# Lists the content of the LayoutTests directory
#
# Usage:
-# get_layout_tests_dir_contents.php?path=PATH&recurse=RECURSE&separator=SEPARATOR
+# get_layout_tests_dir_contents.php?path=PATH&recurse=RECURSE&separator=SEPARATOR&mode=MODE
# where
# PATH - relative path in the LayoutTests dir
-# RECURSE = [1|0] (defaults to 1)
+# RECURSE = [true|false] (defaults to true)
# SEPARATOR = a string separating paths in result (defaults to \n)
+# MODE = [folders|files] (defaults to files) - if 'folders' then lists only folders,
+# if 'files' then only files
- #Global variables
- $rootDir =
- dirname($_SERVER['DOCUMENT_ROOT']) . DIRECTORY_SEPARATOR .
- basename($_SERVER['DOCUMENT_ROOT']) . DIRECTORY_SEPARATOR .
- "LayoutTests";
+ # The server document root is LayoutTests/http/tests. See run_apache2.py.
+ $rootDir = realpath($_SERVER['DOCUMENT_ROOT'] . '..' . DIRECTORY_SEPARATOR . '..');
function getAbsolutePath($relPath) {
global $rootDir;
@@ -43,9 +42,7 @@
return substr($basename, 0, 1) == '.';
}
- function getAllFilesUnderAsArray($relPath, $recurse) {
- global $exclude;
- global $rootDir;
+ function getAllFilesUnderAsArray($relPath, $recurse, $mode) {
$files = getFilesAsArray($relPath);
$result = array();
@@ -59,40 +56,55 @@
$filePath = $relPath . DIRECTORY_SEPARATOR . $value;
}
- if (!is_dir(getAbsolutePath($filePath))) {
+ if (is_dir(getAbsolutePath($filePath))) {
+ if ($mode == 'folders') {
+ $result = array_merge($result, (array)$filePath);
+ }
+ if ($recurse) {
+ $result = array_merge($result, getAllFilesUnderAsArray($filePath, $recurse, $mode));
+ }
+ } else if ($mode == 'files') {
$result = array_merge($result, (array)$filePath);
- } else if ($recurse) {
- $result = array_merge($result, getAllFilesUnderAsArray($filePath, $recurse));
}
}
return $result;
}
- $path = getAbsolutePath($_GET['path']);
+ function main() {
+ global $rootDir;
- if (isset($_GET['separator'])) {
- $separator = $_GET['separator'];
- } else {
- $separator = "\n";
- }
+ $path = getAbsolutePath($_GET['path']);
- if (!isset($_GET['recurse'])) {
- $_GET['recurse'] = True;
- }
+ if (!isset($_GET['separator'])) {
+ $separator = "\n";
+ } else {
+ $separator = $_GET['separator'];
+ }
- #Very primitive check if path tries to go above DOCUMENT_ROOT or is absolute
- if (strpos($_GET['path'], "..") !== False ||
- substr($_GET['path'], 0, 1) == DIRECTORY_SEPARATOR) {
- return;
- }
+ $recurse = (strtolower($_GET['recurse']) != 'false');
- #If we don't want realpath to append any prefixes we need to pass it an absolute path
- $path = realpath(getAbsolutePath($_GET['path']));
- $relPath = substr($path, strlen($rootDir) + 1);
+ if (strtolower($_GET['mode']) == 'folders') {
+ $mode = 'folders';
+ } else {
+ $mode = 'files';
+ }
+
+ # Very primitive check if path tries to go above DOCUMENT_ROOT or is absolute
+ if (strpos($_GET['path'], "..") !== False ||
+ substr($_GET['path'], 0, 1) == DIRECTORY_SEPARATOR) {
+ return;
+ }
- #If there is an error of some sort it will be output as a part of the answer!
- foreach (getAllFilesUnderAsArray($relPath, $_GET['recurse']) as $i => $value) {
- echo "$value$separator";
+ # If we don't want realpath to append any prefixes we need to pass it an absolute path
+ $path = realpath(getAbsolutePath($_GET['path']));
+ $relPath = substr($path, strlen($rootDir) + 1);
+
+ # If there is an error of some sort it will be output as a part of the answer!
+ foreach (getAllFilesUnderAsArray($relPath, $recurse, $mode) as $i => $value) {
+ echo "$value$separator";
+ }
}
+
+ main();
?>