summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-05 01:52:03 +0000
committerkbr@google.com <kbr@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-05 01:52:03 +0000
commit966a12b2682fa26c12ce9b3d7b19db9003074c8f (patch)
treed0a6e775e7994bbb35f6597acc248634d899a3bd
parentb0b791f9fa3957686dfe4d999b29e3fa3249b9e7 (diff)
downloadchromium_src-966a12b2682fa26c12ce9b3d7b19db9003074c8f.zip
chromium_src-966a12b2682fa26c12ce9b3d7b19db9003074c8f.tar.gz
chromium_src-966a12b2682fa26c12ce9b3d7b19db9003074c8f.tar.bz2
Bug 34167: GPU plugins' output initially placed incorrectly on page
Added call to RenderView::DidMovePlugin upon creating the command buffer so the nested delegate is initially placed properly on the page; thanks to jam for this suggestion. Added necessary accessor to fetch the plugin window handle from the nested delegate, which is the "fake" GPU plugin window handle on Mac OS X. Verified that Pepper 3D test plugin initially shows up in the correct place. BUG=34167 TEST=none (ran Pepper test plugin on Mac and Linux) Review URL: http://codereview.chromium.org/561068 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38164 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/renderer/webplugin_delegate_pepper.cc30
-rw-r--r--chrome/renderer/webplugin_delegate_pepper.h5
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.cc4
-rw-r--r--chrome/renderer/webplugin_delegate_proxy.h1
4 files changed, 40 insertions, 0 deletions
diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc
index 048a796..0858f4a 100644
--- a/chrome/renderer/webplugin_delegate_pepper.cc
+++ b/chrome/renderer/webplugin_delegate_pepper.cc
@@ -377,6 +377,11 @@ NPError WebPluginDelegatePepper::Device3DInitializeContext(
command_buffer_->SetWindowSize(window_rect_.width(),
window_rect_.height());
#endif // OS_MACOSX
+
+ // Make sure the nested delegate shows up in the right place
+ // on the page.
+ SendNestedDelegateGeometryToBrowser(window_rect_, clip_rect_);
+
// Save the implementation information (the CommandBuffer).
Device3DImpl* impl = new Device3DImpl;
impl->command_buffer = command_buffer_.get();
@@ -739,3 +744,28 @@ void WebPluginDelegatePepper::Synchronize3DContext(
context->error = static_cast<NPDeviceContext3DError>(state.error);
}
#endif // ENABLE_GPU
+
+void WebPluginDelegatePepper::SendNestedDelegateGeometryToBrowser(
+ const gfx::Rect& window_rect,
+ const gfx::Rect& clip_rect) {
+ // Inform the browser about the location of the plugin on the page.
+ // It appears that initially the plugin does not get laid out correctly --
+ // possibly due to lazy creation of the nested delegate.
+ if (!nested_delegate_ ||
+ !nested_delegate_->GetPluginWindowHandle() ||
+ !render_view_) {
+ return;
+ }
+
+ webkit_glue::WebPluginGeometry geom;
+ geom.window = nested_delegate_->GetPluginWindowHandle();
+ geom.window_rect = window_rect;
+ geom.clip_rect = clip_rect;
+ // Rects_valid must be true for this to work in the Gtk port;
+ // hopefully not having the cutout rects will not cause incorrect
+ // clipping.
+ geom.rects_valid = true;
+ geom.visible = true;
+ render_view_->DidMovePlugin(geom);
+}
+
diff --git a/chrome/renderer/webplugin_delegate_pepper.h b/chrome/renderer/webplugin_delegate_pepper.h
index 85db1a92..3c203e6 100644
--- a/chrome/renderer/webplugin_delegate_pepper.h
+++ b/chrome/renderer/webplugin_delegate_pepper.h
@@ -194,6 +194,11 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate {
scoped_ptr<CommandBufferProxy> command_buffer_;
#endif
+ // Tells the browser out-of-band where the nested delegate lives on
+ // the page.
+ void SendNestedDelegateGeometryToBrowser(const gfx::Rect& window_rect,
+ const gfx::Rect& clip_rect);
+
// Used to track whether additional commands have been put in the command
// buffer since the last flush.
int32 last_command_buffer_put_offset_;
diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc
index 7059890..2c87077 100644
--- a/chrome/renderer/webplugin_delegate_proxy.cc
+++ b/chrome/renderer/webplugin_delegate_proxy.cc
@@ -1241,6 +1241,10 @@ CommandBufferProxy* WebPluginDelegateProxy::CreateCommandBuffer() {
#endif // ENABLE_GPU
}
+gfx::PluginWindowHandle WebPluginDelegateProxy::GetPluginWindowHandle() {
+ return window_;
+}
+
void WebPluginDelegateProxy::OnCancelDocumentLoad() {
plugin_->CancelDocumentLoad();
}
diff --git a/chrome/renderer/webplugin_delegate_proxy.h b/chrome/renderer/webplugin_delegate_proxy.h
index a56da38..1afbacd9 100644
--- a/chrome/renderer/webplugin_delegate_proxy.h
+++ b/chrome/renderer/webplugin_delegate_proxy.h
@@ -104,6 +104,7 @@ class WebPluginDelegateProxy
unsigned long resource_id, int range_request_id);
CommandBufferProxy* CreateCommandBuffer();
+ gfx::PluginWindowHandle GetPluginWindowHandle();
protected:
template<class WebPluginDelegateProxy> friend class DeleteTask;