summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2010-04-08 09:32:17 -0400
committerDerek Sollenberger <djsollen@google.com>2010-04-08 10:25:10 -0400
commit18f501d6904704ce0eff4bfdc68f2ca4aeb66af9 (patch)
tree306dc4b2a6263c8427e4c883015e988403f9ed19
parent0c7363393334265c29401d7f6967347ce7e7f1ae (diff)
downloadexternal_webkit-18f501d6904704ce0eff4bfdc68f2ca4aeb66af9.zip
external_webkit-18f501d6904704ce0eff4bfdc68f2ca4aeb66af9.tar.gz
external_webkit-18f501d6904704ce0eff4bfdc68f2ca4aeb66af9.tar.bz2
Fix bug that causes plugins not be notified of the change to the
visible screen dimensions as a result of pinch to zoom. http://b/2578820 Change-Id: I98576e9937ec469a1dfa7162954ac93e120bc149
-rw-r--r--WebKit/android/jni/WebViewCore.cpp58
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;