Don't paint OSX plug-ins with empty clip. b=568382 r=roc
authorBenoit Girard <b56girard@gmail.com>
Wed, 09 Jun 2010 00:11:46 -0400
changeset 43369 6599ff0c99816ea9a09295d20c1f1ca622ffdf54
parent 43368 014ea2ea49981560a00b769205f4921c164260f8
child 43370 df8b93c91fe57af3eaacc861d949da541231d0c7
push idunknown
push userunknown
push dateunknown
reviewersroc
bugs568382
milestone1.9.3a5pre
Don't paint OSX plug-ins with empty clip. b=568382 r=roc
layout/generic/nsObjectFrame.cpp
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -1576,16 +1576,21 @@ nsObjectFrame::PaintPlugin(nsIRenderingC
         mInstanceOwner->GetDrawingModel() == NPDrawingModelCoreAnimation) {
       PRInt32 appUnitsPerDevPixel = PresContext()->AppUnitsPerDevPixel();
       // Clip to the content area where the plugin should be drawn. If
       // we don't do this, the plugin can draw outside its bounds.
       nsIntRect contentPixels = aPluginRect.ToNearestPixels(appUnitsPerDevPixel);
       nsIntRect dirtyPixels = aDirtyRect.ToOutsidePixels(appUnitsPerDevPixel);
       nsIntRect clipPixels;
       clipPixels.IntersectRect(contentPixels, dirtyPixels);
+
+      // Don't invoke the drawing code if the clip is empty.
+      if (clipPixels.IsEmpty())
+        return;
+
       gfxRect nativeClipRect(clipPixels.x, clipPixels.y,
                              clipPixels.width, clipPixels.height);
       gfxContext* ctx = aRenderingContext.ThebesContext();
 
       gfxContextAutoSaveRestore save(ctx);
       ctx->NewPath();
       ctx->Rectangle(nativeClipRect);
       ctx->Clip();
@@ -3613,18 +3618,18 @@ void nsPluginInstanceOwner::SetupCARefre
 
 void nsPluginInstanceOwner::RenderCoreAnimation(CGContextRef aCGContext, 
                                                 int aWidth, int aHeight)
 {
   if (aWidth == 0 || aHeight == 0)
     return;
 
   if (!mIOSurface || 
-     (mIOSurface->GetWidth() != aWidth || 
-      mIOSurface->GetHeight() != aHeight)) {
+     (mIOSurface->GetWidth() != (size_t)aWidth || 
+      mIOSurface->GetHeight() != (size_t)aHeight)) {
     if (mIOSurface) {
       delete mIOSurface;
     }
 
     // If the renderer is backed by an IOSurface, resize it as required.
     mIOSurface = nsIOSurface::CreateIOSurface(aWidth, aHeight);
     if (mIOSurface) {
       nsIOSurface *attachSurface = nsIOSurface::LookupSurface(