diff options
author | Derek Sollenberger <djsollen@google.com> | 2010-04-08 07:57:13 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-04-08 07:57:13 -0700 |
commit | 44422737e4fa3be5ac62ab1b9de64b2977740b60 (patch) | |
tree | 5d63f85b7331074422c951183877199a17ab261b | |
parent | 9010bbc57dfd097175436f7e00bbbaffbe2fa9d6 (diff) | |
parent | b60bbcfbd2d5c108a2208373756f2790bea08c68 (diff) | |
download | external_webkit-44422737e4fa3be5ac62ab1b9de64b2977740b60.zip external_webkit-44422737e4fa3be5ac62ab1b9de64b2977740b60.tar.gz external_webkit-44422737e4fa3be5ac62ab1b9de64b2977740b60.tar.bz2 |
am b60bbcfb: am 18f501d6: Fix bug that causes plugins not be notified of the change to the visible screen dimensions as a result of pinch to zoom.
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 8dc58d2..9c64566 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -1220,37 +1220,37 @@ void WebViewCore::setSizeScreenWidthAndScale(int width, int height, r->setNeedsLayoutAndPrefWidthsRecalc(); m_mainFrame->view()->forceLayout(); // scroll to restore current screen center - if (!node) - return; - const WebCore::IntRect& newBounds = node->getRect(); - DBG_NAV_LOGD("nb:(x=%d,y=%d,w=%d," - "h=%d)", newBounds.x(), newBounds.y(), - newBounds.width(), newBounds.height()); - if ((orsw && osh && bounds.width() && bounds.height()) - && (bounds != newBounds)) { - WebCore::FrameView* view = m_mainFrame->view(); - // force left align if width is not changed while height changed. - // the anchorPoint is probably at some white space in the node - // which is affected by text wrap around the screen width. - const bool leftAlign = (osw != m_screenWidth) - && (bounds.width() == newBounds.width()) - && (bounds.height() != newBounds.height()); - const float xPercentInDoc = - leftAlign ? 0.0 : (float) (anchorX - bounds.x()) / bounds.width(); - const float xPercentInView = - leftAlign ? 0.0 : (float) (anchorX - m_scrollOffsetX) / orsw; - const float yPercentInDoc = (float) (anchorY - bounds.y()) / bounds.height(); - const float yPercentInView = (float) (anchorY - m_scrollOffsetY) / osh; - showRect(newBounds.x(), newBounds.y(), newBounds.width(), - newBounds.height(), view->contentsWidth(), - view->contentsHeight(), - xPercentInDoc, xPercentInView, - yPercentInDoc, yPercentInView); + if (node) { + const WebCore::IntRect& newBounds = node->getRect(); + DBG_NAV_LOGD("nb:(x=%d,y=%d,w=%d," + "h=%d)", newBounds.x(), newBounds.y(), + newBounds.width(), newBounds.height()); + if ((orsw && osh && bounds.width() && bounds.height()) + && (bounds != newBounds)) { + WebCore::FrameView* view = m_mainFrame->view(); + // force left align if width is not changed while height changed. + // the anchorPoint is probably at some white space in the node + // which is affected by text wrap around the screen width. + const bool leftAlign = (osw != m_screenWidth) + && (bounds.width() == newBounds.width()) + && (bounds.height() != newBounds.height()); + const float xPercentInDoc = + leftAlign ? 0.0 : (float) (anchorX - bounds.x()) / bounds.width(); + const float xPercentInView = + leftAlign ? 0.0 : (float) (anchorX - m_scrollOffsetX) / orsw; + const float yPercentInDoc = (float) (anchorY - bounds.y()) / bounds.height(); + const float yPercentInView = (float) (anchorY - m_scrollOffsetY) / osh; + showRect(newBounds.x(), newBounds.y(), newBounds.width(), + newBounds.height(), view->contentsWidth(), + view->contentsHeight(), + xPercentInDoc, xPercentInView, + yPercentInDoc, yPercentInView); + } } } } - // update the currently visible screen + // update the currently visible screen as perceived by the plugin sendPluginVisibleScreen(); } @@ -1528,6 +1528,10 @@ void WebViewCore::notifyPluginsOnFrameLoad(const Frame* frame) { void WebViewCore::sendPluginVisibleScreen() { + /* We may want to cache the previous values and only send the notification + to the plugin in the event that one of the values has changed. + */ + ANPRectI visibleRect; visibleRect.left = m_scrollOffsetX; visibleRect.top = m_scrollOffsetY; |