diff options
-rw-r--r-- | chrome/plugin/webplugin_proxy.cc | 1 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.cc | 17 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_mac.mm | 27 |
3 files changed, 30 insertions, 15 deletions
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc index b98cc93..32102d3 100644 --- a/chrome/plugin/webplugin_proxy.cc +++ b/chrome/plugin/webplugin_proxy.cc @@ -540,7 +540,6 @@ void WebPluginProxy::UpdateTransform() { } #elif defined(OS_MACOSX) void WebPluginProxy::UpdateTransform() { - NOTIMPLEMENTED(); } void WebPluginProxy::SetWindowlessBuffer( diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 03b2b57..b6ea8dd 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -498,6 +498,14 @@ bool WebPluginDelegateProxy::CreateBitmap( return true; } +#if defined(OS_MACOSX) +// Flips |rect| vertically within an enclosing rect with height |height|. +// Intended for converting rects between flipped and non-flipped contexts. +static void FlipRectVerticallyWithHeight(gfx::Rect* rect, int height) { + rect->set_y(height - rect->y() - rect->height()); +} +#endif + void WebPluginDelegateProxy::Paint(gfx::NativeDrawingContext context, const gfx::Rect& damaged_rect) { // If the plugin is no longer connected (channel crashed) draw a crashed @@ -535,6 +543,9 @@ void WebPluginDelegateProxy::Paint(gfx::NativeDrawingContext context, CopyFromTransportToBacking(offset_rect); } +#if defined(OS_MACOSX) + FlipRectVerticallyWithHeight(&offset_rect, plugin_rect_.height()); +#endif BlitCanvasToContext(context, rect, backing_store_canvas_.get(), offset_rect.origin()); @@ -906,7 +917,11 @@ void WebPluginDelegateProxy::CopyFromTransportToBacking(const gfx::Rect& rect) { } // Copy the damaged rect from the transport bitmap to the backing store. - BlitCanvasToCanvas(backing_store_canvas_.get(), rect, + gfx::Rect dest_rect = rect; +#if defined(OS_MACOSX) + FlipRectVerticallyWithHeight(&dest_rect, plugin_rect_.height()); +#endif + BlitCanvasToCanvas(backing_store_canvas_.get(), dest_rect, transport_store_canvas_.get(), rect.origin()); backing_store_painted_ = backing_store_painted_.Union(rect); } diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm index 409122f..7a900b8 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm +++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm @@ -258,14 +258,14 @@ void WebPluginDelegateImpl::WindowlessUpdateGeometry( if (window_rect_ != window_rect) { window_rect_ = window_rect; - window_.clipRect.top = clip_rect_.y(); - window_.clipRect.left = clip_rect_.x(); - window_.clipRect.bottom = clip_rect_.y() + clip_rect_.height(); - window_.clipRect.right = clip_rect_.x() + clip_rect_.width(); + window_.clipRect.top = 0; + window_.clipRect.left = 0; + window_.clipRect.bottom = window_rect_.height(); + window_.clipRect.right = window_rect_.width(); window_.height = window_rect_.height(); window_.width = window_rect_.width(); - window_.x = window_rect_.x(); - window_.y = window_rect_.y(); + window_.x = 0; + window_.y = 0; window_.type = NPWindowTypeDrawable; windowless_needs_set_window_ = true; } @@ -282,8 +282,8 @@ void WebPluginDelegateImpl::WindowlessPaint(gfx::NativeDrawingContext context, [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO]]; - CGContextSaveGState(context); + cg_context_.context = context; window_.window = &cg_context_; window_.type = NPWindowTypeDrawable; @@ -322,6 +322,7 @@ void WebPluginDelegateImpl::WindowlessPaint(gfx::NativeDrawingContext context, paint_event.where.v = 0; paint_event.modifiers = 0; instance()->NPP_HandleEvent(&paint_event); + CGContextRestoreGState(context); [NSGraphicsContext restoreGraphicsState]; } @@ -333,14 +334,14 @@ void WebPluginDelegateImpl::WindowlessSetWindow(bool force_set_window) { if (window_rect_.IsEmpty()) // wait for geometry to be set. return; - window_.clipRect.top = clip_rect_.y(); - window_.clipRect.left = clip_rect_.x(); - window_.clipRect.bottom = clip_rect_.y() + clip_rect_.height(); - window_.clipRect.right = clip_rect_.x() + clip_rect_.width(); + window_.clipRect.top = 0; + window_.clipRect.left = 0; + window_.clipRect.bottom = window_rect_.height(); + window_.clipRect.right = window_rect_.width(); window_.height = window_rect_.height(); window_.width = window_rect_.width(); - window_.x = window_rect_.x(); - window_.y = window_rect_.y(); + window_.x = 0; + window_.y = 0; window_.type = NPWindowTypeDrawable; if (!force_set_window) |