diff options
| author | Mike Reed <reed@google.com> | 2009-06-24 13:39:19 -0400 |
|---|---|---|
| committer | Mike Reed <reed@google.com> | 2009-06-24 16:41:52 -0400 |
| commit | 60feb0579c2d9cafa9d48b8d01ccdb7d1173d54d (patch) | |
| tree | baab42d8271d7c13e9f502dabaaec89870eca00f /WebKit | |
| parent | 88cd03d406af27608137117016ebbbbeb7929403 (diff) | |
| download | external_webkit-60feb0579c2d9cafa9d48b8d01ccdb7d1173d54d.zip external_webkit-60feb0579c2d9cafa9d48b8d01ccdb7d1173d54d.tar.gz external_webkit-60feb0579c2d9cafa9d48b8d01ccdb7d1173d54d.tar.bz2 | |
add zoom field to visibleRect event
Diffstat (limited to 'WebKit')
| -rw-r--r-- | WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp | 3 | ||||
| -rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 26 | ||||
| -rw-r--r-- | WebKit/android/jni/WebViewCore.h | 6 | ||||
| -rw-r--r-- | WebKit/android/plugins/android_npapi.h | 6 |
4 files changed, 18 insertions, 23 deletions
diff --git a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp index 0f0509d..2bc8619 100644 --- a/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp +++ b/WebKit/android/WebCoreSupport/FrameLoaderClientAndroid.cpp @@ -704,7 +704,8 @@ void FrameLoaderClientAndroid::saveViewStateToItem(HistoryItem* item) { ASSERT(bridge); // store the current scale (only) for the top frame if (!m_frame->tree()->parent()) { - bridge->setScale(WebViewCore::getWebViewCore(m_frame->view())->scale()); + float scale = WebViewCore::getWebViewCore(m_frame->view())->scale(); + bridge->setScale((int)(scale * 100)); } WebCore::notifyHistoryItemChanged(item); diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 9cf48dd..2e545bf 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -205,7 +205,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m m_maxYScroll = 240/4; m_textGeneration = 0; m_screenWidth = 320; - m_scale = 100; + m_scale = 1; LOG_ASSERT(m_mainFrame, "Uh oh, somehow a frameview was made without an initial frame!"); @@ -906,18 +906,19 @@ void WebViewCore::setGlobalBounds(int x, int y, int h, int v) } void WebViewCore::setSizeScreenWidthAndScale(int width, int height, - int screenWidth, int scale, int realScreenWidth, int screenHeight) + int screenWidth, float scale, int realScreenWidth, int screenHeight) { WebCoreViewBridge* window = m_mainFrame->view()->platformWidget(); int ow = window->width(); int oh = window->height(); window->setSize(width, height); int osw = m_screenWidth; - DBG_NAV_LOGD("old:(w=%d,h=%d,sw=%d,scale=%d) new:(w=%d,h=%d,sw=%d,scale=%d)", + DBG_NAV_LOGD("old:(w=%d,h=%d,sw=%d,scale=%d) new:(w=%d,h=%d,sw=%d,scale=%g)", ow, oh, osw, m_scale, width, height, screenWidth, scale); m_screenWidth = screenWidth; m_screenHeight = screenHeight; - m_scale = scale; + if (scale >= 0) // negative means ignore + m_scale = scale; m_maxXScroll = screenWidth >> 2; m_maxYScroll = (screenWidth * height / width) >> 2; if (ow != width || oh != height || osw != screenWidth) { @@ -970,10 +971,11 @@ void WebViewCore::sendVisibleRectBounds() { ANPEvent event; SkANP::InitEvent(&event, kVisibleRect_ANPEventType); - event.data.visibleRect.x = m_scrollOffsetX; - event.data.visibleRect.y = m_scrollOffsetY; - event.data.visibleRect.width = m_screenWidth; - event.data.visibleRect.height = m_screenHeight; + event.data.visibleRect.rect.left = m_scrollOffsetX; + event.data.visibleRect.rect.top = m_scrollOffsetY; + event.data.visibleRect.rect.right = m_scrollOffsetX + m_screenWidth; + event.data.visibleRect.rect.bottom = m_scrollOffsetY + m_screenHeight; + event.data.visibleRect.zoomScale = m_scale; sendPluginEvent(event, kVisibleRect_ANPEventFlag); } @@ -2001,13 +2003,7 @@ static void SetSize(JNIEnv *env, jobject obj, jint width, jint height, WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); LOGV("webviewcore::nativeSetSize(%u %u)\n viewImpl: %p", (unsigned)width, (unsigned)height, viewImpl); LOG_ASSERT(viewImpl, "viewImpl not set in nativeSetSize"); - // convert the scale to an int - int s = (int) (scale * 100); - // a negative value indicates that we should not change the scale - if (scale < 0) - s = viewImpl->scale(); - - viewImpl->setSizeScreenWidthAndScale(width, height, screenWidth, s, + viewImpl->setSizeScreenWidthAndScale(width, height, screenWidth, scale, realScreenWidth, screenHeight); } diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index 26e3a23..04a78e2 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -205,7 +205,7 @@ namespace android { void setGlobalBounds(int x, int y, int h, int v); void setSizeScreenWidthAndScale(int width, int height, int screenWidth, - int scale, int realScreenWidth, int screenHeight); + float scale, int realScreenWidth, int screenHeight); /** * Handle key events from Java. @@ -316,7 +316,7 @@ namespace android { // record the inval area, and the picture size bool recordContent(SkRegion* , SkIPoint* ); int screenWidth() const { return m_screenWidth; } - int scale() const { return m_scale; } + float scale() const { return m_scale; } WebCore::Frame* mainFrame() const { return m_mainFrame; } // utility to split slow parts of the picture set @@ -393,7 +393,7 @@ namespace android { WebCore::Node* m_snapAnchorNode; int m_screenWidth; // width of the visible rect in document coordinates int m_screenHeight;// height of the visible rect in document coordinates - int m_scale; + float m_scale; unsigned m_domtree_version; bool m_check_domtree_version; diff --git a/WebKit/android/plugins/android_npapi.h b/WebKit/android/plugins/android_npapi.h index 7b703c0..b5f5783 100644 --- a/WebKit/android/plugins/android_npapi.h +++ b/WebKit/android/plugins/android_npapi.h @@ -773,10 +773,8 @@ struct ANPEvent { } data; } draw; struct { - int32_t x; // relative to the document - int32_t y; // relative to the document - int32_t width; - int32_t height; + ANPRectI rect; // in global document coordinates + float zoomScale; // 1.0 means no zoom scale } visibleRect; int32_t other[8]; } data; |
