Backout 7f86b28171a2 (bug 787853) & e18fdb9a8e12, ba47dac3cf97, e3fdcf7ed7f2, 992ee4c72c87 (bug 777946) for intermittent linux M4 ABORTs

This commit is contained in:
Ed Morley 2012-09-17 14:17:02 +01:00
parent 83170deef5
commit d8eec8e75e
14 changed files with 76 additions and 108 deletions

View File

@ -646,6 +646,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(NPRect *invalidRect)
// date and update our ImageContainer with the new surface.
nsRefPtr<ImageContainer> container;
mInstance->GetImageContainer(getter_AddRefs(container));
gfxIntSize oldSize(0, 0);
#ifndef XP_MACOSX
// Windowed plugins should not be calling NPN_InvalidateRect, but
@ -663,7 +664,16 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(NPRect *invalidRect)
presContext->DevPixelsToAppUnits(invalidRect->top),
presContext->DevPixelsToAppUnits(invalidRect->right - invalidRect->left),
presContext->DevPixelsToAppUnits(invalidRect->bottom - invalidRect->top));
if (container) {
gfxIntSize newSize = container->GetCurrentSize();
if (newSize != oldSize) {
// The image size has changed - invalidate the old area too, bug 635405.
nsRect oldRect = nsRect(0, 0,
presContext->DevPixelsToAppUnits(oldSize.width),
presContext->DevPixelsToAppUnits(oldSize.height));
rect.UnionRect(rect, oldRect);
}
}
rect.MoveBy(mObjectFrame->GetContentRectRelativeToSelf().TopLeft());
mObjectFrame->InvalidateLayer(rect, nsDisplayItem::TYPE_PLUGIN);
return NS_OK;

View File

@ -25,5 +25,4 @@ random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) =
random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) fails-if(!haveTestPlugin) == plugin-background-10-step.html plugin-background-ref.html
random-if(!haveTestPlugin) == plugin-transform-1.html plugin-transform-1-ref.html
fails-if(!haveTestPlugin) == plugin-transform-2.html plugin-transform-2-ref.html
skip-if(!haveTestPlugin) == shrink-1.html shrink-1-ref.html
fails-if(!haveTestPlugin) == windowless-layers.html windowless-layers-ref.html

View File

@ -1,10 +0,0 @@
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<embed id="plugin" type="application/x-test"
width="50px" height="40px">
</embed>
</body>
</html>

View File

@ -1,23 +0,0 @@
<!DOCTYPE html>
<html class="reftest-wait">
<head>
<script>
function doShrink()
{
var plugin = document.getElementById("plugin");
plugin.setSlowPaint(true);
plugin.width = "50";
plugin.height = "40";
document.documentElement.removeAttribute("class");
}
document.addEventListener("MozReftestInvalidate", doShrink, false);
</script>
</head>
<body>
<embed id="plugin" type="application/x-test"
width="300" height="500">
</embed>
</body>
</html>

View File

@ -197,9 +197,6 @@ Returns the window width that was current when the plugin last painted.
When value is true, every time the plugin paints, it will invalidate
itself *during the paint* using NPN_Invalidate.
* setSlowPaint(value)
When value is true, the instance will sleep briefly during paint.
== Plugin geometry ==
The test plugin supports the following scriptable methods:

View File

@ -125,7 +125,6 @@ static bool getLastMouseY(NPObject* npobj, const NPVariant* args, uint32_t argCo
static bool getPaintCount(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool getWidthAtLastPaint(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool setInvalidateDuringPaint(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool setSlowPaint(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool getError(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool doInternalConsistencyCheck(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
static bool setColor(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result);
@ -187,7 +186,6 @@ static const NPUTF8* sPluginMethodIdentifierNames[] = {
"getPaintCount",
"getWidthAtLastPaint",
"setInvalidateDuringPaint",
"setSlowPaint",
"getError",
"doInternalConsistencyCheck",
"setColor",
@ -250,7 +248,6 @@ static const ScriptableFunction sPluginMethodFunctions[] = {
getPaintCount,
getWidthAtLastPaint,
setInvalidateDuringPaint,
setSlowPaint,
getError,
doInternalConsistencyCheck,
setColor,
@ -502,15 +499,6 @@ static void sendBufferToFrame(NPP instance)
}
}
static void XPSleep(unsigned int seconds)
{
#ifdef XP_WIN
Sleep(1000 * seconds);
#else
sleep(seconds);
#endif
}
TestFunction
getFuncFromString(const char* funcname)
{
@ -777,7 +765,6 @@ NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char*
instanceData->hasWidget = false;
instanceData->npnNewStream = false;
instanceData->invalidateDuringPaint = false;
instanceData->slowPaint = false;
instanceData->writeCount = 0;
instanceData->writeReadyCount = 0;
memset(&instanceData->window, 0, sizeof(instanceData->window));
@ -2502,22 +2489,6 @@ setInvalidateDuringPaint(NPObject* npobj, const NPVariant* args, uint32_t argCou
return true;
}
static bool
setSlowPaint(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
if (argCount != 1)
return false;
if (!NPVARIANT_IS_BOOLEAN(args[0]))
return false;
bool slow = NPVARIANT_TO_BOOLEAN(args[0]);
NPP npp = static_cast<TestNPObject*>(npobj)->npp;
InstanceData* id = static_cast<InstanceData*>(npp->pdata);
id->slowPaint = slow;
return true;
}
static bool
getError(NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result)
{
@ -2807,10 +2778,6 @@ void notifyDidPaint(InstanceData* instanceData)
NPN_InvalidateRect(instanceData->npp, &r);
}
if (instanceData->slowPaint) {
XPSleep(1);
}
if (instanceData->runScriptOnPaint) {
NPObject* o = NULL;
NPN_GetValue(instanceData->npp, NPNVPluginElementNPObject, &o);
@ -3199,7 +3166,11 @@ FinishGCRace(void* closure)
{
GCRaceData* rd = static_cast<GCRaceData*>(closure);
XPSleep(5);
#ifdef XP_WIN
Sleep(5000);
#else
sleep(5);
#endif
NPVariant arg;
OBJECT_TO_NPVARIANT(rd->localFunc_, arg);

View File

@ -111,7 +111,6 @@ typedef struct InstanceData {
bool timerTestResult;
bool asyncCallbackResult;
bool invalidateDuringPaint;
bool slowPaint;
int32_t winX;
int32_t winY;
int32_t lastMouseX;

View File

@ -24,25 +24,18 @@ void ImageLayer::SetContainer(ImageContainer* aContainer)
void ImageLayer::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurface)
{
gfx3DMatrix local = GetLocalTransform();
// Snap image edges to pixel boundaries
gfxRect sourceRect(0, 0, 0, 0);
gfxRect snap(0, 0, 0, 0);
if (mContainer) {
sourceRect.SizeTo(mContainer->GetCurrentSize());
if (mScaleMode != SCALE_NONE) {
NS_ASSERTION(mScaleMode == SCALE_STRETCH,
"No other scalemodes than stretch and none supported yet.");
local.Scale(mScaleToSize.width / sourceRect.width,
mScaleToSize.height / sourceRect.height, 0.0);
}
gfxIntSize size = mContainer->GetCurrentSize();
snap.SizeTo(gfxSize(size.width, size.height));
}
// Snap our local transform first, and snap the inherited transform as well.
// This makes our snapping equivalent to what would happen if our content
// was drawn into a ThebesLayer (gfxContext would snap using the local
// transform, then we'd snap again when compositing the ThebesLayer).
mEffectiveTransform =
SnapTransform(local, sourceRect, nullptr)*
SnapTransform(GetLocalTransform(), snap, nullptr)*
SnapTransform(aTransformToSurface, gfxRect(0, 0, 0, 0), nullptr);
ComputeEffectiveTransformForMaskLayer(aTransformToSurface);
}

View File

@ -24,7 +24,7 @@ class THEBES_API ImageLayer : public Layer {
public:
enum ScaleMode {
SCALE_NONE,
SCALE_STRETCH
SCALE_STRETCH // Unimplemented on GL layers and e10s
// Unimplemented - SCALE_PRESERVE_ASPECT_RATIO_CONTAIN
};

View File

@ -98,6 +98,15 @@ BasicImageLayer::GetAndPaintCurrentImage(gfxContext* aContext,
}
pat->SetFilter(mFilter);
gfxIntSize sourceSize = surface->GetSize();
if (mScaleMode != SCALE_NONE) {
NS_ASSERTION(mScaleMode == SCALE_STRETCH,
"No other scalemodes than stretch and none supported yet.");
gfxMatrix mat = pat->GetMatrix();
mat.Scale(float(sourceSize.width) / mScaleToSize.width, float(sourceSize.height) / mScaleToSize.height);
pat->SetMatrix(mat);
size = mScaleToSize;
}
// The visible region can extend outside the image, so just draw
// within the image bounds.

View File

@ -181,7 +181,7 @@ ImageLayerD3D10::RenderLayer()
return;
}
gfxIntSize size = image->GetSize();
gfxIntSize size = mScaleMode == SCALE_NONE ? image->GetSize() : mScaleToSize;
SetEffectTransformAndOpacity();

View File

@ -368,7 +368,7 @@ ImageLayerD3D9::RenderLayer()
SetShaderTransformAndOpacity();
gfxIntSize size = image->GetSize();
gfxIntSize size = mScaleMode == SCALE_NONE ? image->GetSize() : mScaleToSize;
if (image->GetFormat() == CAIRO_SURFACE ||
image->GetFormat() == REMOTE_IMAGE_BITMAP)

View File

@ -13,9 +13,9 @@
#include "gfxUtils.h"
#include "yuv_convert.h"
#include "GLContextProvider.h"
#if defined(MOZ_X11) && !defined(MOZ_PLATFORM_MAEMO)
#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
# include "GLXLibrary.h"
# include "gfxXlibSurface.h"
# include "mozilla/X11Util.h"
#endif
#ifdef MOZ_WIDGET_ANDROID
@ -246,6 +246,8 @@ ImageLayerOGL::RenderLayer(int,
NS_ASSERTION(image->GetFormat() != REMOTE_IMAGE_BITMAP,
"Remote images aren't handled yet in OGL layers!");
NS_ASSERTION(mScaleMode == SCALE_NONE,
"Scale modes other than none not handled yet in OGL layers!");
if (image->GetFormat() == PLANAR_YCBCR) {
PlanarYCbCrImage *yuvImage =
@ -343,6 +345,18 @@ ImageLayerOGL::RenderLayer(int,
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, data->mTexture.GetTextureID());
#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
GLXPixmap pixmap;
if (cairoImage->mSurface) {
pixmap = sDefGLXLib.CreatePixmap(cairoImage->mSurface);
NS_ASSERTION(pixmap, "Failed to create pixmap!");
if (pixmap) {
sDefGLXLib.BindTexImage(pixmap);
}
}
#endif
ShaderProgramOGL *program =
mOGLManager->GetProgram(data->mLayerProgram, GetMaskLayer());
@ -359,6 +373,13 @@ ImageLayerOGL::RenderLayer(int,
program->LoadMask(GetMaskLayer());
mOGLManager->BindAndDrawQuad(program);
#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
if (cairoImage->mSurface && pixmap) {
sDefGLXLib.ReleaseTexImage(pixmap);
sDefGLXLib.DestroyPixmap(pixmap);
}
#endif
#ifdef XP_MACOSX
} else if (image->GetFormat() == MAC_IO_SURFACE) {
MacIOSurfaceImage *ioImage =
@ -560,25 +581,16 @@ ImageLayerOGL::AllocateTexturesCairo(CairoImage *aImage)
SetClamping(gl, tex);
#if defined(MOZ_X11) && !defined(MOZ_PLATFORM_MAEMO)
if (aImage->mSurface->GetType() == gfxASurface::SurfaceTypeXlib) {
gfxXlibSurface *xsurf =
static_cast<gfxXlibSurface*>(aImage->mSurface.get());
GLXPixmap pixmap = xsurf->GetGLXPixmap();
if (pixmap) {
if (aImage->mSurface->GetContentType()
== gfxASurface::CONTENT_COLOR_ALPHA) {
backendData->mLayerProgram = gl::RGBALayerProgramType;
} else {
backendData->mLayerProgram = gl::RGBXLayerProgramType;
}
aImage->SetBackendData(LAYERS_OPENGL, backendData.forget());
sDefGLXLib.BindTexImage(pixmap);
return;
#if defined(MOZ_WIDGET_GTK2) && !defined(MOZ_PLATFORM_MAEMO)
if (sDefGLXLib.SupportsTextureFromPixmap(aImage->mSurface)) {
if (aImage->mSurface->GetContentType() == gfxASurface::CONTENT_COLOR_ALPHA) {
backendData->mLayerProgram = gl::RGBALayerProgramType;
} else {
backendData->mLayerProgram = gl::RGBXLayerProgramType;
}
aImage->SetBackendData(LAYERS_OPENGL, backendData.forget());
return;
}
#endif
backendData->mLayerProgram =

View File

@ -1631,7 +1631,16 @@ nsObjectFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
return nullptr;
}
gfxIntSize size(window->width, window->height);
gfxIntSize size;
#ifdef XP_MACOSX
if (mInstanceOwner->GetDrawingModel() == NPDrawingModelCoreAnimation) {
size = container->GetCurrentSize();
} else
#endif
{
size = gfxIntSize(window->width, window->height);
}
nsRect area = GetContentRectRelativeToSelf() + aItem->ToReferenceFrame();
gfxRect r = nsLayoutUtils::RectToGfxRect(area, PresContext()->AppUnitsPerDevPixel());
@ -1654,7 +1663,9 @@ nsObjectFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
ImageLayer* imglayer = static_cast<ImageLayer*>(layer.get());
UpdateImageLayer(r);
#ifdef XP_WIN
imglayer->SetScaleToSize(size, ImageLayer::SCALE_STRETCH);
#endif
imglayer->SetContainer(container);
gfxPattern::GraphicsFilter filter =
nsLayoutUtils::GetGraphicsFilterForFrame(this);