diff options
author | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-13 21:11:01 +0000 |
---|---|---|
committer | stuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-13 21:11:01 +0000 |
commit | f8f72875acb86d0a307d759269ee005d7327343d (patch) | |
tree | 13b6aa3103c06b846acb3094469ff7e24803c610 /webkit/glue | |
parent | 56b6828771d7bfac966ab6a64328ef3f8161f7cc (diff) | |
download | chromium_src-f8f72875acb86d0a307d759269ee005d7327343d.zip chromium_src-f8f72875acb86d0a307d759269ee005d7327343d.tar.gz chromium_src-f8f72875acb86d0a307d759269ee005d7327343d.tar.bz2 |
Send real clipping information to Mac plugins
Inform plugins of the actual clipping, so that they know not to try to invalidate off-screen areas (which in the case of Silverlight can cause it to stop drawing). We still always say that the window is the size of the plugin, and that the plugin is at (0,0), which is the part that actually matters for transforms and drawing location.
BUG=41323
TEST=Plugins scrolled partially off-screen should still draw correctly. Netflix video should keep playing even when the screen is smaller than the player.
Review URL: http://codereview.chromium.org/1558042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44396 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_mac.mm | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm index 64e7513..6f2d4ec 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm +++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm @@ -430,28 +430,24 @@ void WebPluginDelegateImpl::WindowedSetWindow() { void WebPluginDelegateImpl::WindowlessUpdateGeometry( const gfx::Rect& window_rect, const gfx::Rect& clip_rect) { - bool old_clip_was_empty = clip_rect_.IsEmpty(); + gfx::Rect old_clip_rect = clip_rect_; cached_clip_rect_ = clip_rect; if (container_is_visible_) // Remove check when cached_clip_rect_ is removed. clip_rect_ = clip_rect; - bool new_clip_is_empty = clip_rect_.IsEmpty(); + bool clip_rect_changed = (clip_rect_ != old_clip_rect); + bool window_size_changed = (window_rect.size() != window_rect_.size()); - bool window_rect_changed = (window_rect != window_rect_); - - // Only resend to the instance if the geometry has changed (see note in - // WindowlessSetWindow for why we only care about the clip rect switching - // empty state). - if (!window_rect_changed && old_clip_was_empty == new_clip_is_empty) + if (window_rect == window_rect_ && !clip_rect_changed) return; - if (old_clip_was_empty != new_clip_is_empty) { + if (old_clip_rect.IsEmpty() != clip_rect_.IsEmpty()) { PluginVisibilityChanged(); } SetPluginRect(window_rect); #ifndef NP_NO_QUICKDRAW - if (window_rect_changed && qd_manager_.get() && + if (window_size_changed && qd_manager_.get() && qd_manager_->IsFastPathEnabled()) { // If the window size has changed, we need to turn off the fast path so that // the full redraw goes to the window and we get a correct baseline paint. @@ -460,7 +456,8 @@ void WebPluginDelegateImpl::WindowlessUpdateGeometry( } #endif - WindowlessSetWindow(true); + if (window_size_changed || clip_rect_changed) + WindowlessSetWindow(true); } void WebPluginDelegateImpl::DrawLayerInSurface() { @@ -543,17 +540,10 @@ void WebPluginDelegateImpl::WindowlessSetWindow(bool force_set_window) { window_.y = 0; window_.height = window_rect_.height(); window_.width = window_rect_.width(); - window_.clipRect.left = window_.x; - window_.clipRect.top = window_.y; - window_.clipRect.right = window_.clipRect.left; - window_.clipRect.bottom = window_.clipRect.top; - if (container_is_visible_ && !clip_rect_.IsEmpty()) { - // We never tell plugins that they are only partially visible; because the - // drawing target doesn't change size, the positioning of what plugins drew - // would be wrong, as would any transforms they did on the context. - window_.clipRect.right += window_.width; - window_.clipRect.bottom += window_.height; - } + window_.clipRect.left = clip_rect_.x(); + window_.clipRect.top = clip_rect_.y(); + window_.clipRect.right = clip_rect_.x() + clip_rect_.width(); + window_.clipRect.bottom = clip_rect_.y() + clip_rect_.height(); NPError err = instance()->NPP_SetWindow(&window_); @@ -565,7 +555,7 @@ void WebPluginDelegateImpl::WindowlessSetWindow(bool force_set_window) { #ifndef NP_NO_QUICKDRAW if ((quirks_ & PLUGIN_QUIRK_ALLOW_FASTER_QUICKDRAW_PATH) && - !qd_manager_->IsFastPathEnabled() && clip_rect_.IsEmpty()) { + !qd_manager_->IsFastPathEnabled() && !clip_rect_.IsEmpty()) { // Give the plugin a few seconds to stabilize so we get a good initial paint // to use as a baseline, then switch to the fast path. fast_path_enable_tick_ = base::TimeTicks::Now() + |