diff options
author | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-07 00:34:55 +0000 |
---|---|---|
committer | piman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-07 00:34:55 +0000 |
commit | 56fcc3f051d030df1195fc543b93fca550b4e8e0 (patch) | |
tree | a6b3dab85957beb109c1d34e68dc1f0c2a6b6435 /webkit | |
parent | 37095fe7d4408ba30977c59f6f3cb7f985ba34f0 (diff) | |
download | chromium_src-56fcc3f051d030df1195fc543b93fca550b4e8e0.zip chromium_src-56fcc3f051d030df1195fc543b93fca550b4e8e0.tar.gz chromium_src-56fcc3f051d030df1195fc543b93fca550b4e8e0.tar.bz2 |
linux: fix windowless Flash when scrolling
Apparently on linux windowless Flash needs a paint after a NPP_SetWindow, otherwise it cancels its timer to do InvalidateRect.
Also in this change: WebKit calls WebPluginImpl::setFrameRect at each paint, even if the rects haven't changed. That used to always send a message to the plugin process, which is unnecessary (that case is always a no-op in the WebPluginDelegateImpl), so I fixed that too.
BUG=18423
Review URL: http://codereview.chromium.org/159907
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22702 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_gtk.cc | 9 | ||||
-rw-r--r-- | webkit/glue/webplugin_delegate.h | 1 | ||||
-rw-r--r-- | webkit/glue/webplugin_impl.cc | 62 | ||||
-rw-r--r-- | webkit/glue/webplugin_impl.h | 8 |
4 files changed, 48 insertions, 32 deletions
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc index 0e394ce..eb9f963 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl_gtk.cc @@ -74,7 +74,8 @@ WebPluginDelegateImpl::WebPluginDelegateImpl( if (instance_->mime_type() == "application/x-shockwave-flash") { // Flash is tied to Firefox's whacky behavior with windowless plugins. See // comments in WindowlessPaint - quirks_ |= PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW; + quirks_ |= PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW + | PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW; } } @@ -616,6 +617,12 @@ void WebPluginDelegateImpl::WindowlessSetWindow(bool force_set_window) { NPError err = instance()->NPP_SetWindow(&window_); DCHECK(err == NPERR_NO_ERROR); + if (quirks_ & PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW) { + // After a NPP_SetWindow, Flash cancels its timer that generates the + // invalidates until it gets a paint event, but doesn't explicitly call + // NPP_InvalidateRect. + plugin_->InvalidateRect(clip_rect_); + } } void WebPluginDelegateImpl::SetFocus() { diff --git a/webkit/glue/webplugin_delegate.h b/webkit/glue/webplugin_delegate.h index 92e4b42..c4d4005 100644 --- a/webkit/glue/webplugin_delegate.h +++ b/webkit/glue/webplugin_delegate.h @@ -40,6 +40,7 @@ class WebPluginDelegate { PLUGIN_QUIRK_PATCH_SETCURSOR = 64, // Win32 PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 128, // Win32 PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW = 256, // Linux + PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW = 512, // Linux }; WebPluginDelegate() {} diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc index 0fe8fc2..a04be97 100644 --- a/webkit/glue/webplugin_impl.cc +++ b/webkit/glue/webplugin_impl.cc @@ -729,8 +729,8 @@ void WebPluginImpl::setFrameRect(const WebCore::IntRect& rect) { return; } - WebCore::IntRect window_rect; - WebCore::IntRect clip_rect; + gfx::Rect window_rect; + gfx::Rect clip_rect; std::vector<gfx::Rect> cutout_rects; CalculateBounds(rect, &window_rect, &clip_rect, &cutout_rects); @@ -740,8 +740,8 @@ void WebPluginImpl::setFrameRect(const WebCore::IntRect& rect) { // at the same time. WebPluginGeometry move; move.window = window_; - move.window_rect = webkit_glue::FromIntRect(window_rect); - move.clip_rect = webkit_glue::FromIntRect(clip_rect); + move.window_rect = window_rect; + move.clip_rect = clip_rect; move.cutout_rects = cutout_rects; move.rects_valid = true; move.visible = widget_->isVisible(); @@ -749,26 +749,29 @@ void WebPluginImpl::setFrameRect(const WebCore::IntRect& rect) { webview->delegate()->DidMovePlugin(move); } - // Notify the plugin that its parameters have changed. - delegate_->UpdateGeometry(webkit_glue::FromIntRect(window_rect), - webkit_glue::FromIntRect(clip_rect)); - - // Initiate a download on the plugin url. This should be done for the - // first update geometry sequence. We need to ensure that the plugin - // receives the geometry update before it starts receiving data. - if (first_geometry_update_) { - first_geometry_update_ = false; - // An empty url corresponds to an EMBED tag with no src attribute. - if (!load_manually_ && plugin_url_.is_valid()) { - // The Flash plugin hangs for a while if it receives data before - // receiving valid plugin geometry. By valid geometry we mean the - // geometry received by a call to setFrameRect in the Webkit - // layout code path. To workaround this issue we download the - // plugin source url on a timer. - MessageLoop::current()->PostDelayedTask(FROM_HERE, - method_factory_.NewRunnableMethod( - &WebPluginImpl::OnDownloadPluginSrcUrl), - 0); + if (first_geometry_update_ || window_rect != window_rect_ || + clip_rect != clip_rect_) { + window_rect_ = window_rect; + clip_rect_ = clip_rect; + // Notify the plugin that its parameters have changed. + delegate_->UpdateGeometry(window_rect_, clip_rect_); + + // Initiate a download on the plugin url. This should be done for the + // first update geometry sequence. We need to ensure that the plugin + // receives the geometry update before it starts receiving data. + if (first_geometry_update_) { + first_geometry_update_ = false; + // An empty url corresponds to an EMBED tag with no src attribute. + if (!load_manually_ && plugin_url_.is_valid()) { + // The Flash plugin hangs for a while if it receives data before + // receiving valid plugin geometry. By valid geometry we mean the + // geometry received by a call to setFrameRect in the Webkit + // layout code path. To workaround this issue we download the + // plugin source url on a timer. + MessageLoop::current()->PostDelayedTask( + FROM_HERE, method_factory_.NewRunnableMethod( + &WebPluginImpl::OnDownloadPluginSrcUrl), 0); + } } } } @@ -1121,18 +1124,19 @@ WebCore::ScrollView* WebPluginImpl::parent() const { } void WebPluginImpl::CalculateBounds(const WebCore::IntRect& frame_rect, - WebCore::IntRect* window_rect, - WebCore::IntRect* clip_rect, + gfx::Rect* window_rect, + gfx::Rect* clip_rect, std::vector<gfx::Rect>* cutout_rects) { DCHECK(parent()->isFrameView()); WebCore::FrameView* view = static_cast<WebCore::FrameView*>(parent()); - *window_rect = + WebCore::IntRect web_window_rect = WebCore::IntRect(view->contentsToWindow(frame_rect.location()), frame_rect.size()); + *window_rect = webkit_glue::FromIntRect(web_window_rect); // Calculate a clip-rect so that we don't overlap the scrollbars, etc. - *clip_rect = windowClipRect(); - clip_rect->move(-window_rect->x(), -window_rect->y()); + *clip_rect = webkit_glue::FromIntRect(windowClipRect()); + clip_rect->Offset(-window_rect->x(), -window_rect->y()); cutout_rects->clear(); WTF::Vector<WebCore::IntRect> rects; diff --git a/webkit/glue/webplugin_impl.h b/webkit/glue/webplugin_impl.h index 04d0e89..84ead6f 100644 --- a/webkit/glue/webplugin_impl.h +++ b/webkit/glue/webplugin_impl.h @@ -278,8 +278,8 @@ class WebPluginImpl : public WebPlugin, // Calculates the bounds of the plugin widget based on the frame // rect passed in. void CalculateBounds(const WebCore::IntRect& frame_rect, - WebCore::IntRect* window_rect, - WebCore::IntRect* clip_rect, + gfx::Rect* window_rect, + gfx::Rect* clip_rect, std::vector<gfx::Rect>* cutout_rects); void HandleURLRequest(const char *method, @@ -367,6 +367,10 @@ class WebPluginImpl : public WebPlugin, // Indicates if this is the first geometry update received by the plugin. bool first_geometry_update_; + // The current plugin geometry and clip rectangle. + gfx::Rect window_rect_; + gfx::Rect clip_rect_; + // The mime type of the plugin. std::string mime_type_; |