diff options
Diffstat (limited to 'Source')
23 files changed, 494 insertions, 361 deletions
diff --git a/Source/WebCore/loader/archive/android/WebArchiveAndroid.cpp b/Source/WebCore/loader/archive/android/WebArchiveAndroid.cpp index 048d787..5f60163 100644 --- a/Source/WebCore/loader/archive/android/WebArchiveAndroid.cpp +++ b/Source/WebCore/loader/archive/android/WebArchiveAndroid.cpp @@ -118,7 +118,7 @@ static bool loadArchiveResourceField(xmlNodePtr resourceNode, const xmlChar* fie } } if (!base64Data) { - LOGD("loadArchiveResourceField: Failed to load field."); + ALOGD("loadArchiveResourceField: Failed to load field."); return false; } @@ -126,7 +126,7 @@ static bool loadArchiveResourceField(xmlNodePtr resourceNode, const xmlChar* fie const int result = base64Decode(base64Data, base64Size, *outputData); if (!result) { - LOGD("loadArchiveResourceField: Failed to decode field."); + ALOGD("loadArchiveResourceField: Failed to decode field."); return false; } @@ -166,37 +166,37 @@ static KURL loadArchiveResourceFieldURL(xmlNodePtr resourceNode, const xmlChar* static PassRefPtr<ArchiveResource> loadArchiveResource(xmlNodePtr resourceNode) { if (!xmlStrEqual(resourceNode->name, archiveResourceTag)) { - LOGD("loadArchiveResource: Malformed resource."); + ALOGD("loadArchiveResource: Malformed resource."); return 0; } KURL url = loadArchiveResourceFieldURL(resourceNode, urlFieldTag); if (url.isNull()) { - LOGD("loadArchiveResource: Failed to load resource."); + ALOGD("loadArchiveResource: Failed to load resource."); return 0; } String mimeType = loadArchiveResourceFieldString(resourceNode, mimeFieldTag); if (mimeType.isNull()) { - LOGD("loadArchiveResource: Failed to load resource."); + ALOGD("loadArchiveResource: Failed to load resource."); return 0; } String textEncoding = loadArchiveResourceFieldString(resourceNode, encodingFieldTag); if (textEncoding.isNull()) { - LOGD("loadArchiveResource: Failed to load resource."); + ALOGD("loadArchiveResource: Failed to load resource."); return 0; } String frameName = loadArchiveResourceFieldString(resourceNode, frameFieldTag); if (frameName.isNull()) { - LOGD("loadArchiveResource: Failed to load resource."); + ALOGD("loadArchiveResource: Failed to load resource."); return 0; } PassRefPtr<SharedBuffer> data = loadArchiveResourceFieldBuffer(resourceNode, dataFieldTag); if (!data) { - LOGD("loadArchiveResource: Failed to load resource."); + ALOGD("loadArchiveResource: Failed to load resource."); return 0; } @@ -212,7 +212,7 @@ static PassRefPtr<WebArchiveAndroid> loadArchive(xmlNodePtr archiveNode) Vector<PassRefPtr<Archive> > subframes; if (!xmlStrEqual(archiveNode->name, archiveTag)) { - LOGD("loadArchive: Malformed archive."); + ALOGD("loadArchive: Malformed archive."); return 0; } @@ -228,7 +228,7 @@ static PassRefPtr<WebArchiveAndroid> loadArchive(xmlNodePtr archiveNode) } } if (!mainResource) { - LOGD("loadArchive: Failed to load main resource."); + ALOGD("loadArchive: Failed to load main resource."); return 0; } @@ -241,7 +241,7 @@ static PassRefPtr<WebArchiveAndroid> loadArchive(xmlNodePtr archiveNode) resourceNode = resourceNode->next) { PassRefPtr<ArchiveResource> subresource = loadArchiveResource(resourceNode); if (!subresource) { - LOGD("loadArchive: Failed to load subresource."); + ALOGD("loadArchive: Failed to load subresource."); break; } subresources.append(subresource); @@ -259,7 +259,7 @@ static PassRefPtr<WebArchiveAndroid> loadArchive(xmlNodePtr archiveNode) resourceNode = resourceNode->next) { PassRefPtr<WebArchiveAndroid> subframe = loadArchive(resourceNode); if (!subframe) { - LOGD("loadArchive: Failed to load subframe."); + ALOGD("loadArchive: Failed to load subframe."); break; } subframes.append(subframe); @@ -291,20 +291,20 @@ PassRefPtr<WebArchiveAndroid> WebArchiveAndroid::create(SharedBuffer* buffer) xmlDocPtr doc = xmlReadMemory(buffer->data(), buffer->size(), noBaseUrl, defaultEncoding, noParserOptions); if (!doc) { - LOGD("create: Failed to parse document."); + ALOGD("create: Failed to parse document."); return createArchiveForError(); } xmlNodePtr root = xmlDocGetRootElement(doc); if (!root) { - LOGD("create: Empty document."); + ALOGD("create: Empty document."); xmlFreeDoc(doc); return createArchiveForError(); } RefPtr<WebArchiveAndroid> archive = loadArchive(root); if (!archive) { - LOGD("create: Failed to load archive."); + ALOGD("create: Failed to load archive."); xmlFreeDoc(doc); return createArchiveForError(); } @@ -317,7 +317,7 @@ static bool saveArchiveResourceField(xmlTextWriterPtr writer, const xmlChar* tag { int result = xmlTextWriterStartElement(writer, tag); if (result < 0) { - LOGD("saveArchiveResourceField: Failed to start element."); + ALOGD("saveArchiveResourceField: Failed to start element."); return false; } @@ -325,20 +325,20 @@ static bool saveArchiveResourceField(xmlTextWriterPtr writer, const xmlChar* tag Vector<char> base64Data; base64Encode(data, size, base64Data, false); if (base64Data.isEmpty()) { - LOGD("saveArchiveResourceField: Failed to base64 encode data."); + ALOGD("saveArchiveResourceField: Failed to base64 encode data."); return false; } result = xmlTextWriterWriteRawLen(writer, BAD_CAST base64Data.data(), base64Data.size()); if (result < 0) { - LOGD("saveArchiveResourceField: Failed to write data."); + ALOGD("saveArchiveResourceField: Failed to write data."); return false; } } result = xmlTextWriterEndElement(writer); if (result < 0) { - LOGD("saveArchiveResourceField: Failed to end element."); + ALOGD("saveArchiveResourceField: Failed to end element."); return false; } @@ -361,7 +361,7 @@ static bool saveArchiveResource(xmlTextWriterPtr writer, PassRefPtr<ArchiveResou { int result = xmlTextWriterStartElement(writer, archiveResourceTag); if (result < 0) { - LOGD("saveArchiveResource: Failed to start element."); + ALOGD("saveArchiveResource: Failed to start element."); return false; } @@ -374,7 +374,7 @@ static bool saveArchiveResource(xmlTextWriterPtr writer, PassRefPtr<ArchiveResou result = xmlTextWriterEndElement(writer); if (result < 0) { - LOGD("saveArchiveResource: Failed to end element."); + ALOGD("saveArchiveResource: Failed to end element."); return false; } @@ -385,13 +385,13 @@ static bool saveArchive(xmlTextWriterPtr writer, PassRefPtr<Archive> archive) { int result = xmlTextWriterStartElement(writer, archiveTag); if (result < 0) { - LOGD("saveArchive: Failed to start element."); + ALOGD("saveArchive: Failed to start element."); return false; } result = xmlTextWriterStartElement(writer, mainResourceTag); if (result < 0) { - LOGD("saveArchive: Failed to start element."); + ALOGD("saveArchive: Failed to start element."); return false; } @@ -400,13 +400,13 @@ static bool saveArchive(xmlTextWriterPtr writer, PassRefPtr<Archive> archive) result = xmlTextWriterEndElement(writer); if (result < 0) { - LOGD("saveArchive: Failed to end element."); + ALOGD("saveArchive: Failed to end element."); return false; } result = xmlTextWriterStartElement(writer, subresourcesTag); if (result < 0) { - LOGD("saveArchive: Failed to start element."); + ALOGD("saveArchive: Failed to start element."); return false; } @@ -419,13 +419,13 @@ static bool saveArchive(xmlTextWriterPtr writer, PassRefPtr<Archive> archive) result = xmlTextWriterEndElement(writer); if (result < 0) { - LOGD("saveArchive: Failed to end element."); + ALOGD("saveArchive: Failed to end element."); return false; } result = xmlTextWriterStartElement(writer, subframesTag); if (result < 0) { - LOGD("saveArchive: Failed to start element."); + ALOGD("saveArchive: Failed to start element."); return false; } @@ -438,7 +438,7 @@ static bool saveArchive(xmlTextWriterPtr writer, PassRefPtr<Archive> archive) result = xmlTextWriterEndElement(writer); if (result < 0) { - LOGD("saveArchive: Failed to end element."); + ALOGD("saveArchive: Failed to end element."); return true; } @@ -453,7 +453,7 @@ bool WebArchiveAndroid::saveWebArchive(xmlTextWriterPtr writer) int result = xmlTextWriterStartDocument(writer, defaultXmlVersion, defaultEncoding, defaultStandalone); if (result < 0) { - LOGD("saveWebArchive: Failed to start document."); + ALOGD("saveWebArchive: Failed to start document."); return false; } @@ -462,7 +462,7 @@ bool WebArchiveAndroid::saveWebArchive(xmlTextWriterPtr writer) result = xmlTextWriterEndDocument(writer); if (result< 0) { - LOGD("saveWebArchive: Failed to end document."); + ALOGD("saveWebArchive: Failed to end document."); return false; } diff --git a/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp b/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp index e4fa435..fc254c0 100644 --- a/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/FontPlatformDataAndroid.cpp @@ -198,10 +198,6 @@ FontPlatformData& FontPlatformData::operator=(const FontPlatformData& src) void FontPlatformData::setupPaint(SkPaint* paint) const { - float ts = mTextSize; - if (!(ts > 0)) - ts = 12; - if (hashTableDeletedFontValue() == mTypeface) paint->setTypeface(0); else @@ -210,7 +206,7 @@ void FontPlatformData::setupPaint(SkPaint* paint) const paint->setAntiAlias(true); paint->setSubpixelText(true); paint->setHinting(SkPaint::kSlight_Hinting); - paint->setTextSize(SkFloatToScalar(ts)); + paint->setTextSize(SkFloatToScalar(mTextSize)); paint->setFakeBoldText(mFakeBold); paint->setTextSkewX(mFakeItalic ? -SK_Scalar1/4 : 0); #ifndef SUPPORT_COMPLEX_SCRIPTS diff --git a/Source/WebCore/platform/graphics/android/GLUtils.cpp b/Source/WebCore/platform/graphics/android/GLUtils.cpp index 2d18032..2693651 100644 --- a/Source/WebCore/platform/graphics/android/GLUtils.cpp +++ b/Source/WebCore/platform/graphics/android/GLUtils.cpp @@ -237,7 +237,7 @@ static EGLConfig defaultPbufferConfig(EGLDisplay display) eglChooseConfig(display, configAttribs, &config, 1, &numConfigs); GLUtils::checkEglError("eglPbufferConfig"); if (numConfigs != 1) - LOGI("eglPbufferConfig failed (%d)\n", numConfigs); + ALOGI("eglPbufferConfig failed (%d)\n", numConfigs); return config; } diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp index 3369118..fc2eddd 100644 --- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp @@ -616,9 +616,8 @@ bool GraphicsLayerAndroid::repaint() m_foregroundClipLayer->setSize(width, height); int rtlOffset = 0; // LTR uses no offset. - if (!layer->renderer()->style()->isLeftToRightDirection()) { - rtlOffset = layer->scrollWidth() - clip.width(); // Scroll all the way right. - } + if (!layer->renderer()->style()->isLeftToRightDirection()) + rtlOffset = layer->scrollWidth() - width; // Scroll all the way right. m_foregroundLayer->setScrollOffset(IntPoint(scroll.width() + rtlOffset, scroll.height())); // Need to offset the foreground layer by the clip layer in order diff --git a/Source/WebCore/platform/graphics/android/TilesManager.cpp b/Source/WebCore/platform/graphics/android/TilesManager.cpp index c6c3626..fbf7ae6 100644 --- a/Source/WebCore/platform/graphics/android/TilesManager.cpp +++ b/Source/WebCore/platform/graphics/android/TilesManager.cpp @@ -113,7 +113,7 @@ TilesManager::TilesManager() m_tilesTextures.reserveCapacity(MAX_TEXTURE_ALLOCATION); m_availableTilesTextures.reserveCapacity(MAX_TEXTURE_ALLOCATION); m_pixmapsGenerationThread = new TexturesGenerator(); - m_pixmapsGenerationThread->run("TexturesGenerator", android::PRIORITY_BACKGROUND); + m_pixmapsGenerationThread->run("TexturesGenerator"); } void TilesManager::allocateTiles() diff --git a/Source/WebKit/android/AndroidLog.h b/Source/WebKit/android/AndroidLog.h index 8f54c02..4090ab9 100644 --- a/Source/WebKit/android/AndroidLog.h +++ b/Source/WebKit/android/AndroidLog.h @@ -32,12 +32,12 @@ extern FILE* gDomTreeFile; #define DOM_TREE_LOG_FILE "/sdcard/domTree.txt" #define DUMP_DOM_LOGD(...) { if (gDomTreeFile) \ - fprintf(gDomTreeFile, __VA_ARGS__); else LOGD(__VA_ARGS__); } + fprintf(gDomTreeFile, __VA_ARGS__); else ALOGD(__VA_ARGS__); } extern FILE* gRenderTreeFile; #define RENDER_TREE_LOG_FILE "/sdcard/renderTree.txt" #define DUMP_RENDER_LOGD(...) { if (gRenderTreeFile) \ - fprintf(gRenderTreeFile, __VA_ARGS__); else LOGD(__VA_ARGS__); } + fprintf(gRenderTreeFile, __VA_ARGS__); else ALOGD(__VA_ARGS__); } #else #define DUMP_DOM_LOGD(...) ((void)0) #define DUMP_RENDER_LOGD(...) ((void)0) diff --git a/Source/WebKit/android/RenderSkinAndroid.cpp b/Source/WebKit/android/RenderSkinAndroid.cpp index 4a9ce68..e6fb67b 100644 --- a/Source/WebKit/android/RenderSkinAndroid.cpp +++ b/Source/WebKit/android/RenderSkinAndroid.cpp @@ -65,14 +65,14 @@ bool RenderSkinAndroid::DecodeBitmap(android::AssetManager* am, const char* file if (!asset) { asset = am->openNonAsset(fileName, android::Asset::ACCESS_BUFFER); if (!asset) { - LOGD("RenderSkinAndroid: File \"%s\" not found.\n", fileName); + ALOGD("RenderSkinAndroid: File \"%s\" not found.\n", fileName); return false; } } bool success = SkImageDecoder::DecodeMemory(asset->getBuffer(false), asset->getLength(), bitmap); if (!success) { - LOGD("RenderSkinAndroid: Failed to decode %s\n", fileName); + ALOGD("RenderSkinAndroid: Failed to decode %s\n", fileName); } delete asset; diff --git a/Source/WebKit/android/RenderSkinMediaButton.cpp b/Source/WebKit/android/RenderSkinMediaButton.cpp index b92336e..f99c731 100644 --- a/Source/WebKit/android/RenderSkinMediaButton.cpp +++ b/Source/WebKit/android/RenderSkinMediaButton.cpp @@ -82,7 +82,7 @@ void RenderSkinMediaButton::Decode() String path = drawableDirectory + gFiles[i].name; if (!RenderSkinAndroid::DecodeBitmap(am, path.utf8().data(), &gButton[i])) { gDecodingFailed = true; - LOGD("RenderSkinButton::Init: button assets failed to decode\n\tBrowser buttons will not draw"); + ALOGD("RenderSkinButton::Init: button assets failed to decode\n\tBrowser buttons will not draw"); break; } } diff --git a/Source/WebKit/android/benchmark/Intercept.cpp b/Source/WebKit/android/benchmark/Intercept.cpp index deffac2..28ada5a 100644 --- a/Source/WebKit/android/benchmark/Intercept.cpp +++ b/Source/WebKit/android/benchmark/Intercept.cpp @@ -57,7 +57,7 @@ void MyResourceLoader::handleRequest() void MyResourceLoader::loadData(const String& data) { - LOGD("Loading data (%s) ...", data.latin1().data()); + ALOGD("Loading data (%s) ...", data.latin1().data()); ResourceHandleClient* client = m_handle->client(); int index = data.find(','); if (index == -1) { @@ -141,7 +141,7 @@ static String mimeTypeForExtension(const String& file) void MyResourceLoader::loadFile(const String& file) { - LOGD("Loading file (%s) ...", file.latin1().data()); + ALOGD("Loading file (%s) ...", file.latin1().data()); FILE* f = fopen(file.latin1().data(), "r"); ResourceHandleClient* client = m_handle->client(); if (!f) { @@ -178,7 +178,7 @@ PassRefPtr<WebCore::ResourceLoaderAndroid> MyWebFrame::startLoadingResource( void MyWebFrame::timerFired(Timer<MyWebFrame>*) { - LOGD("Handling requests..."); + ALOGD("Handling requests..."); Vector<RefPtr<WebCore::ResourceLoaderAndroid> > reqs; reqs.swap(m_requests); Vector<RefPtr<WebCore::ResourceLoaderAndroid> >::iterator i = reqs.begin(); @@ -186,5 +186,5 @@ void MyWebFrame::timerFired(Timer<MyWebFrame>*) for (; i != end; i++) static_cast<MyResourceLoader*>((*i).get())->handleRequest(); - LOGD("...done"); + ALOGD("...done"); } diff --git a/Source/WebKit/android/benchmark/main.cpp b/Source/WebKit/android/benchmark/main.cpp index fcb797d..df6db86 100644 --- a/Source/WebKit/android/benchmark/main.cpp +++ b/Source/WebKit/android/benchmark/main.cpp @@ -47,13 +47,13 @@ int main(int argc, char** argv) { if (x) { width = atoi(optarg); height = atoi(x + 1); - LOGD("Rendering page at %dx%d", width, height); + ALOGD("Rendering page at %dx%d", width, height); } } else if (c == 'r') { reloadCount = atoi(optarg); if (reloadCount < 0) reloadCount = 0; - LOGD("Reloading %d times", reloadCount); + ALOGD("Reloading %d times", reloadCount); } } if (optind >= argc) { diff --git a/Source/WebKit/android/jni/PictureSet.cpp b/Source/WebKit/android/jni/PictureSet.cpp index 1bd72bd..1d50074 100644 --- a/Source/WebKit/android/jni/PictureSet.cpp +++ b/Source/WebKit/android/jni/PictureSet.cpp @@ -850,7 +850,7 @@ void PictureSet::dump(const char* label) const MeasureStream measure; if (working->mPicture != NULL) working->mPicture->serialize(&measure); - LOGD(" [%d]" + ALOGD(" [%d]" " mArea.bounds={%d,%d,r=%d,b=%d}" " mPicture=%p" " mUnsplit={%d,%d,r=%d,b=%d}" @@ -1199,24 +1199,24 @@ bool PictureSet::validate(const char* funct) const const SkIRect& bounds = area.getBounds(); bool localValid = false; if (working->mUnsplit.isEmpty()) - LOGD("%s working->mUnsplit.isEmpty()", funct); + ALOGD("%s working->mUnsplit.isEmpty()", funct); else if (working->mUnsplit.contains(bounds) == false) - LOGD("%s working->mUnsplit.contains(bounds) == false", funct); + ALOGD("%s working->mUnsplit.contains(bounds) == false", funct); else if (working->mElapsed >= 1000) - LOGD("%s working->mElapsed >= 1000", funct); + ALOGD("%s working->mElapsed >= 1000", funct); else if ((working->mSplit & 0xfe) != 0) - LOGD("%s (working->mSplit & 0xfe) != 0", funct); + ALOGD("%s (working->mSplit & 0xfe) != 0", funct); else if ((working->mWroteElapsed & 0xfe) != 0) - LOGD("%s (working->mWroteElapsed & 0xfe) != 0", funct); + ALOGD("%s (working->mWroteElapsed & 0xfe) != 0", funct); else if (pict != NULL) { int pictWidth = pict->width(); int pictHeight = pict->height(); if (pictWidth < bounds.width()) - LOGD("%s pictWidth=%d < bounds.width()=%d", funct, pictWidth, bounds.width()); + ALOGD("%s pictWidth=%d < bounds.width()=%d", funct, pictWidth, bounds.width()); else if (pictHeight < bounds.height()) - LOGD("%s pictHeight=%d < bounds.height()=%d", funct, pictHeight, bounds.height()); + ALOGD("%s pictHeight=%d < bounds.height()=%d", funct, pictHeight, bounds.height()); else if (working->mArea.isEmpty()) - LOGD("%s working->mArea.isEmpty()", funct); + ALOGD("%s working->mArea.isEmpty()", funct); else localValid = true; } else @@ -1224,7 +1224,7 @@ bool PictureSet::validate(const char* funct) const working->mArea.validate(); if (localValid == false) { if (all.contains(area) == true) - LOGD("%s all.contains(area) == true", funct); + ALOGD("%s all.contains(area) == true", funct); else localValid = true; } @@ -1235,9 +1235,9 @@ bool PictureSet::validate(const char* funct) const if (valid) { valid = false; if (allBounds.width() != mWidth) - LOGD("%s allBounds.width()=%d != mWidth=%d", funct, allBounds.width(), mWidth); + ALOGD("%s allBounds.width()=%d != mWidth=%d", funct, allBounds.width(), mWidth); else if (allBounds.height() != mHeight) - LOGD("%s allBounds.height()=%d != mHeight=%d", funct, allBounds.height(), mHeight); + ALOGD("%s allBounds.height()=%d != mHeight=%d", funct, allBounds.height(), mHeight); else valid = true; } diff --git a/Source/WebKit/android/jni/PictureSet.h b/Source/WebKit/android/jni/PictureSet.h index fe47361..97d91e0 100644 --- a/Source/WebKit/android/jni/PictureSet.h +++ b/Source/WebKit/android/jni/PictureSet.h @@ -31,9 +31,9 @@ #define PICTURE_SET_VALIDATE 0 #if PICTURE_SET_DEBUG -#define DBG_SET_LOG(message) LOGD("%s %s", __FUNCTION__, message) -#define DBG_SET_LOGD(format, ...) LOGD("%s " format, __FUNCTION__, __VA_ARGS__) -#define DEBUG_SET_UI_LOGD(...) LOGD(__VA_ARGS__) +#define DBG_SET_LOG(message) ALOGD("%s %s", __FUNCTION__, message) +#define DBG_SET_LOGD(format, ...) ALOGD("%s " format, __FUNCTION__, __VA_ARGS__) +#define DEBUG_SET_UI_LOGD(...) ALOGD(__VA_ARGS__) #else #define DBG_SET_LOG(message) ((void)0) #define DBG_SET_LOGD(format, ...) ((void)0) diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp index 79494e6..cd0d0cb 100644 --- a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -1484,7 +1484,7 @@ static jstring SaveWebArchive(JNIEnv *env, jobject obj, jstring basename, jboole } if (filename.isNull() || filename.isEmpty()) { - LOGD("saveWebArchive: Failed to select a filename to save."); + ALOGD("saveWebArchive: Failed to select a filename to save."); releaseCharactersForJStringInEnv(env, basename, basenameNative); return NULL; } @@ -1492,7 +1492,7 @@ static jstring SaveWebArchive(JNIEnv *env, jobject obj, jstring basename, jboole const int noCompression = 0; xmlTextWriterPtr writer = xmlNewTextWriterFilename(filename.utf8().data(), noCompression); if (writer == NULL) { - LOGD("saveWebArchive: Failed to initialize xml writer."); + ALOGD("saveWebArchive: Failed to initialize xml writer."); releaseCharactersForJStringInEnv(env, basename, basenameNative); return NULL; } @@ -2081,27 +2081,27 @@ static void SslClientCert(JNIEnv *env, jobject obj, int handle, jbyteArray pkey, static void AuthenticationProceed(JNIEnv *env, jobject obj, int handle, jstring jUsername, jstring jPassword) { - LOGW("Chromium authentication API called, but libchromium is not available"); + ALOGW("Chromium authentication API called, but libchromium is not available"); } static void AuthenticationCancel(JNIEnv *env, jobject obj, int handle) { - LOGW("Chromium authentication API called, but libchromium is not available"); + ALOGW("Chromium authentication API called, but libchromium is not available"); } static void SslCertErrorProceed(JNIEnv *env, jobject obj, int handle) { - LOGW("Chromium SSL API called, but libchromium is not available"); + ALOGW("Chromium SSL API called, but libchromium is not available"); } static void SslCertErrorCancel(JNIEnv *env, jobject obj, int handle, int cert_error) { - LOGW("Chromium SSL API called, but libchromium is not available"); + ALOGW("Chromium SSL API called, but libchromium is not available"); } static void SslClientCert(JNIEnv *env, jobject obj, int handle, jbyteArray privateKey, jobjectArray chain) { - LOGW("Chromium SSL API called, but libchromium is not available"); + ALOGW("Chromium SSL API called, but libchromium is not available"); } #endif // USE(CHROME_NETWORK_STACK) diff --git a/Source/WebKit/android/jni/WebHistory.cpp b/Source/WebKit/android/jni/WebHistory.cpp index c61d3ee..c0b1e6e 100644 --- a/Source/WebKit/android/jni/WebHistory.cpp +++ b/Source/WebKit/android/jni/WebHistory.cpp @@ -246,7 +246,7 @@ void WebHistoryItem::updateHistoryItem(WebCore::HistoryItem* item) { // if the parent only has one ref, it is from this WebHistoryItem. // This means that the matching WebCore::HistoryItem has been freed. // This can happen during clear(). - LOGW("Can't updateHistoryItem as the top HistoryItem is gone"); + ALOGW("Can't updateHistoryItem as the top HistoryItem is gone"); return; } while (webItem->parent()) @@ -256,7 +256,7 @@ void WebHistoryItem::updateHistoryItem(WebCore::HistoryItem* item) { // If a HistoryItem only exists for page cache, it is possible that // the parent HistoryItem destroyed before the child HistoryItem. If // it happens, skip updating. - LOGW("Can't updateHistoryItem as the top HistoryItem is gone"); + ALOGW("Can't updateHistoryItem as the top HistoryItem is gone"); return; } } @@ -711,7 +711,7 @@ static bool read_item_recursive(WebCore::HistoryItem* newItem, #ifdef UNIT_TEST static void unit_test() { - LOGD("Entering history unit test!"); + ALOGD("Entering history unit test!"); const char* test1 = new char[0]; WTF::RefPtr<WebCore::HistoryItem> item = WebCore::HistoryItem::create(); WebCore::HistoryItem* testItem = item.get(); diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index f8791f5..d2b6e6f 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -237,8 +237,6 @@ bool WebViewCore::isSupportedMediaMimeType(const WTF::String& mimeType) { // ---------------------------------------------------------------------------- -#define GET_NATIVE_VIEW(env, obj) ((WebViewCore*)env->GetIntField(obj, gWebViewCoreFields.m_nativeClass)) - // Field ids for WebViewCore struct WebViewCoreFields { jfieldID m_nativeClass; @@ -983,7 +981,7 @@ void WebViewCore::scrollTo(int x, int y, bool animate) { LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!"); -// LOGD("WebViewCore::scrollTo(%d %d)\n", x, y); +// ALOGD("WebViewCore::scrollTo(%d %d)\n", x, y); JNIEnv* env = JSC::Bindings::getJNIEnv(); AutoJObject javaObject = m_javaGlue->object(env); @@ -1598,7 +1596,7 @@ void WebViewCore::updateFrameCache() // once the recalculation is complete. // TODO: Do we need to reschedule an update for after the style is recalculated? if (m_mainFrame && m_mainFrame->document() && m_mainFrame->document()->isPendingStyleRecalc()) { - LOGW("updateFrameCache: pending style recalc, ignoring."); + ALOGW("updateFrameCache: pending style recalc, ignoring."); return; } m_frameCacheOutOfDate = false; @@ -3185,7 +3183,7 @@ bool WebViewCore::handleTouchEvent(int action, Vector<int>& ids, Vector<IntPoint default: // We do not support other kinds of touch event inside WebCore // at the moment. - LOGW("Java passed a touch event type that we do not support in WebCore: %d", action); + ALOGW("Java passed a touch event type that we do not support in WebCore: %d", action); return 0; } @@ -3922,137 +3920,145 @@ void WebViewCore::scrollRenderLayer(int layer, const SkRect& rect) //---------------------------------------------------------------------- // Native JNI methods //---------------------------------------------------------------------- -static void RevealSelection(JNIEnv *env, jobject obj) +static void RevealSelection(JNIEnv* env, jobject obj, jint nativeClass) { - GET_NATIVE_VIEW(env, obj)->revealSelection(); + reinterpret_cast<WebViewCore*>(nativeClass)->revealSelection(); } -static jstring RequestLabel(JNIEnv *env, jobject obj, int framePointer, - int nodePointer) +static jstring RequestLabel(JNIEnv* env, jobject obj, jint nativeClass, + int framePointer, int nodePointer) { - return wtfStringToJstring(env, GET_NATIVE_VIEW(env, obj)->requestLabel( + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); + return wtfStringToJstring(env, viewImpl->requestLabel( (WebCore::Frame*) framePointer, (WebCore::Node*) nodePointer)); } -static void ClearContent(JNIEnv *env, jobject obj) +static void ClearContent(JNIEnv* env, jobject obj, jint nativeClass) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); viewImpl->clearContent(); } -static void UpdateFrameCacheIfLoading(JNIEnv *env, jobject obj) +static void UpdateFrameCacheIfLoading(JNIEnv* env, jobject obj, jint nativeClass) { - GET_NATIVE_VIEW(env, obj)->updateFrameCacheIfLoading(); + reinterpret_cast<WebViewCore*>(nativeClass)->updateFrameCacheIfLoading(); } -static void SetSize(JNIEnv *env, jobject obj, jint width, jint height, - jint textWrapWidth, jfloat scale, jint screenWidth, jint screenHeight, - jint anchorX, jint anchorY, jboolean ignoreHeight) +static void SetSize(JNIEnv* env, jobject obj, jint nativeClass, jint width, + jint height, jint textWrapWidth, jfloat scale, jint screenWidth, + jint screenHeight, jint anchorX, jint anchorY, jboolean ignoreHeight) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); ALOGV("webviewcore::nativeSetSize(%u %u)\n viewImpl: %p", (unsigned)width, (unsigned)height, viewImpl); LOG_ASSERT(viewImpl, "viewImpl not set in nativeSetSize"); viewImpl->setSizeScreenWidthAndScale(width, height, textWrapWidth, scale, screenWidth, screenHeight, anchorX, anchorY, ignoreHeight); } -static void SetScrollOffset(JNIEnv *env, jobject obj, jint gen, jboolean sendScrollEvent, jint x, jint y) +static void SetScrollOffset(JNIEnv* env, jobject obj, jint nativeClass, + jint gen, jboolean sendScrollEvent, jint x, jint y) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "need viewImpl"); viewImpl->setScrollOffset(gen, sendScrollEvent, x, y); } -static void SetGlobalBounds(JNIEnv *env, jobject obj, jint x, jint y, jint h, - jint v) +static void SetGlobalBounds(JNIEnv* env, jobject obj, jint nativeClass, + jint x, jint y, jint h, jint v) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "need viewImpl"); viewImpl->setGlobalBounds(x, y, h, v); } -static jboolean Key(JNIEnv *env, jobject obj, jint keyCode, jint unichar, - jint repeatCount, jboolean isShift, jboolean isAlt, jboolean isSym, - jboolean isDown) +static jboolean Key(JNIEnv* env, jobject obj, jint nativeClass, jint keyCode, + jint unichar, jint repeatCount, jboolean isShift, jboolean isAlt, + jboolean isSym, jboolean isDown) { - return GET_NATIVE_VIEW(env, obj)->key(PlatformKeyboardEvent(keyCode, + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); + return viewImpl->key(PlatformKeyboardEvent(keyCode, unichar, repeatCount, isDown, isShift, isAlt, isSym)); } -static void Click(JNIEnv *env, jobject obj, int framePtr, int nodePtr, jboolean fake) +static void Click(JNIEnv* env, jobject obj, jint nativeClass, int framePtr, + int nodePtr, jboolean fake) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in Click"); viewImpl->click(reinterpret_cast<WebCore::Frame*>(framePtr), reinterpret_cast<WebCore::Node*>(nodePtr), fake); } -static void ContentInvalidateAll(JNIEnv *env, jobject obj) +static void ContentInvalidateAll(JNIEnv* env, jobject obj, jint nativeClass) { - GET_NATIVE_VIEW(env, obj)->contentInvalidateAll(); + reinterpret_cast<WebViewCore*>(nativeClass)->contentInvalidateAll(); } -static void DeleteSelection(JNIEnv *env, jobject obj, jint start, jint end, - jint textGeneration) +static void DeleteSelection(JNIEnv* env, jobject obj, jint nativeClass, + jint start, jint end, jint textGeneration) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); viewImpl->deleteSelection(start, end, textGeneration); } -static void SetSelection(JNIEnv *env, jobject obj, jint start, jint end) +static void SetSelection(JNIEnv* env, jobject obj, jint nativeClass, + jint start, jint end) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); viewImpl->setSelection(start, end); } -static jstring ModifySelection(JNIEnv *env, jobject obj, jint direction, jint granularity) +static jstring ModifySelection(JNIEnv* env, jobject obj, jint nativeClass, + jint direction, jint granularity) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); String selectionString = viewImpl->modifySelection(direction, granularity); return wtfStringToJstring(env, selectionString); } -static void ReplaceTextfieldText(JNIEnv *env, jobject obj, +static void ReplaceTextfieldText(JNIEnv* env, jobject obj, jint nativeClass, jint oldStart, jint oldEnd, jstring replace, jint start, jint end, jint textGeneration) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); WTF::String webcoreString = jstringToWtfString(env, replace); viewImpl->replaceTextfieldText(oldStart, oldEnd, webcoreString, start, end, textGeneration); } -static void PassToJs(JNIEnv *env, jobject obj, +static void PassToJs(JNIEnv* env, jobject obj, jint nativeClass, jint generation, jstring currentText, jint keyCode, jint keyValue, jboolean down, jboolean cap, jboolean fn, jboolean sym) { WTF::String current = jstringToWtfString(env, currentText); - GET_NATIVE_VIEW(env, obj)->passToJs(generation, current, + reinterpret_cast<WebViewCore*>(nativeClass)->passToJs(generation, current, PlatformKeyboardEvent(keyCode, keyValue, 0, down, cap, fn, sym)); } -static void ScrollFocusedTextInput(JNIEnv *env, jobject obj, jfloat xPercent, - jint y) +static void ScrollFocusedTextInput(JNIEnv* env, jobject obj, jint nativeClass, + jfloat xPercent, jint y) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); viewImpl->scrollFocusedTextInput(xPercent, y); } -static void SetFocusControllerActive(JNIEnv *env, jobject obj, jboolean active) +static void SetFocusControllerActive(JNIEnv* env, jobject obj, jint nativeClass, + jboolean active) { ALOGV("webviewcore::nativeSetFocusControllerActive()\n"); - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in nativeSetFocusControllerActive"); viewImpl->setFocusControllerActive(active); } -static void SaveDocumentState(JNIEnv *env, jobject obj, jint frame) +static void SaveDocumentState(JNIEnv* env, jobject obj, jint nativeClass, + jint frame) { ALOGV("webviewcore::nativeSaveDocumentState()\n"); - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in nativeSaveDocumentState"); viewImpl->saveDocumentState((WebCore::Frame*) frame); } @@ -4063,7 +4069,8 @@ void WebViewCore::addVisitedLink(const UChar* string, int length) m_groupForVisitedLinks->addVisitedLink(string, length); } -static bool UpdateLayers(JNIEnv *env, jobject obj, jint nativeClass, jint jbaseLayer) +static bool UpdateLayers(JNIEnv* env, jobject obj, jint nativeClass, + jint jbaseLayer) { WebViewCore* viewImpl = (WebViewCore*) nativeClass; BaseLayerAndroid* baseLayer = (BaseLayerAndroid*) jbaseLayer; @@ -4075,15 +4082,16 @@ static bool UpdateLayers(JNIEnv *env, jobject obj, jint nativeClass, jint jbaseL return true; } -static void NotifyAnimationStarted(JNIEnv *env, jobject obj, jint nativeClass) +static void NotifyAnimationStarted(JNIEnv* env, jobject obj, jint nativeClass) { WebViewCore* viewImpl = (WebViewCore*) nativeClass; viewImpl->notifyAnimationStarted(); } -static jint RecordContent(JNIEnv *env, jobject obj, jobject region, jobject pt) +static jint RecordContent(JNIEnv* env, jobject obj, jint nativeClass, + jobject region, jobject pt) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); SkRegion* nativeRegion = GraphicsJNI::getNativeRegion(env, region); SkIPoint nativePt; BaseLayerAndroid* result = viewImpl->recordContent(nativeRegion, &nativePt); @@ -4091,15 +4099,17 @@ static jint RecordContent(JNIEnv *env, jobject obj, jobject region, jobject pt) return reinterpret_cast<jint>(result); } -static void SplitContent(JNIEnv *env, jobject obj, jint content) +static void SplitContent(JNIEnv* env, jobject obj, jint nativeClass, + jint content) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); viewImpl->splitContent(reinterpret_cast<PictureSet*>(content)); } -static void SendListBoxChoice(JNIEnv* env, jobject obj, jint choice) +static void SendListBoxChoice(JNIEnv* env, jobject obj, jint nativeClass, + jint choice) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in nativeSendListBoxChoice"); viewImpl->popupReply(choice); } @@ -4110,10 +4120,10 @@ static void SendListBoxChoice(JNIEnv* env, jobject obj, jint choice) // number of items in the average multiple-select listbox. #define PREPARED_LISTBOX_STORAGE 10 -static void SendListBoxChoices(JNIEnv* env, jobject obj, jbooleanArray jArray, - jint size) +static void SendListBoxChoices(JNIEnv* env, jobject obj, jint nativeClass, + jbooleanArray jArray, jint size) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in nativeSendListBoxChoices"); jboolean* ptrArray = env->GetBooleanArrayElements(jArray, 0); SkAutoSTMalloc<PREPARED_LISTBOX_STORAGE, int> storage(size); @@ -4128,8 +4138,8 @@ static void SendListBoxChoices(JNIEnv* env, jobject obj, jbooleanArray jArray, viewImpl->popupReply(array, count); } -static jstring FindAddress(JNIEnv *env, jobject obj, jstring addr, - jboolean caseInsensitive) +static jstring FindAddress(JNIEnv* env, jobject obj, jstring addr, + jboolean caseInsensitive) { if (!addr) return 0; @@ -4147,11 +4157,11 @@ static jstring FindAddress(JNIEnv *env, jobject obj, jstring addr, return ret; } -static jboolean HandleTouchEvent(JNIEnv *env, jobject obj, jint action, jintArray idArray, - jintArray xArray, jintArray yArray, - jint count, jint actionIndex, jint metaState) +static jboolean HandleTouchEvent(JNIEnv* env, jobject obj, jint nativeClass, + jint action, jintArray idArray, jintArray xArray, jintArray yArray, + jint count, jint actionIndex, jint metaState) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); jint* ptrIdArray = env->GetIntArrayElements(idArray, 0); jint* ptrXArray = env->GetIntArrayElements(xArray, 0); @@ -4170,18 +4180,19 @@ static jboolean HandleTouchEvent(JNIEnv *env, jobject obj, jint action, jintArra return viewImpl->handleTouchEvent(action, ids, points, actionIndex, metaState); } -static void TouchUp(JNIEnv *env, jobject obj, jint touchGeneration, - jint frame, jint node, jint x, jint y) +static void TouchUp(JNIEnv* env, jobject obj, jint nativeClass, + jint touchGeneration, jint frame, jint node, jint x, jint y) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); viewImpl->touchUp(touchGeneration, (WebCore::Frame*) frame, (WebCore::Node*) node, x, y); } -static jstring RetrieveHref(JNIEnv *env, jobject obj, jint x, jint y) +static jstring RetrieveHref(JNIEnv* env, jobject obj, jint nativeClass, + jint x, jint y) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); WTF::String result = viewImpl->retrieveHref(x, y); if (!result.isEmpty()) @@ -4189,9 +4200,10 @@ static jstring RetrieveHref(JNIEnv *env, jobject obj, jint x, jint y) return 0; } -static jstring RetrieveAnchorText(JNIEnv *env, jobject obj, jint x, jint y) +static jstring RetrieveAnchorText(JNIEnv* env, jobject obj, jint nativeClass, + jint x, jint y) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); WTF::String result = viewImpl->retrieveAnchorText(x, y); if (!result.isEmpty()) @@ -4199,51 +4211,54 @@ static jstring RetrieveAnchorText(JNIEnv *env, jobject obj, jint x, jint y) return 0; } -static jstring RetrieveImageSource(JNIEnv *env, jobject obj, jint x, jint y) +static jstring RetrieveImageSource(JNIEnv* env, jobject obj, jint nativeClass, + jint x, jint y) { - WTF::String result = GET_NATIVE_VIEW(env, obj)->retrieveImageSource(x, y); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); + WTF::String result = viewImpl->retrieveImageSource(x, y); return !result.isEmpty() ? wtfStringToJstring(env, result) : 0; } -static void StopPaintingCaret(JNIEnv *env, jobject obj) +static void StopPaintingCaret(JNIEnv* env, jobject obj, jint nativeClass) { - GET_NATIVE_VIEW(env, obj)->setShouldPaintCaret(false); + reinterpret_cast<WebViewCore*>(nativeClass)->setShouldPaintCaret(false); } -static void MoveFocus(JNIEnv *env, jobject obj, jint framePtr, jint nodePtr) +static void MoveFocus(JNIEnv* env, jobject obj, jint nativeClass, jint framePtr, + jint nodePtr) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); viewImpl->moveFocus((WebCore::Frame*) framePtr, (WebCore::Node*) nodePtr); } -static void MoveMouse(JNIEnv *env, jobject obj, jint frame, +static void MoveMouse(JNIEnv* env, jobject obj, jint nativeClass, jint frame, jint x, jint y) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); viewImpl->moveMouse((WebCore::Frame*) frame, x, y); } -static void MoveMouseIfLatest(JNIEnv *env, jobject obj, jint moveGeneration, - jint frame, jint x, jint y) +static void MoveMouseIfLatest(JNIEnv* env, jobject obj, jint nativeClass, + jint moveGeneration, jint frame, jint x, jint y) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); viewImpl->moveMouseIfLatest(moveGeneration, (WebCore::Frame*) frame, x, y); } -static void UpdateFrameCache(JNIEnv *env, jobject obj) +static void UpdateFrameCache(JNIEnv* env, jobject obj, jint nativeClass) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); viewImpl->updateFrameCache(); } -static jint GetContentMinPrefWidth(JNIEnv *env, jobject obj) +static jint GetContentMinPrefWidth(JNIEnv* env, jobject obj, jint nativeClass) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); WebCore::Frame* frame = viewImpl->mainFrame(); @@ -4259,9 +4274,10 @@ static jint GetContentMinPrefWidth(JNIEnv *env, jobject obj) return 0; } -static void SetViewportSettingsFromNative(JNIEnv *env, jobject obj) +static void SetViewportSettingsFromNative(JNIEnv* env, jobject obj, + jint nativeClass) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); WebCore::Settings* s = viewImpl->mainFrame()->page()->settings(); @@ -4279,39 +4295,42 @@ static void SetViewportSettingsFromNative(JNIEnv *env, jobject obj) #endif } -static void SetBackgroundColor(JNIEnv *env, jobject obj, jint color) +static void SetBackgroundColor(JNIEnv* env, jobject obj, jint nativeClass, + jint color) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); viewImpl->setBackgroundColor((SkColor) color); } -static void DumpDomTree(JNIEnv *env, jobject obj, jboolean useFile) +static void DumpDomTree(JNIEnv* env, jobject obj, jint nativeClass, + jboolean useFile) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); viewImpl->dumpDomTree(useFile); } -static void DumpRenderTree(JNIEnv *env, jobject obj, jboolean useFile) +static void DumpRenderTree(JNIEnv* env, jobject obj, jint nativeClass, + jboolean useFile) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); viewImpl->dumpRenderTree(useFile); } -static void DumpNavTree(JNIEnv *env, jobject obj) +static void DumpNavTree(JNIEnv* env, jobject obj, jint nativeClass) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); viewImpl->dumpNavTree(); } -static void SetJsFlags(JNIEnv *env, jobject obj, jstring flags) +static void SetJsFlags(JNIEnv* env, jobject obj, jint nativeClass, jstring flags) { #if USE(V8) WTF::String flagsString = jstringToWtfString(env, flags); @@ -4324,9 +4343,11 @@ static void SetJsFlags(JNIEnv *env, jobject obj, jstring flags) // Called from the Java side to set a new quota for the origin or new appcache // max size in response to a notification that the original quota was exceeded or // that the appcache has reached its maximum size. -static void SetNewStorageLimit(JNIEnv* env, jobject obj, jlong quota) { +static void SetNewStorageLimit(JNIEnv* env, jobject obj, jint nativeClass, + jlong quota) +{ #if ENABLE(DATABASE) || ENABLE(OFFLINE_WEB_APPLICATIONS) - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); Frame* frame = viewImpl->mainFrame(); // The main thread is blocked awaiting this response, so now we can wake it @@ -4337,89 +4358,97 @@ static void SetNewStorageLimit(JNIEnv* env, jobject obj, jlong quota) { } // Called from Java to provide a Geolocation permission state for the specified origin. -static void GeolocationPermissionsProvide(JNIEnv* env, jobject obj, jstring origin, jboolean allow, jboolean remember) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); +static void GeolocationPermissionsProvide(JNIEnv* env, jobject obj, + jint nativeClass, jstring origin, jboolean allow, jboolean remember) +{ + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); Frame* frame = viewImpl->mainFrame(); ChromeClientAndroid* chromeClient = static_cast<ChromeClientAndroid*>(frame->page()->chrome()->client()); chromeClient->provideGeolocationPermissions(jstringToWtfString(env, origin), allow, remember); } -static void RegisterURLSchemeAsLocal(JNIEnv* env, jobject obj, jstring scheme) { +static void RegisterURLSchemeAsLocal(JNIEnv* env, jobject obj, jint nativeClass, + jstring scheme) +{ WebCore::SchemeRegistry::registerURLSchemeAsLocal(jstringToWtfString(env, scheme)); } -static bool FocusBoundsChanged(JNIEnv* env, jobject obj) +static bool FocusBoundsChanged(JNIEnv* env, jobject obj, jint nativeClass) { - return GET_NATIVE_VIEW(env, obj)->focusBoundsChanged(); + return reinterpret_cast<WebViewCore*>(nativeClass)->focusBoundsChanged(); } -static void SetIsPaused(JNIEnv* env, jobject obj, jboolean isPaused) +static void SetIsPaused(JNIEnv* env, jobject obj, jint nativeClass, + jboolean isPaused) { // tell the webcore thread to stop thinking while we do other work // (selection and scrolling). This has nothing to do with the lifecycle // pause and resume. - GET_NATIVE_VIEW(env, obj)->setIsPaused(isPaused); + reinterpret_cast<WebViewCore*>(nativeClass)->setIsPaused(isPaused); } -static void Pause(JNIEnv* env, jobject obj) +static void Pause(JNIEnv* env, jobject obj, jint nativeClass) { // This is called for the foreground tab when the browser is put to the // background (and also for any tab when it is put to the background of the // browser). The browser can only be killed by the system when it is in the // background, so saving the Geolocation permission state now ensures that // is maintained when the browser is killed. - ChromeClient* chromeClient = GET_NATIVE_VIEW(env, obj)->mainFrame()->page()->chrome()->client(); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); + ChromeClient* chromeClient = viewImpl->mainFrame()->page()->chrome()->client(); ChromeClientAndroid* chromeClientAndroid = static_cast<ChromeClientAndroid*>(chromeClient); chromeClientAndroid->storeGeolocationPermissions(); - Frame* mainFrame = GET_NATIVE_VIEW(env, obj)->mainFrame(); + Frame* mainFrame = viewImpl->mainFrame(); for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext()) { Geolocation* geolocation = frame->domWindow()->navigator()->optionalGeolocation(); if (geolocation) geolocation->suspend(); } - GET_NATIVE_VIEW(env, obj)->deviceMotionAndOrientationManager()->maybeSuspendClients(); + viewImpl->deviceMotionAndOrientationManager()->maybeSuspendClients(); ANPEvent event; SkANP::InitEvent(&event, kLifecycle_ANPEventType); event.data.lifecycle.action = kPause_ANPLifecycleAction; - GET_NATIVE_VIEW(env, obj)->sendPluginEvent(event); + viewImpl->sendPluginEvent(event); - GET_NATIVE_VIEW(env, obj)->setIsPaused(true); + viewImpl->setIsPaused(true); } -static void Resume(JNIEnv* env, jobject obj) +static void Resume(JNIEnv* env, jobject obj, jint nativeClass) { - Frame* mainFrame = GET_NATIVE_VIEW(env, obj)->mainFrame(); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); + Frame* mainFrame = viewImpl->mainFrame(); for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext()) { Geolocation* geolocation = frame->domWindow()->navigator()->optionalGeolocation(); if (geolocation) geolocation->resume(); } - GET_NATIVE_VIEW(env, obj)->deviceMotionAndOrientationManager()->maybeResumeClients(); + viewImpl->deviceMotionAndOrientationManager()->maybeResumeClients(); ANPEvent event; SkANP::InitEvent(&event, kLifecycle_ANPEventType); event.data.lifecycle.action = kResume_ANPLifecycleAction; - GET_NATIVE_VIEW(env, obj)->sendPluginEvent(event); + viewImpl->sendPluginEvent(event); - GET_NATIVE_VIEW(env, obj)->setIsPaused(false); + viewImpl->setIsPaused(false); } -static void FreeMemory(JNIEnv* env, jobject obj) +static void FreeMemory(JNIEnv* env, jobject obj, jint nativeClass) { ANPEvent event; SkANP::InitEvent(&event, kLifecycle_ANPEventType); event.data.lifecycle.action = kFreeMemory_ANPLifecycleAction; - GET_NATIVE_VIEW(env, obj)->sendPluginEvent(event); + reinterpret_cast<WebViewCore*>(nativeClass)->sendPluginEvent(event); } -static void ProvideVisitedHistory(JNIEnv *env, jobject obj, jobject hist) +static void ProvideVisitedHistory(JNIEnv* env, jobject obj, jint nativeClass, + jobject hist) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__); jobjectArray array = static_cast<jobjectArray>(hist); @@ -4435,17 +4464,18 @@ static void ProvideVisitedHistory(JNIEnv *env, jobject obj, jobject hist) } } -static void PluginSurfaceReady(JNIEnv* env, jobject obj) +static void PluginSurfaceReady(JNIEnv* env, jobject obj, jint nativeClass) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); if (viewImpl) viewImpl->sendPluginSurfaceReady(); } // Notification from the UI thread that the plugin's full-screen surface has been discarded -static void FullScreenPluginHidden(JNIEnv* env, jobject obj, jint npp) +static void FullScreenPluginHidden(JNIEnv* env, jobject obj, jint nativeClass, + jint npp) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); PluginWidgetAndroid* plugin = viewImpl->getPluginWidget((NPP)npp); if (plugin) plugin->exitFullScreen(false); @@ -4458,18 +4488,20 @@ static WebCore::IntRect jrect_to_webrect(JNIEnv* env, jobject obj) return WebCore::IntRect(L, T, R - L, B - T); } -static bool ValidNodeAndBounds(JNIEnv *env, jobject obj, int frame, int node, - jobject rect) +static bool ValidNodeAndBounds(JNIEnv* env, jobject obj, jint nativeClass, + int frame, int node, jobject rect) { IntRect nativeRect = jrect_to_webrect(env, rect); - return GET_NATIVE_VIEW(env, obj)->validNodeAndBounds( + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); + return viewImpl->validNodeAndBounds( reinterpret_cast<Frame*>(frame), reinterpret_cast<Node*>(node), nativeRect); } -static jobject GetTouchHighlightRects(JNIEnv* env, jobject obj, jint x, jint y, jint slop) +static jobject GetTouchHighlightRects(JNIEnv* env, jobject obj, jint nativeClass, + jint x, jint y, jint slop) { - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); if (!viewImpl) return 0; Vector<IntRect> rects = viewImpl->getTouchHighlightRects(x, y, slop); @@ -4503,10 +4535,11 @@ static jobject GetTouchHighlightRects(JNIEnv* env, jobject obj, jint x, jint y, return array; } -static void AutoFillForm(JNIEnv* env, jobject obj, jint queryId) +static void AutoFillForm(JNIEnv* env, jobject obj, jint nativeClass, + jint queryId) { #if ENABLE(WEB_AUTOFILL) - WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); if (!viewImpl) return; @@ -4519,7 +4552,7 @@ static void AutoFillForm(JNIEnv* env, jobject obj, jint queryId) #endif } -static void CloseIdleConnections(JNIEnv* env, jobject obj) +static void CloseIdleConnections(JNIEnv* env, jobject obj, jint nativeClass) { #if USE(CHROME_NETWORK_STACK) WebCache::get(true)->closeIdleConnections(); @@ -4527,11 +4560,12 @@ static void CloseIdleConnections(JNIEnv* env, jobject obj) #endif } -static void ScrollRenderLayer(JNIEnv* env, jobject obj, jint layer, jobject jRect) +static void ScrollRenderLayer(JNIEnv* env, jobject obj, jint nativeClass, + jint layer, jobject jRect) { SkRect rect; GraphicsJNI::jrect_to_rect(env, jRect, &rect); - GET_NATIVE_VIEW(env, obj)->scrollRenderLayer(layer, rect); + reinterpret_cast<WebViewCore*>(nativeClass)->scrollRenderLayer(layer, rect); } // ---------------------------------------------------------------------------- @@ -4540,115 +4574,115 @@ static void ScrollRenderLayer(JNIEnv* env, jobject obj, jint layer, jobject jRec * JNI registration. */ static JNINativeMethod gJavaWebViewCoreMethods[] = { - { "nativeClearContent", "()V", + { "nativeClearContent", "(I)V", (void*) ClearContent }, - { "nativeFocusBoundsChanged", "()Z", + { "nativeFocusBoundsChanged", "(I)Z", (void*) FocusBoundsChanged } , - { "nativeKey", "(IIIZZZZ)Z", + { "nativeKey", "(IIIIZZZZ)Z", (void*) Key }, - { "nativeClick", "(IIZ)V", + { "nativeClick", "(IIIZ)V", (void*) Click }, - { "nativeContentInvalidateAll", "()V", + { "nativeContentInvalidateAll", "(I)V", (void*) ContentInvalidateAll }, - { "nativeSendListBoxChoices", "([ZI)V", + { "nativeSendListBoxChoices", "(I[ZI)V", (void*) SendListBoxChoices }, - { "nativeSendListBoxChoice", "(I)V", + { "nativeSendListBoxChoice", "(II)V", (void*) SendListBoxChoice }, - { "nativeSetSize", "(IIIFIIIIZ)V", + { "nativeSetSize", "(IIIIFIIIIZ)V", (void*) SetSize }, - { "nativeSetScrollOffset", "(IZII)V", + { "nativeSetScrollOffset", "(IIZII)V", (void*) SetScrollOffset }, - { "nativeSetGlobalBounds", "(IIII)V", + { "nativeSetGlobalBounds", "(IIIII)V", (void*) SetGlobalBounds }, - { "nativeSetSelection", "(II)V", + { "nativeSetSelection", "(III)V", (void*) SetSelection } , - { "nativeModifySelection", "(II)Ljava/lang/String;", + { "nativeModifySelection", "(III)Ljava/lang/String;", (void*) ModifySelection }, - { "nativeDeleteSelection", "(III)V", + { "nativeDeleteSelection", "(IIII)V", (void*) DeleteSelection } , - { "nativeReplaceTextfieldText", "(IILjava/lang/String;III)V", + { "nativeReplaceTextfieldText", "(IIILjava/lang/String;III)V", (void*) ReplaceTextfieldText } , - { "nativeMoveFocus", "(II)V", + { "nativeMoveFocus", "(III)V", (void*) MoveFocus }, - { "nativeMoveMouse", "(III)V", + { "nativeMoveMouse", "(IIII)V", (void*) MoveMouse }, - { "nativeMoveMouseIfLatest", "(IIII)V", + { "nativeMoveMouseIfLatest", "(IIIII)V", (void*) MoveMouseIfLatest }, - { "passToJs", "(ILjava/lang/String;IIZZZZ)V", + { "passToJs", "(IILjava/lang/String;IIZZZZ)V", (void*) PassToJs }, - { "nativeScrollFocusedTextInput", "(FI)V", + { "nativeScrollFocusedTextInput", "(IFI)V", (void*) ScrollFocusedTextInput }, - { "nativeSetFocusControllerActive", "(Z)V", + { "nativeSetFocusControllerActive", "(IZ)V", (void*) SetFocusControllerActive }, - { "nativeSaveDocumentState", "(I)V", + { "nativeSaveDocumentState", "(II)V", (void*) SaveDocumentState }, { "nativeFindAddress", "(Ljava/lang/String;Z)Ljava/lang/String;", (void*) FindAddress }, - { "nativeHandleTouchEvent", "(I[I[I[IIII)Z", + { "nativeHandleTouchEvent", "(II[I[I[IIII)Z", (void*) HandleTouchEvent }, - { "nativeTouchUp", "(IIIII)V", + { "nativeTouchUp", "(IIIIII)V", (void*) TouchUp }, - { "nativeRetrieveHref", "(II)Ljava/lang/String;", + { "nativeRetrieveHref", "(III)Ljava/lang/String;", (void*) RetrieveHref }, - { "nativeRetrieveAnchorText", "(II)Ljava/lang/String;", + { "nativeRetrieveAnchorText", "(III)Ljava/lang/String;", (void*) RetrieveAnchorText }, - { "nativeRetrieveImageSource", "(II)Ljava/lang/String;", + { "nativeRetrieveImageSource", "(III)Ljava/lang/String;", (void*) RetrieveImageSource }, - { "nativeStopPaintingCaret", "()V", + { "nativeStopPaintingCaret", "(I)V", (void*) StopPaintingCaret }, - { "nativeUpdateFrameCache", "()V", + { "nativeUpdateFrameCache", "(I)V", (void*) UpdateFrameCache }, - { "nativeGetContentMinPrefWidth", "()I", + { "nativeGetContentMinPrefWidth", "(I)I", (void*) GetContentMinPrefWidth }, { "nativeUpdateLayers", "(II)Z", (void*) UpdateLayers }, { "nativeNotifyAnimationStarted", "(I)V", (void*) NotifyAnimationStarted }, - { "nativeRecordContent", "(Landroid/graphics/Region;Landroid/graphics/Point;)I", + { "nativeRecordContent", "(ILandroid/graphics/Region;Landroid/graphics/Point;)I", (void*) RecordContent }, - { "setViewportSettingsFromNative", "()V", + { "setViewportSettingsFromNative", "(I)V", (void*) SetViewportSettingsFromNative }, - { "nativeSplitContent", "(I)V", + { "nativeSplitContent", "(II)V", (void*) SplitContent }, - { "nativeSetBackgroundColor", "(I)V", + { "nativeSetBackgroundColor", "(II)V", (void*) SetBackgroundColor }, - { "nativeRegisterURLSchemeAsLocal", "(Ljava/lang/String;)V", + { "nativeRegisterURLSchemeAsLocal", "(ILjava/lang/String;)V", (void*) RegisterURLSchemeAsLocal }, - { "nativeDumpDomTree", "(Z)V", + { "nativeDumpDomTree", "(IZ)V", (void*) DumpDomTree }, - { "nativeDumpRenderTree", "(Z)V", + { "nativeDumpRenderTree", "(IZ)V", (void*) DumpRenderTree }, - { "nativeDumpNavTree", "()V", + { "nativeDumpNavTree", "(I)V", (void*) DumpNavTree }, - { "nativeSetNewStorageLimit", "(J)V", + { "nativeSetNewStorageLimit", "(IJ)V", (void*) SetNewStorageLimit }, - { "nativeGeolocationPermissionsProvide", "(Ljava/lang/String;ZZ)V", + { "nativeGeolocationPermissionsProvide", "(ILjava/lang/String;ZZ)V", (void*) GeolocationPermissionsProvide }, - { "nativeSetIsPaused", "(Z)V", (void*) SetIsPaused }, - { "nativePause", "()V", (void*) Pause }, - { "nativeResume", "()V", (void*) Resume }, - { "nativeFreeMemory", "()V", (void*) FreeMemory }, - { "nativeSetJsFlags", "(Ljava/lang/String;)V", (void*) SetJsFlags }, - { "nativeRequestLabel", "(II)Ljava/lang/String;", + { "nativeSetIsPaused", "(IZ)V", (void*) SetIsPaused }, + { "nativePause", "(I)V", (void*) Pause }, + { "nativeResume", "(I)V", (void*) Resume }, + { "nativeFreeMemory", "(I)V", (void*) FreeMemory }, + { "nativeSetJsFlags", "(ILjava/lang/String;)V", (void*) SetJsFlags }, + { "nativeRequestLabel", "(III)Ljava/lang/String;", (void*) RequestLabel }, - { "nativeRevealSelection", "()V", (void*) RevealSelection }, - { "nativeUpdateFrameCacheIfLoading", "()V", + { "nativeRevealSelection", "(I)V", (void*) RevealSelection }, + { "nativeUpdateFrameCacheIfLoading", "(I)V", (void*) UpdateFrameCacheIfLoading }, - { "nativeProvideVisitedHistory", "([Ljava/lang/String;)V", + { "nativeProvideVisitedHistory", "(I[Ljava/lang/String;)V", (void*) ProvideVisitedHistory }, - { "nativeFullScreenPluginHidden", "(I)V", + { "nativeFullScreenPluginHidden", "(II)V", (void*) FullScreenPluginHidden }, - { "nativePluginSurfaceReady", "()V", + { "nativePluginSurfaceReady", "(I)V", (void*) PluginSurfaceReady }, - { "nativeValidNodeAndBounds", "(IILandroid/graphics/Rect;)Z", + { "nativeValidNodeAndBounds", "(IIILandroid/graphics/Rect;)Z", (void*) ValidNodeAndBounds }, - { "nativeGetTouchHighlightRects", "(III)Ljava/util/ArrayList;", + { "nativeGetTouchHighlightRects", "(IIII)Ljava/util/ArrayList;", (void*) GetTouchHighlightRects }, - { "nativeAutoFillForm", "(I)V", + { "nativeAutoFillForm", "(II)V", (void*) AutoFillForm }, - { "nativeScrollLayer", "(ILandroid/graphics/Rect;)V", + { "nativeScrollLayer", "(IILandroid/graphics/Rect;)V", (void*) ScrollRenderLayer }, - { "nativeCloseIdleConnections", "()V", + { "nativeCloseIdleConnections", "(I)V", (void*) CloseIdleConnections }, }; diff --git a/Source/WebKit/android/nav/CacheBuilder.cpp b/Source/WebKit/android/nav/CacheBuilder.cpp index e64717b..e943101 100644 --- a/Source/WebKit/android/nav/CacheBuilder.cpp +++ b/Source/WebKit/android/nav/CacheBuilder.cpp @@ -1588,85 +1588,189 @@ static bool isUnicodeSpace(UChar ch) static bool validZip(int stateIndex, const UChar* zipPtr) { - static const struct { - char mLow; - char mHigh; - char mException1; - char mException2; - } zipRange[] = { - { 99, 99, -1, -1 }, // AK Alaska - { 35, 36, -1, -1 }, // AL Alabama - { 71, 72, -1, -1 }, // AR Arkansas - { 96, 96, -1, -1 }, // AS American Samoa - { 85, 86, -1, -1 }, // AZ Arizona - { 90, 96, -1, -1 }, // CA California - { 80, 81, -1, -1 }, // CO Colorado - { 6, 6, -1, -1 }, // CT Connecticut - { 20, 20, -1, -1 }, // DC District of Columbia - { 19, 19, -1, -1 }, // DE Delaware - { 32, 34, -1, -1 }, // FL Florida - { 96, 96, -1, -1 }, // FM Federated States of Micronesia - { 30, 31, -1, -1 }, // GA Georgia - { 96, 96, -1, -1 }, // GU Guam - { 96, 96, -1, -1 }, // HI Hawaii - { 50, 52, -1, -1 }, // IA Iowa - { 83, 83, -1, -1 }, // ID Idaho - { 60, 62, -1, -1 }, // IL Illinois - { 46, 47, -1, -1 }, // IN Indiana - { 66, 67, 73, -1 }, // KS Kansas - { 40, 42, -1, -1 }, // KY Kentucky - { 70, 71, -1, -1 }, // LA Louisiana - { 1, 2, -1, -1 }, // MA Massachusetts - { 20, 21, -1, -1 }, // MD Maryland - { 3, 4, -1, -1 }, // ME Maine - { 96, 96, -1, -1 }, // MH Marshall Islands - { 48, 49, -1, -1 }, // MI Michigan - { 55, 56, -1, -1 }, // MN Minnesota - { 63, 65, -1, -1 }, // MO Missouri - { 96, 96, -1, -1 }, // MP Northern Mariana Islands - { 38, 39, -1, -1 }, // MS Mississippi - { 55, 56, -1, -1 }, // MT Montana - { 27, 28, -1, -1 }, // NC North Carolina - { 58, 58, -1, -1 }, // ND North Dakota - { 68, 69, -1, -1 }, // NE Nebraska - { 3, 4, -1, -1 }, // NH New Hampshire - { 7, 8, -1, -1 }, // NJ New Jersey - { 87, 88, 86, -1 }, // NM New Mexico - { 88, 89, 96, -1 }, // NV Nevada - { 10, 14, 0, 6 }, // NY New York - { 43, 45, -1, -1 }, // OH Ohio - { 73, 74, -1, -1 }, // OK Oklahoma - { 97, 97, -1, -1 }, // OR Oregon - { 15, 19, -1, -1 }, // PA Pennsylvania - { 6, 6, 0, 9 }, // PR Puerto Rico - { 96, 96, -1, -1 }, // PW Palau - { 2, 2, -1, -1 }, // RI Rhode Island - { 29, 29, -1, -1 }, // SC South Carolina - { 57, 57, -1, -1 }, // SD South Dakota - { 37, 38, -1, -1 }, // TN Tennessee - { 75, 79, 87, 88 }, // TX Texas - { 84, 84, -1, -1 }, // UT Utah - { 22, 24, 20, -1 }, // VA Virginia - { 6, 9, -1, -1 }, // VI Virgin Islands - { 5, 5, -1, -1 }, // VT Vermont - { 98, 99, -1, -1 }, // WA Washington - { 53, 54, -1, -1 }, // WI Wisconsin - { 24, 26, -1, -1 }, // WV West Virginia - { 82, 83, -1, -1 } // WY Wyoming + enum USState { + AP = -4, // AP (military base in the Pacific) + AA = -3, // AA (military base inside the US) + AE = -2, // AE (military base outside the US) + XX = -1, // (not in use) + AK = 0, // AK Alaska + AL = 1, // AL Alabama + AR = 2, // AR Arkansas + AS = 3, // AS American Samoa + AZ = 4, // AZ Arizona + CA = 5, // CA California + CO = 6, // CO Colorado + CT = 7, // CT Connecticut + DC = 8, // DC District of Columbia + DE = 9, // DE Delaware + FL = 10, // FL Florida + FM = 11, // FM Federated States of Micronesia + GA = 12, // GA Georgia + GU = 13, // GU Guam + HI = 14, // HI Hawaii + IA = 15, // IA Iowa + ID = 16, // ID Idaho + IL = 17, // IL Illinois + IN = 18, // IN Indiana + KS = 19, // KS Kansas + KY = 20, // KY Kentucky + LA = 21, // LA Louisiana + MA = 22, // MA Massachusetts + MD = 23, // MD Maryland + ME = 24, // ME Maine + MH = 25, // MH Marshall Islands + MI = 26, // MI Michigan + MN = 27, // MN Minnesota + MO = 28, // MO Missouri + MP = 29, // MP Northern Mariana Islands + MS = 30, // MS Mississippi + MT = 31, // MT Montana + NC = 32, // NC North Carolina + ND = 33, // ND North Dakota + NE = 34, // NE Nebraska + NH = 35, // NH New Hampshire + NJ = 36, // NJ New Jersey + NM = 37, // NM New Mexico + NV = 38, // NV Nevada + NY = 39, // NY New York + OH = 40, // OH Ohio + OK = 41, // OK Oklahoma + OR = 42, // OR Oregon + PA = 43, // PA Pennsylvania + PR = 44, // PR Puerto Rico + PW = 45, // PW Palau + RI = 46, // RI Rhode Island + SC = 47, // SC South Carolina + SD = 48, // SD South Dakota + TN = 49, // TN Tennessee + TX = 50, // TX Texas + UT = 51, // UT Utah + VA = 52, // VA Virginia + VI = 53, // VI Virgin Islands + VT = 54, // VT Vermont + WA = 55, // WA Washington + WI = 56, // WI Wisconsin + WV = 57, // WV West Virginia + WY = 58, // WY Wyoming }; + static const USState stateForZipPrefix[] = { + // 0 1 2 3 4 5 6 7 8 9 + XX, XX, XX, XX, XX, NY, PR, PR, VI, PR, // 000-009 + MA, MA, MA, MA, MA, MA, MA, MA, MA, MA, // 010-019 + MA, MA, MA, MA, MA, MA, MA, MA, RI, RI, // 020-029 + NH, NH, NH, NH, NH, NH, NH, NH, NH, ME, // 030-039 + ME, ME, ME, ME, ME, ME, ME, ME, ME, ME, // 040-049 + VT, VT, VT, VT, VT, MA, VT, VT, VT, VT, // 050-059 + CT, CT, CT, CT, CT, CT, CT, CT, CT, CT, // 060-069 + NJ, NJ, NJ, NJ, NJ, NJ, NJ, NJ, NJ, NJ, // 070-079 + NJ, NJ, NJ, NJ, NJ, NJ, NJ, NJ, NJ, NJ, // 080-089 + AE, AE, AE, AE, AE, AE, AE, AE, AE, XX, // 090-099 + NY, NY, NY, NY, NY, NY, NY, NY, NY, NY, // 100-109 + NY, NY, NY, NY, NY, NY, NY, NY, NY, NY, // 110-119 + NY, NY, NY, NY, NY, NY, NY, NY, NY, NY, // 120-129 + NY, NY, NY, NY, NY, NY, NY, NY, NY, NY, // 130-139 + NY, NY, NY, NY, NY, NY, NY, NY, NY, NY, // 140-149 + PA, PA, PA, PA, PA, PA, PA, PA, PA, PA, // 150-159 + PA, PA, PA, PA, PA, PA, PA, PA, PA, PA, // 160-169 + PA, PA, PA, PA, PA, PA, PA, PA, PA, PA, // 170-179 + PA, PA, PA, PA, PA, PA, PA, PA, PA, PA, // 180-189 + PA, PA, PA, PA, PA, PA, PA, DE, DE, DE, // 190-199 + DC, VA, DC, DC, DC, DC, MD, MD, MD, MD, // 200-209 + MD, MD, MD, XX, MD, MD, MD, MD, MD, MD, // 210-219 + VA, VA, VA, VA, VA, VA, VA, VA, VA, VA, // 220-229 + VA, VA, VA, VA, VA, VA, VA, VA, VA, VA, // 230-239 + VA, VA, VA, VA, VA, VA, VA, WV, WV, WV, // 240-249 + WV, WV, WV, WV, WV, WV, WV, WV, WV, WV, // 250-259 + WV, WV, WV, WV, WV, WV, WV, WV, WV, XX, // 260-269 + NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, // 270-279 + NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, // 280-289 + SC, SC, SC, SC, SC, SC, SC, SC, SC, SC, // 290-299 + GA, GA, GA, GA, GA, GA, GA, GA, GA, GA, // 300-309 + GA, GA, GA, GA, GA, GA, GA, GA, GA, GA, // 310-319 + FL, FL, FL, FL, FL, FL, FL, FL, FL, FL, // 320-329 + FL, FL, FL, FL, FL, FL, FL, FL, FL, FL, // 330-339 + AA, FL, FL, XX, FL, XX, FL, FL, XX, FL, // 340-349 + AL, AL, AL, XX, AL, AL, AL, AL, AL, AL, // 350-359 + AL, AL, AL, AL, AL, AL, AL, AL, AL, AL, // 360-369 + TN, TN, TN, TN, TN, TN, TN, TN, TN, TN, // 370-379 + TN, TN, TN, TN, TN, TN, MS, MS, MS, MS, // 380-389 + MS, MS, MS, MS, MS, MS, MS, MS, GA, GA, // 390-399 + KY, KY, KY, KY, KY, KY, KY, KY, KY, KY, // 400-409 + KY, KY, KY, KY, KY, KY, KY, KY, KY, XX, // 410-419 + KY, KY, KY, KY, KY, KY, KY, KY, XX, XX, // 420-429 + OH, OH, OH, OH, OH, OH, OH, OH, OH, OH, // 430-439 + OH, OH, OH, OH, OH, OH, OH, OH, OH, OH, // 440-449 + OH, OH, OH, OH, OH, OH, OH, OH, OH, OH, // 450-459 + IN, IN, IN, IN, IN, IN, IN, IN, IN, IN, // 460-469 + IN, IN, IN, IN, IN, IN, IN, IN, IN, IN, // 470-479 + MI, MI, MI, MI, MI, MI, MI, MI, MI, MI, // 480-489 + MI, MI, MI, MI, MI, MI, MI, MI, MI, MI, // 490-499 + IA, IA, IA, IA, IA, IA, IA, IA, IA, IA, // 500-509 + IA, IA, IA, IA, IA, IA, IA, XX, XX, XX, // 510-519 + IA, IA, IA, IA, IA, IA, IA, IA, IA, XX, // 520-529 + WI, WI, WI, XX, WI, WI, XX, WI, WI, WI, // 530-539 + WI, WI, WI, WI, WI, WI, WI, WI, WI, WI, // 540-549 + MN, MN, XX, MN, MN, MN, MN, MN, MN, MN, // 550-559 + MN, MN, MN, MN, MN, MN, MN, MN, XX, DC, // 560-569 + SD, SD, SD, SD, SD, SD, SD, SD, XX, XX, // 570-579 + ND, ND, ND, ND, ND, ND, ND, ND, ND, XX, // 580-589 + MT, MT, MT, MT, MT, MT, MT, MT, MT, MT, // 590-599 + IL, IL, IL, IL, IL, IL, IL, IL, IL, IL, // 600-609 + IL, IL, IL, IL, IL, IL, IL, IL, IL, IL, // 610-619 + IL, XX, IL, IL, IL, IL, IL, IL, IL, IL, // 620-629 + MO, MO, XX, MO, MO, MO, MO, MO, MO, MO, // 630-639 + MO, MO, XX, XX, MO, MO, MO, MO, MO, MO, // 640-649 + MO, MO, MO, MO, MO, MO, MO, MO, MO, XX, // 650-659 + KS, KS, KS, XX, KS, KS, KS, KS, KS, KS, // 660-669 + KS, KS, KS, KS, KS, KS, KS, KS, KS, KS, // 670-679 + NE, NE, XX, NE, NE, NE, NE, NE, NE, NE, // 680-689 + NE, NE, NE, NE, XX, XX, XX, XX, XX, XX, // 690-699 + LA, LA, XX, LA, LA, LA, LA, LA, LA, XX, // 700-709 + LA, LA, LA, LA, LA, XX, AR, AR, AR, AR, // 710-719 + AR, AR, AR, AR, AR, AR, AR, AR, AR, AR, // 720-729 + OK, OK, XX, TX, OK, OK, OK, OK, OK, OK, // 730-739 + OK, OK, XX, OK, OK, OK, OK, OK, OK, OK, // 740-749 + TX, TX, TX, TX, TX, TX, TX, TX, TX, TX, // 750-759 + TX, TX, TX, TX, TX, TX, TX, TX, TX, TX, // 760-769 + TX, XX, TX, TX, TX, TX, TX, TX, TX, TX, // 770-779 + TX, TX, TX, TX, TX, TX, TX, TX, TX, TX, // 780-789 + TX, TX, TX, TX, TX, TX, TX, TX, TX, TX, // 790-799 + CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, // 800-809 + CO, CO, CO, CO, CO, CO, CO, XX, XX, XX, // 810-819 + WY, WY, WY, WY, WY, WY, WY, WY, WY, WY, // 820-829 + WY, WY, ID, ID, ID, ID, ID, ID, ID, XX, // 830-839 + UT, UT, UT, UT, UT, UT, UT, UT, XX, XX, // 840-849 + AZ, AZ, AZ, AZ, XX, AZ, AZ, AZ, XX, AZ, // 850-859 + AZ, XX, XX, AZ, AZ, AZ, XX, XX, XX, XX, // 860-869 + NM, NM, NM, NM, NM, NM, XX, NM, NM, NM, // 870-879 + NM, NM, NM, NM, NM, TX, XX, XX, XX, NV, // 880-889 + NV, NV, XX, NV, NV, NV, XX, NV, NV, XX, // 890-899 + CA, CA, CA, CA, CA, CA, CA, CA, CA, XX, // 900-909 + CA, CA, CA, CA, CA, CA, CA, CA, CA, CA, // 910-919 + CA, CA, CA, CA, CA, CA, CA, CA, CA, XX, // 920-929 + CA, CA, CA, CA, CA, CA, CA, CA, CA, CA, // 930-939 + CA, CA, CA, CA, CA, CA, CA, CA, CA, CA, // 940-949 + CA, CA, CA, CA, CA, CA, CA, CA, CA, CA, // 950-959 + CA, CA, AP, AP, AP, AP, AP, HI, HI, GU, // 960-969 + OR, OR, OR, OR, OR, OR, OR, OR, OR, OR, // 970-979 + WA, WA, WA, WA, WA, WA, WA, XX, WA, WA, // 980-989 + WA, WA, WA, WA, WA, AK, AK, AK, AK, AK, // 990-999 + }; + + if (!zipPtr || !zipPtr[0] || !zipPtr[1] || !zipPtr[2]) + return false; + if (zipPtr[0] < '0' || zipPtr[0] > '9' || + zipPtr[1] < '0' || zipPtr[1] > '9' || + zipPtr[2] < '0' || zipPtr[2] > '9') + return false; + int zip = zipPtr[0] - '0'; zip *= 10; zip += zipPtr[1] - '0'; - int low = zipRange[stateIndex].mLow; - int high = zipRange[stateIndex].mHigh; - if (zip >= low && zip <= high) - return true; - if (zip == zipRange[stateIndex].mException1) - return true; - if (zip == zipRange[stateIndex].mException2) - return true; - return false; + zip *= 10; + zip += zipPtr[2] - '0'; + return stateForZipPrefix[zip] == stateIndex; } #define MAX_PLACE_NAME_LENGTH 25 // the longest allowable one word place name diff --git a/Source/WebKit/android/nav/CachedDebug.h b/Source/WebKit/android/nav/CachedDebug.h index f77c07a..c78254e 100644 --- a/Source/WebKit/android/nav/CachedDebug.h +++ b/Source/WebKit/android/nav/CachedDebug.h @@ -31,9 +31,9 @@ #define DEBUG_NAV_UI_VERBOSE 0 #if DEBUG_NAV_UI -#define DBG_NAV_LOG(message) LOGD("%s %s", __FUNCTION__, message) -#define DBG_NAV_LOGD(format, ...) LOGD("%s " format, __FUNCTION__, __VA_ARGS__) -#define DEBUG_NAV_UI_LOGD(...) LOGD(__VA_ARGS__) +#define DBG_NAV_LOG(message) ALOGD("%s %s", __FUNCTION__, message) +#define DBG_NAV_LOGD(format, ...) ALOGD("%s " format, __FUNCTION__, __VA_ARGS__) +#define DEBUG_NAV_UI_LOGD(...) ALOGD(__VA_ARGS__) #else #define DBG_NAV_LOG(message) ((void)0) #define DBG_NAV_LOGD(format, ...) ((void)0) @@ -41,7 +41,7 @@ #endif #if DEBUG_NAV_UI_VERBOSE -#define DBG_NAV_LOGV(format, ...) LOGD("%s " format, __FUNCTION__, __VA_ARGS__) +#define DBG_NAV_LOGV(format, ...) ALOGD("%s " format, __FUNCTION__, __VA_ARGS__) #else #define DBG_NAV_LOGV(format, ...) ((void)0) #endif @@ -56,13 +56,13 @@ extern FILE* gNavCacheLogFile; #define NAV_CACHE_LOG_FILE "/data/data/com.android.browser/navlog" #define DUMP_NAV_LOGD(...) do { if (gNavCacheLogFile) \ - fprintf(gNavCacheLogFile, __VA_ARGS__); else LOGD(__VA_ARGS__); } while (false) + fprintf(gNavCacheLogFile, __VA_ARGS__); else ALOGD(__VA_ARGS__); } while (false) #define DUMP_NAV_LOGX(format, ...) do { if (gNavCacheLogFile) \ fprintf(gNavCacheLogFile, format, __VA_ARGS__); \ - else LOGD("%s " format, __FUNCTION__, __VA_ARGS__); } while (false) + else ALOGD("%s " format, __FUNCTION__, __VA_ARGS__); } while (false) #else -#define DUMP_NAV_LOGD(...) LOGD(__VA_ARGS__) -#define DUMP_NAV_LOGX(format, ...) LOGD("%s " format, __FUNCTION__, __VA_ARGS__) +#define DUMP_NAV_LOGD(...) ALOGD(__VA_ARGS__) +#define DUMP_NAV_LOGX(format, ...) ALOGD("%s " format, __FUNCTION__, __VA_ARGS__) #endif #else #define DUMP_NAV_LOGD(...) ((void)0) diff --git a/Source/WebKit/android/nav/CachedNode.cpp b/Source/WebKit/android/nav/CachedNode.cpp index e500875..e291504 100644 --- a/Source/WebKit/android/nav/CachedNode.cpp +++ b/Source/WebKit/android/nav/CachedNode.cpp @@ -132,7 +132,7 @@ void CachedNode::fixUpCursorRects(const CachedFrame* frame) WebCore::IntRect* boundsPtr = mCursorRing.begin() - 1; const WebCore::IntRect* const boundsEnd = mCursorRing.begin() + mCursorRing.size(); while (++boundsPtr < boundsEnd) - LOGD("%s %d:(%d, %d, %d, %d)\n", __FUNCTION__, boundsPtr - mCursorRing.begin(), + ALOGD("%s %d:(%d, %d, %d, %d)\n", __FUNCTION__, boundsPtr - mCursorRing.begin(), boundsPtr->x(), boundsPtr->y(), boundsPtr->width(), boundsPtr->height()); } #endif @@ -205,7 +205,7 @@ void CachedNode::fixUpCursorRects(const CachedFrame* frame) candidateRight - candidateLeft, candidateBottom - candidateTop); ASSERT(candidate.isEmpty() == false); #if DEBUG_NAV_UI - LOGD("%s %d:(%d, %d, %d, %d)\n", __FUNCTION__, mCursorRing.size(), + ALOGD("%s %d:(%d, %d, %d, %d)\n", __FUNCTION__, mCursorRing.size(), candidate.x(), candidate.y(), candidate.width(), candidate.height()); #endif mCursorRing.append(candidate); diff --git a/Source/WebKit/android/nav/FindCanvas.cpp b/Source/WebKit/android/nav/FindCanvas.cpp index ca3cfba..1ae4f9b 100644 --- a/Source/WebKit/android/nav/FindCanvas.cpp +++ b/Source/WebKit/android/nav/FindCanvas.cpp @@ -495,7 +495,7 @@ void FindCanvas::insertMatchInfo(const SkRegion& region) { mWorkingPicture->endRecording(); MatchInfo matchInfo; mMatches->append(matchInfo); - LOGD("%s region=%p pict=%p layer=%d", __FUNCTION__, + ALOGD("%s region=%p pict=%p layer=%d", __FUNCTION__, ®ion, mWorkingPicture, mLayerId); mMatches->last().set(region, mWorkingPicture, mLayerId); } diff --git a/Source/WebKit/android/nav/SelectText.cpp b/Source/WebKit/android/nav/SelectText.cpp index d20c44a..2035fbb 100644 --- a/Source/WebKit/android/nav/SelectText.cpp +++ b/Source/WebKit/android/nav/SelectText.cpp @@ -52,7 +52,7 @@ // #define EXTRA_NOISY_LOGGING 1 #define DEBUG_TOUCH_HANDLES 0 #if DEBUG_TOUCH_HANDLES -#define DBG_HANDLE_LOG(format, ...) LOGD("%s " format, __FUNCTION__, __VA_ARGS__) +#define DBG_HANDLE_LOG(format, ...) ALOGD("%s " format, __FUNCTION__, __VA_ARGS__) #else #define DBG_HANDLE_LOG(...) #endif diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp index 7861205..70b7e6e 100644 --- a/Source/WebKit/android/nav/WebView.cpp +++ b/Source/WebKit/android/nav/WebView.cpp @@ -2373,7 +2373,7 @@ static jint nativeGetBlockLeftEdge(JNIEnv *env, jobject obj, jint x, jint y, static void nativeDestroy(JNIEnv *env, jobject obj) { WebView* view = GET_NATIVE_VIEW(env, obj); - LOGD("nativeDestroy view: %p", view); + ALOGD("nativeDestroy view: %p", view); LOG_ASSERT(view, "view not set in nativeDestroy"); delete view; } diff --git a/Source/WebKit/android/wds/Command.cpp b/Source/WebKit/android/wds/Command.cpp index bd8536f..1a365e5 100644 --- a/Source/WebKit/android/wds/Command.cpp +++ b/Source/WebKit/android/wds/Command.cpp @@ -95,7 +95,7 @@ public: virtual ~InternalCommand() { delete m_connection; } void doCommand() const { - LOGD("Executing command '%s' (%s)", m_name, m_description); + ALOGD("Executing command '%s' (%s)", m_name, m_description); if (!m_dispatch(m_frame, m_connection)) // XXX: Have useful failure messages m_connection->write("EPIC FAIL!\n", 11); diff --git a/Source/WebKit/android/wds/DebugServer.cpp b/Source/WebKit/android/wds/DebugServer.cpp index f33a65b..494a634 100644 --- a/Source/WebKit/android/wds/DebugServer.cpp +++ b/Source/WebKit/android/wds/DebugServer.cpp @@ -70,7 +70,7 @@ DebugServer::DebugServer() { char buf[PROPERTY_VALUE_MAX]; int ret = property_get("webcore.wds.enable", buf, NULL); if (ret != -1 && strcmp(buf, "1") == 0) { - LOGD("WDS Enabled"); + ALOGD("WDS Enabled"); m_threadId = createThread(mainThread, this, "WDS"); } // Initialize the available commands. @@ -78,7 +78,7 @@ DebugServer::DebugServer() { } void DebugServer::start() { - LOGD("DebugServer thread started"); + ALOGD("DebugServer thread started"); ConnectionServer cs; if (!cs.connect(DEFAULT_PORT)) { @@ -87,13 +87,13 @@ void DebugServer::start() { } while (true ) { - LOGD("Waiting for incoming connections..."); + ALOGD("Waiting for incoming connections..."); Connection* conn = cs.accept(); if (!conn) { log_errno("Failed to accept new connections"); return; } - LOGD("...Connection established"); + ALOGD("...Connection established"); Command* c = Command::Find(conn); if (!c) { @@ -106,7 +106,7 @@ void DebugServer::start() { } } - LOGD("DebugServer thread finished"); + ALOGD("DebugServer thread finished"); } } // end namespace WDS |
