Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1832)

Unified Diff: content/renderer/pepper/pepper_plugin_instance_impl.cc

Issue 329033003: Add GetScrollOffset function to PPB_View (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/pepper/pepper_plugin_instance_impl.cc
diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc
index 0811eba1f5d5c7cb0426baa15a1a18be97af67d4..4853e386d6dc1f0a311a754d3e96984e9b06415f 100644
--- a/content/renderer/pepper/pepper_plugin_instance_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc
@@ -1204,6 +1204,18 @@ void PepperPluginInstanceImpl::ViewChanged(
view_data_.css_scale =
container_->pageZoomFactor() * container_->pageScaleFactor();
+ // Only set the scroll offset if the plugin is visible.
dmichael (off chromium) 2014/06/16 22:31:56 Why have this restriction?
raymes 2014/06/17 00:43:00 Originally I had this because I thought we might e
+ if (!view_data_.is_page_visible ||
+ view_data_.clip_rect.size.width == 0 ||
+ view_data_.clip_rect.size.height == 0) {
+ view_data_.scroll_offset = PP_MakePoint(0, 0);
+ } else {
+ gfx::Size scroll_offset =
+ container_->element().document().frame()->scrollOffset();
+ view_data_.scroll_offset = PP_MakePoint(scroll_offset.width(),
+ scroll_offset.height());
+ }
+
if (desired_fullscreen_state_ || view_data_.is_fullscreen) {
WebElement element = container_->element();
WebDocument document = element.document();

Powered by Google App Engine
This is Rietveld 408576698