Revert bug 595337 because of persistent leaks running mochitests, and bug 556487 because of in-process test failures (crashes) and a reftest failure.

This commit is contained in:
Benjamin Smedberg 2010-09-14 14:50:24 -07:00
Родитель e59e540ed3
Коммит 9c6b634f34
14 изменённых файлов: 12 добавлений и 1198 удалений

Просмотреть файл

@ -52,30 +52,10 @@ using NPRect;
using NPNURLVariable;
using NPCoordinateSpace;
using mozilla::plugins::NativeWindowHandle;
using mozilla::gfxSurfaceType;
using gfxIntSize;
using mozilla::null_t;
namespace mozilla {
namespace plugins {
struct SurfaceDescriptorX11 {
int XID;
int xrenderPictID;
gfxIntSize size;
};
union SurfaceDescriptor {
Shmem;
SurfaceDescriptorX11;
// Descriptor can be null here in case
// 1) of first Show call (prevSurface is null)
// 2) when child is going to destroy
// and it just want to grab prevSurface
// back without giving new surface
null_t;
};
rpc protocol PPluginInstance
{
manager PPluginModule;
@ -112,20 +92,6 @@ child:
// this is only used on windows to forward WM_WINDOWPOSCHANGE
async WindowPosChanged(NPRemoteEvent event);
// ********************** Async plugins rendering
// see https://wiki.mozilla.org/Gecko:AsyncPluginPainting
// **********************
// Plugin parent notify child that plugin frame
// has been painted to the screen
async PaintFinished();
// Async version of SetWindow call
// @param surfaceType - gfxASurface::gfxSurfaceType
// plugin child must create offscreen buffer
// with type equals to surfaceType
async AsyncSetWindow(gfxSurfaceType surfaceType, NPRemoteWindow window);
rpc NPP_Destroy()
returns (NPError rv);
@ -168,16 +134,6 @@ parent:
async NPN_InvalidateRect(NPRect rect);
// Give |newSurface|, containing this instance's updated pixels, to
// the browser for compositing. Get back |prevSurface|, containing
// old pixels, to be recycled
// @param rect - actually updated rectangle, comparing to prevSurface content
// could be used for partial render of layer to topLevel context
// @param newSurface - remotable surface
// @param prevSurface - return surface for recycling
sync Show(NPRect updatedRect, SurfaceDescriptor newSurface)
returns (SurfaceDescriptor prevSurface);
rpc NPN_PushPopupsEnabledState(bool aState);
rpc NPN_PopPopupsEnabledState();

Просмотреть файл

@ -43,14 +43,6 @@
#include "PluginStreamChild.h"
#include "StreamNotifyChild.h"
#include "PluginProcessChild.h"
#include "gfxASurface.h"
#include "gfxContext.h"
#ifdef MOZ_X11
#include "gfxXlibSurface.h"
#endif
#include "gfxSharedImageSurface.h"
#include "gfxUtils.h"
#include "gfxAlphaRecovery.h"
#include "mozilla/ipc/SyncChannel.h"
@ -98,13 +90,6 @@ const int kFlashWMUSERMessageThrottleDelayMs = 5;
#include <ApplicationServices/ApplicationServices.h>
#endif // defined(XP_MACOSX)
template<>
struct RunnableMethodTraits<PluginInstanceChild>
{
static void RetainCallee(PluginInstanceChild* obj) { }
static void ReleaseCallee(PluginInstanceChild* obj) { }
};
PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface,
const nsCString& aMimeType)
: mPluginIface(aPluginIface)
@ -126,18 +111,6 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface,
, mShContext(nsnull)
, mDrawingModel(NPDrawingModelCoreGraphics)
, mCurrentEvent(nsnull)
#endif
, mLayersRendering(PR_FALSE)
, mAccumulatedInvalidRect(0,0,0,0)
, mIsTransparent(PR_FALSE)
, mSurfaceType(gfxASurface::SurfaceTypeMax)
, mPendingForcePaint(PR_FALSE)
, mCurrentInvalidateTask(nsnull)
, mPendingPluginCall(PR_FALSE)
, mDoAlphaExtraction(PR_FALSE)
, mSurfaceDifferenceRect(0,0,0,0)
#ifdef MOZ_X11
, mFlash10Quirks(PR_FALSE)
#endif
{
memset(&mWindow, 0, sizeof(mWindow));
@ -155,15 +128,6 @@ PluginInstanceChild::PluginInstanceChild(const NPPluginFuncs* aPluginIface,
#if defined(OS_WIN)
InitPopupMenuHook();
#endif // OS_WIN
#ifdef MOZ_X11
const char *description = NULL;
mPluginIface->getvalue(GetNPP(), NPPVpluginDescriptionString,
&description);
if (description) {
NS_NAMED_LITERAL_CSTRING(flash10Head, "Shockwave Flash 10.");
mFlash10Quirks = StringBeginsWith(nsDependentCString(description), flash10Head);
}
#endif
}
PluginInstanceChild::~PluginInstanceChild()
@ -437,9 +401,9 @@ PluginInstanceChild::NPN_SetValue(NPPVariable aVar, void* aValue)
case NPPVpluginTransparentBool: {
NPError rv;
mIsTransparent = (NPBool) (intptr_t) aValue;
bool transparent = (NPBool) (intptr_t) aValue;
if (!CallNPN_SetValue_NPPVpluginTransparent(mIsTransparent, &rv))
if (!CallNPN_SetValue_NPPVpluginTransparent(transparent, &rv))
return NPERR_GENERIC_ERROR;
return rv;
@ -850,8 +814,6 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
&mWsInfo.visual, &mWsInfo.depth))
return false;
mLayersRendering = PR_FALSE;
#ifdef MOZ_WIDGET_GTK2
if (gtk_check_version(2,18,7) != NULL) { // older
if (aWindow.type == NPWindowTypeWindow) {
@ -1976,460 +1938,6 @@ PluginInstanceChild::NPN_NewStream(NPMIMEType aMIMEType, const char* aWindow,
return NPERR_NO_ERROR;
}
bool
PluginInstanceChild::RecvPaintFinished(void)
{
if (mPendingForcePaint) {
nsIntRect r(0, 0, mWindow.width, mWindow.height);
mAccumulatedInvalidRect.UnionRect(r, mAccumulatedInvalidRect);
mPendingForcePaint = PR_FALSE;
}
if (!mAccumulatedInvalidRect.IsEmpty()) {
AsyncShowPluginFrame();
}
return true;
}
bool
PluginInstanceChild::RecvAsyncSetWindow(const gfxSurfaceType& aSurfaceType,
const NPRemoteWindow& aWindow)
{
AssertPluginThread();
mWindow.window = reinterpret_cast<void*>(aWindow.window);
if (mWindow.width != aWindow.width || mWindow.height != aWindow.height) {
mCurrentSurface = nsnull;
mHelperSurface = nsnull;
mPendingForcePaint = PR_TRUE;
}
mWindow.x = aWindow.x;
mWindow.y = aWindow.y;
mWindow.width = aWindow.width;
mWindow.height = aWindow.height;
mWindow.clipRect = aWindow.clipRect;
mWindow.type = aWindow.type;
mLayersRendering = PR_TRUE;
mSurfaceType = aSurfaceType;
UpdateWindowAttributes(PR_TRUE);
return true;
}
static inline gfxRect
GfxFromNsRect(const nsIntRect& aRect)
{
return gfxRect(aRect.x, aRect.y, aRect.width, aRect.height);
}
PRBool
PluginInstanceChild::CreateOptSurface(void)
{
nsRefPtr<gfxASurface> retsurf;
gfxASurface::gfxImageFormat format =
mIsTransparent ? gfxASurface::ImageFormatARGB32 :
gfxASurface::ImageFormatRGB24;
#ifdef MOZ_X11
Display* dpy = mWsInfo.display;
Screen* screen = DefaultScreenOfDisplay(dpy);
if (format == gfxASurface::ImageFormatRGB24 &&
DefaultDepth(dpy, DefaultScreen(dpy)) == 16) {
format = gfxASurface::ImageFormatRGB16_565;
}
if (mSurfaceType == gfxASurface::SurfaceTypeXlib) {
XRenderPictFormat* xfmt = gfxXlibSurface::FindRenderFormat(dpy, format);
if (!xfmt) {
NS_ERROR("Need X falback surface, but FindRenderFormat failed");
return PR_FALSE;
}
mCurrentSurface =
gfxXlibSurface::Create(screen, xfmt,
gfxIntSize(mWindow.width,
mWindow.height));
return mCurrentSurface != nsnull;
}
#endif
// Make common shmem implementation working for any platform
mCurrentSurface = new gfxSharedImageSurface();
if (NS_FAILED(static_cast<gfxSharedImageSurface*>(mCurrentSurface.get())->
Init(this, gfxIntSize(mWindow.width, mWindow.height), format))) {
return PR_FALSE;
}
return PR_TRUE;
}
PRBool
PluginInstanceChild::MaybeCreatePlatformHelperSurface(void)
{
if (!mCurrentSurface) {
NS_ERROR("Cannot create helper surface without mCurrentSurface");
return PR_FALSE;
}
#ifdef MOZ_PLATFORM_MAEMO
// On maemo plugins support non-default visual rendering
PRBool supportNonDefaultVisual = PR_TRUE;
#else
PRBool supportNonDefaultVisual = PR_FALSE;
#endif
#ifdef MOZ_X11
Screen* screen = DefaultScreenOfDisplay(mWsInfo.display);
Visual* defaultVisual = DefaultVisualOfScreen(screen);
Visual* visual = nsnull;
Colormap colormap = 0;
mDoAlphaExtraction = PR_FALSE;
PRBool createHelperSurface = PR_FALSE;
if (mCurrentSurface->GetType() == gfxASurface::SurfaceTypeXlib) {
static_cast<gfxXlibSurface*>(mCurrentSurface.get())->
GetColormapAndVisual(&colormap, &visual);
// Create helper surface if layer surface visual not same as default
// and we don't support non-default visual rendering
if (!visual || (defaultVisual != visual && !supportNonDefaultVisual)) {
createHelperSurface = PR_TRUE;
visual = defaultVisual;
mDoAlphaExtraction = mIsTransparent;
}
} else if (mCurrentSurface->GetType() == gfxASurface::SurfaceTypeImage) {
// For image layer surface we should always create helper surface
createHelperSurface = PR_TRUE;
// Check if we can create helper surface with non-default visual
visual = gfxXlibSurface::FindVisual(screen,
static_cast<gfxImageSurface*>(mCurrentSurface.get())->Format());
if (visual && defaultVisual != visual && !supportNonDefaultVisual) {
visual = defaultVisual;
mDoAlphaExtraction = mIsTransparent;
}
}
if (createHelperSurface) {
if (!visual) {
NS_ERROR("Need X falback surface, but visual failed");
return PR_FALSE;
}
mHelperSurface =
gfxXlibSurface::Create(screen, visual,
mCurrentSurface->GetSize());
if (!mHelperSurface) {
NS_WARNING("Fail to create create helper surface");
return PR_FALSE;
}
}
#endif
return PR_TRUE;
}
PRBool
PluginInstanceChild::EnsureCurrentBuffer(void)
{
if (mCurrentSurface) {
return PR_TRUE;
}
if (!mWindow.width || !mWindow.height) {
return PR_FALSE;
}
if (!CreateOptSurface()) {
NS_ERROR("Cannot create optimized surface");
return PR_FALSE;
}
if (!MaybeCreatePlatformHelperSurface()) {
NS_ERROR("Cannot create helper surface");
return PR_FALSE;
}
return PR_TRUE;
}
void
PluginInstanceChild::UpdateWindowAttributes(PRBool aForceSetWindow)
{
nsRefPtr<gfxASurface> curSurface = mHelperSurface ? mHelperSurface : mCurrentSurface;
PRBool needWindowUpdate = aForceSetWindow;
#ifdef MOZ_X11
Visual* visual = nsnull;
Colormap colormap = 0;
if (curSurface && curSurface->GetType() == gfxASurface::SurfaceTypeXlib) {
static_cast<gfxXlibSurface*>(curSurface.get())->
GetColormapAndVisual(&colormap, &visual);
if (visual != mWsInfo.visual || colormap != mWsInfo.colormap) {
mWsInfo.visual = visual;
mWsInfo.colormap = colormap;
needWindowUpdate = PR_TRUE;
}
}
#endif
if (!needWindowUpdate) {
return;
}
// The clip rect is relative to drawable top-left.
nsIntRect clipRect;
mWindow.x = mWindow.y = 0;
clipRect.SetRect(mWindow.x, mWindow.y, mWindow.width, mWindow.height);
// Don't ask the plugin to draw outside the drawable.
// This also ensures that the unsigned clip rectangle offsets won't be -ve.
NPRect newClipRect;
newClipRect.left = clipRect.x;
newClipRect.top = clipRect.y;
newClipRect.right = clipRect.XMost();
newClipRect.bottom = clipRect.YMost();
mWindow.clipRect = newClipRect;
if (mPluginIface->setwindow) {
mPluginIface->setwindow(&mData, &mWindow);
}
return;
}
void
PluginInstanceChild::PaintRectToPlatformSurface(const nsIntRect& aRect,
gfxASurface* aSurface)
{
UpdateWindowAttributes();
#ifdef MOZ_X11
NS_ASSERTION(aSurface->GetType() == gfxASurface::SurfaceTypeXlib,
"Non supported platform surface type");
mPendingPluginCall = PR_TRUE;
NPEvent pluginEvent;
XGraphicsExposeEvent& exposeEvent = pluginEvent.xgraphicsexpose;
exposeEvent.type = GraphicsExpose;
exposeEvent.display = mWsInfo.display;
exposeEvent.drawable = static_cast<gfxXlibSurface*>(aSurface)->XDrawable();
exposeEvent.x = aRect.x;
exposeEvent.y = aRect.y;
exposeEvent.width = aRect.width;
exposeEvent.height = aRect.height;
exposeEvent.count = 0;
// information not set:
exposeEvent.serial = 0;
exposeEvent.send_event = False;
exposeEvent.major_code = 0;
exposeEvent.minor_code = 0;
mPluginIface->event(&mData, reinterpret_cast<void*>(&exposeEvent));
mPendingPluginCall = PR_FALSE;
#endif
}
void
PluginInstanceChild::PaintRectToSurface(const nsIntRect& aRect,
gfxASurface* aSurface,
const gfxRGBA& aColor)
{
// Render using temporary X surface, with copy to image surface
nsIntRect plPaintRect(aRect);
nsRefPtr<gfxASurface> renderSurface = aSurface;
#ifdef MOZ_X11
if (mIsTransparent && mFlash10Quirks) {
// Work around a bug in Flash up to 10.1 d51 at least, where expose event
// top left coordinates within the plugin-rect and not at the drawable
// origin are misinterpreted. (We can move the top left coordinate
// provided it is within the clipRect.), see bug 574583
plPaintRect.SetRect(0, 0, aRect.XMost(), aRect.YMost());
}
if (renderSurface->GetType() != gfxASurface::SurfaceTypeXlib) {
// On X11 we can paint to non Xlib surface only with HelperSurface
renderSurface = mHelperSurface;
}
#endif
if (mIsTransparent) {
// Clear surface content for transparent rendering
nsRefPtr<gfxContext> ctx = new gfxContext(renderSurface);
ctx->SetColor(aColor);
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
ctx->Rectangle(GfxFromNsRect(plPaintRect));
ctx->Fill();
}
PaintRectToPlatformSurface(plPaintRect, renderSurface);
if (renderSurface != aSurface) {
// Copy helper surface content to target
nsRefPtr<gfxContext> ctx = new gfxContext(aSurface);
ctx->SetSource(renderSurface);
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
ctx->Rectangle(GfxFromNsRect(aRect));
ctx->Fill();
}
}
void
PluginInstanceChild::PaintRectWithAlphaExtraction(const nsIntRect& aRect,
gfxASurface* aSurface)
{
// Paint onto black image
PRBool needImageSurface = PR_TRUE;
nsRefPtr<gfxImageSurface> blackImage;
gfxIntSize clipSize(aRect.width, aRect.height);
gfxPoint deviceOffset(-aRect.x, -aRect.y);
// Try to re-use existing image surface, and avoid one copy
if (aSurface->GetType() == gfxASurface::SurfaceTypeImage) {
gfxImageSurface *surface = static_cast<gfxImageSurface*>(aSurface);
if (surface->Format() == gfxASurface::ImageFormatARGB32) {
needImageSurface = PR_FALSE;
blackImage = surface->GetSubimage(GfxFromNsRect(aRect));
}
}
// otherwise create new helper surface
if (needImageSurface) {
blackImage = new gfxImageSurface(clipSize, gfxASurface::ImageFormatARGB32);
}
// Paint to black image
blackImage->SetDeviceOffset(deviceOffset);
PaintRectToSurface(aRect, blackImage, gfxRGBA(0.0, 0.0, 0.0));
// Paint onto white image
nsRefPtr<gfxImageSurface> whiteImage =
new gfxImageSurface(clipSize, gfxASurface::ImageFormatRGB24);
whiteImage->SetDeviceOffset(deviceOffset);
PaintRectToSurface(aRect, whiteImage, gfxRGBA(1.0, 1.0, 1.0));
// Extract Alpha from black and white image and store to black Image
gfxRect rect(aRect.x, aRect.y, aRect.width, aRect.height);
if (!gfxAlphaRecovery::RecoverAlpha(blackImage, whiteImage, nsnull)) {
return;
}
if (needImageSurface) {
nsRefPtr<gfxContext> ctx = new gfxContext(aSurface);
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
ctx->SetSource(blackImage);
ctx->Rectangle(GfxFromNsRect(aRect));
ctx->Fill();
}
}
PRBool
PluginInstanceChild::ShowPluginFrame()
{
if (mPendingPluginCall) {
return PR_FALSE;
}
if (!EnsureCurrentBuffer()) {
return PR_FALSE;
}
// Make expose rect not bigger than clip rect
mAccumulatedInvalidRect.IntersectRect(mAccumulatedInvalidRect,
nsIntRect(mWindow.clipRect.left, mWindow.clipRect.top,
mWindow.clipRect.right - mWindow.clipRect.left,
mWindow.clipRect.bottom - mWindow.clipRect.top));
// Cleare accRect here to be able to pass test_invalidate_during_plugin_paint test
nsIntRect rect = mAccumulatedInvalidRect;
mAccumulatedInvalidRect.Empty();
#ifdef MOZ_X11
// We can read safetly from XSurface, because PluginHost is not able to modify that surface
if (mBackSurface && mBackSurface->GetType() == gfxASurface::SurfaceTypeXlib) {
if (!mSurfaceDifferenceRect.IsEmpty()) {
// Read back previous content
nsRefPtr<gfxContext> ctx = new gfxContext(mCurrentSurface);
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
ctx->SetSource(mBackSurface);
// Subtract from mSurfaceDifferenceRect area which is overlapping with rect
nsIntRegion result;
result.Sub(mSurfaceDifferenceRect, nsIntRegion(rect));
nsIntRegionRectIterator iter(result);
const nsIntRect* r;
while ((r = iter.Next()) != nsnull) {
ctx->Rectangle(GfxFromNsRect(*r));
}
ctx->Fill();
}
} else
#endif
{
// Just repaint whole plugin, because we cannot read back from Shmem which is owned by another process
rect.SetRect(0, 0, mWindow.width, mWindow.height);
}
if (mDoAlphaExtraction) {
PaintRectWithAlphaExtraction(rect, mCurrentSurface);
} else {
PaintRectToSurface(rect, mCurrentSurface, gfxRGBA(0.0, 0.0, 0.0, 0.0));
}
NPRect r = { rect.y, rect.x, rect.YMost(), rect.XMost() };
SurfaceDescriptor currSurf;
SurfaceDescriptor outSurf = null_t();
#ifdef MOZ_X11
if (mCurrentSurface->GetType() == gfxASurface::SurfaceTypeXlib) {
gfxXlibSurface *xsurf = static_cast<gfxXlibSurface*>(mCurrentSurface.get());
currSurf = SurfaceDescriptorX11(xsurf->XDrawable(), xsurf->XRenderFormat()->id,
mCurrentSurface->GetSize());
// Need to sync all pending x-paint requests
// before giving drawable to another process
XSync(mWsInfo.display, False);
} else
#endif
if (gfxSharedImageSurface::IsSharedImage(mCurrentSurface)) {
currSurf = static_cast<gfxSharedImageSurface*>(mCurrentSurface.get())->GetShmem();
} else {
NS_RUNTIMEABORT("Surface type is not remotable");
return PR_FALSE;
}
if (!SendShow(r, currSurf, &outSurf)) {
return PR_FALSE;
}
nsRefPtr<gfxASurface> tmp = mCurrentSurface;
mCurrentSurface = mBackSurface;
mBackSurface = tmp;
// Outdated back surface... not usable anymore due to changed plugin size.
// Dropping obsolete surface
if (mCurrentSurface && mBackSurface &&
mCurrentSurface->GetSize() != mBackSurface->GetSize()) {
mCurrentSurface = nsnull;
}
mSurfaceDifferenceRect = rect;
return PR_TRUE;
}
void
PluginInstanceChild::InvalidateRectDelayed(void)
{
if (!mCurrentInvalidateTask) {
return;
}
mCurrentInvalidateTask = nsnull;
if (mAccumulatedInvalidRect.IsEmpty()) {
return;
}
if (!ShowPluginFrame()) {
AsyncShowPluginFrame();
}
}
void
PluginInstanceChild::AsyncShowPluginFrame(void)
{
if (mCurrentInvalidateTask) {
return;
}
mCurrentInvalidateTask =
NewRunnableMethod(this, &PluginInstanceChild::InvalidateRectDelayed);
MessageLoop::current()->PostTask(FROM_HERE, mCurrentInvalidateTask);
}
void
PluginInstanceChild::InvalidateRect(NPRect* aInvalidRect)
{
@ -2446,17 +1954,6 @@ PluginInstanceChild::InvalidateRect(NPRect* aInvalidRect)
}
#endif
if (mLayersRendering) {
nsIntRect r(aInvalidRect->left, aInvalidRect->top,
aInvalidRect->right - aInvalidRect->left,
aInvalidRect->bottom - aInvalidRect->top);
mAccumulatedInvalidRect.UnionRect(r, mAccumulatedInvalidRect);
// If we are able to paint and invalidate sent, then reset
// accumulated rectangle
AsyncShowPluginFrame();
return;
}
SendNPN_InvalidateRect(*aInvalidRect);
}
@ -2534,19 +2031,6 @@ PluginInstanceChild::AnswerNPP_Destroy(NPError* aResult)
PLUGIN_LOG_DEBUG_METHOD;
AssertPluginThread();
if (mBackSurface) {
// Get last surface back, and drop it
SurfaceDescriptor temp = null_t();
NPRect r = { 0, 0, 1, 1 };
SendShow(r, temp, &temp);
}
if (gfxSharedImageSurface::IsSharedImage(mCurrentSurface))
DeallocShmem(static_cast<gfxSharedImageSurface*>(mCurrentSurface.get())->GetShmem());
if (gfxSharedImageSurface::IsSharedImage(mBackSurface))
DeallocShmem(static_cast<gfxSharedImageSurface*>(mBackSurface.get())->GetShmem());
mCurrentSurface = nsnull;
mBackSurface = nsnull;
nsTArray<PBrowserStreamChild*> streams;
ManagedPBrowserStreamChild(streams);
@ -2568,10 +2052,6 @@ PluginInstanceChild::AnswerNPP_Destroy(NPError* aResult)
}
mTimers.Clear();
if (mCurrentInvalidateTask) {
mCurrentInvalidateTask->Cancel();
mCurrentInvalidateTask = nsnull;
}
PluginModuleChild::current()->NPP_Destroy(this);
mData.ndata = 0;

Просмотреть файл

@ -57,7 +57,6 @@
#include "nsRect.h"
#include "nsTHashtable.h"
#include "mozilla/PaintTracker.h"
#include "gfxASurface.h"
namespace mozilla {
namespace plugins {
@ -98,12 +97,6 @@ protected:
virtual bool
AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event, const uint32_t& surface, int16_t* handled);
// Async rendering
virtual bool
RecvAsyncSetWindow(const gfxSurfaceType& aSurfaceType,
const NPRemoteWindow& aWindow);
virtual bool RecvPaintFinished(void);
NS_OVERRIDE
virtual bool
AnswerPaint(const NPRemoteEvent& event, int16_t* handled)
@ -379,102 +372,6 @@ public:
private:
const NPCocoaEvent *mCurrentEvent;
#endif
// ShowPluginFrame - in general does four things:
// 1) Create mCurrentSurface optimized for rendering to parent process
// 2) Updated mCurrentSurface to be a complete copy of mBackSurface
// 3) Draw the invalidated plugin area into mCurrentSurface
// 4) Send it to parent process.
PRBool ShowPluginFrame(void);
// Post ShowPluginFrame task
void AsyncShowPluginFrame(void);
// In the PaintRect functions, aSurface is the size of the full plugin window. Each PaintRect function
// renders into the subrectangle aRect of aSurface (possibly more if we're working around a Flash bug).
// Paint plugin content rectangle to surface with bg color filling
void PaintRectToSurface(const nsIntRect& aRect,
gfxASurface* aSurface,
const gfxRGBA& aColor);
// Render plugin content to surface using
// white/black image alpha extraction algorithm
void PaintRectWithAlphaExtraction(const nsIntRect& aRect,
gfxASurface* aSurface);
// Call plugin NPAPI function to render plugin content to surface
// @param - aSurface - should be compatible with current platform plugin rendering
// @return - FALSE if plugin not painted to surface
void PaintRectToPlatformSurface(const nsIntRect& aRect,
gfxASurface* aSurface);
// Update NPWindow platform attributes and call plugin "setwindow"
// @param - aForceSetWindow - call setwindow even if platform attributes are the same
void UpdateWindowAttributes(PRBool aForceSetWindow = PR_FALSE);
// Create optimized mCurrentSurface for parent process rendering
// @return FALSE if optimized surface not created
PRBool CreateOptSurface(void);
// Create mHelperSurface if mCurrentSurface non compatible with plugins
// @return TRUE if helper surface created successfully, or not needed
PRBool MaybeCreatePlatformHelperSurface(void);
// Make sure that we have surface for rendering
PRBool EnsureCurrentBuffer(void);
// Helper function for delayed InvalidateRect call
// non null mCurrentInvalidateTask will call this function
void InvalidateRectDelayed(void);
// Set as true when SetupLayer called
// and go with different path in InvalidateRect function
PRPackedBool mLayersRendering;
// Current surface available for rendering
nsRefPtr<gfxASurface> mCurrentSurface;
// Back surface, just keeping reference to
// surface which is on ParentProcess side
nsRefPtr<gfxASurface> mBackSurface;
// Accumulated invalidate rect, while back buffer is not accessible
nsIntRect mAccumulatedInvalidRect;
// Plugin only call SetTransparent
// and does not remember their transparent state
// and p->getvalue return always false
PRPackedBool mIsTransparent;
// Surface type optimized of parent process
gfxSurfaceType mSurfaceType;
// set TRUE if plugin surface dropped in asyncSetWindow
// if TRUE then initiate full repaint in RecvPaintFinished
PRPackedBool mPendingForcePaint;
// Keep InvalidateRect task pointer to be able Cancel it on Destroy
CancelableTask *mCurrentInvalidateTask;
// True while plugin-child in plugin call
// Use to prevent plugin paint re-enter
PRPackedBool mPendingPluginCall;
// On some platforms, plugins may not support rendering to a surface with
// alpha, or not support rendering to an image surface.
// In those cases we need to draw to a temporary platform surface; we cache
// that surface here.
nsRefPtr<gfxASurface> mHelperSurface;
// true when plugin does not support painting to ARGB32 surface
// this is false for maemo platform, and false if plugin
// supports NPPVpluginTransparentAlphaBool (which is not part of NPAPI yet)
PRPackedBool mDoAlphaExtraction;
// Cached rectangle rendered to previous surface(mBackSurface)
// Used for reading back to current surface and syncing data
nsIntRect mSurfaceDifferenceRect;
#ifdef MOZ_X11
// Used with windowless flash plugin only, see bug 574583
PRPackedBool mFlash10Quirks;
#endif
};
} // namespace plugins

Просмотреть файл

@ -46,16 +46,6 @@
#include "npfunctions.h"
#include "nsAutoPtr.h"
#include "mozilla/unused.h"
#include "gfxASurface.h"
#include "gfxContext.h"
#include "gfxPlatform.h"
#include "gfxSharedImageSurface.h"
#ifdef MOZ_X11
#include "gfxXlibSurface.h"
#endif
#include "gfxContext.h"
#include "gfxColor.h"
#include "gfxUtils.h"
#if defined(OS_WIN)
#include <windowsx.h>
@ -98,7 +88,6 @@ PluginInstanceParent::PluginInstanceParent(PluginModuleParent* parent,
, mDrawingModel(NPDrawingModelCoreGraphics)
, mIOSurface(nsnull)
#endif
, mSentPaintNotification(PR_FALSE)
{
InitQuirksModes(aMimeType);
}
@ -471,101 +460,22 @@ PluginInstanceParent::RecvNPN_InvalidateRect(const NPRect& rect)
return true;
}
bool
PluginInstanceParent::RecvShow(const NPRect& updatedRect,
const SurfaceDescriptor& newSurface,
SurfaceDescriptor* prevSurface)
{
nsRefPtr<gfxASurface> surface;
if (newSurface.type() == SurfaceDescriptor::TShmem) {
if (!newSurface.get_Shmem().IsReadable()) {
NS_WARNING("back surface not readable");
return false;
}
surface = new gfxSharedImageSurface(newSurface.get_Shmem());
}
#ifdef MOZ_X11
else if (newSurface.type() == SurfaceDescriptor::TSurfaceDescriptorX11) {
SurfaceDescriptorX11 xdesc = newSurface.get_SurfaceDescriptorX11();
XRenderPictFormat pf;
pf.id = xdesc.xrenderPictID();
XRenderPictFormat *incFormat =
XRenderFindFormat(DefaultXDisplay(), PictFormatID, &pf, 0);
surface =
new gfxXlibSurface(DefaultScreenOfDisplay(DefaultXDisplay()),
xdesc.XID(), incFormat, xdesc.size());
}
#endif
mSentPaintNotification = PR_FALSE;
if (mFrontSurface) {
#ifdef MOZ_X11
if (mFrontSurface->GetType() == gfxASurface::SurfaceTypeXlib) {
gfxXlibSurface *xsurf = static_cast<gfxXlibSurface*>(mFrontSurface.get());
*prevSurface =
SurfaceDescriptorX11(xsurf->XDrawable(), xsurf->XRenderFormat()->id,
mFrontSurface->GetSize());
} else
#endif
if (gfxSharedImageSurface::IsSharedImage(mFrontSurface)) {
*prevSurface = static_cast<gfxSharedImageSurface*>(mFrontSurface.get())->GetShmem();
} else {
*prevSurface = null_t();
}
} else {
*prevSurface = null_t();
}
mFrontSurface = surface;
RecvNPN_InvalidateRect(updatedRect);
#ifdef MOZ_X11
// Sync prevSurface before sending to child
if (prevSurface->type() == SurfaceDescriptor::TSurfaceDescriptorX11) {
XSync(DefaultXDisplay(), False);
}
#endif
return true;
}
nsresult
PluginInstanceParent::AsyncSetWindow(NPWindow* aWindow)
{
NPRemoteWindow window;
mWindowType = aWindow->type;
window.window = reinterpret_cast<unsigned long>(aWindow->window);
window.x = aWindow->x;
window.y = aWindow->y;
window.width = aWindow->width;
window.height = aWindow->height;
window.clipRect = aWindow->clipRect;
window.type = aWindow->type;
mSentPaintNotification = PR_FALSE;
if (!SendAsyncSetWindow(gfxPlatform::GetPlatform()->ScreenReferenceSurface()->GetType(),
window))
return NS_ERROR_FAILURE;
return NS_OK;
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
PluginInstanceParent::NotifyPainted(void)
{
bool rv = true;
if (!mSentPaintNotification) {
rv = SendPaintFinished();
mSentPaintNotification = rv;
}
return rv ? NS_OK : NS_ERROR_FAILURE;
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
PluginInstanceParent::GetSurface(gfxASurface** aSurface)
{
if (mFrontSurface) {
NS_ADDREF(*aSurface = mFrontSurface);
return NS_OK;
}
return NS_ERROR_NOT_AVAILABLE;
return NS_ERROR_NOT_IMPLEMENTED;
}
NPError

Просмотреть файл

@ -52,10 +52,6 @@
#include "nsDataHashtable.h"
#include "nsHashKeys.h"
#include "nsRect.h"
#include "gfxASurface.h"
#ifdef MOZ_X11
class gfxXlibSurface;
#endif
namespace mozilla {
namespace plugins {
@ -169,12 +165,6 @@ public:
virtual bool
RecvNPN_InvalidateRect(const NPRect& rect);
// Async rendering
virtual bool
RecvShow(const NPRect& updatedRect,
const SurfaceDescriptor& newSurface,
SurfaceDescriptor* prevSurface);
virtual bool
AnswerNPN_PushPopupsEnabledState(const bool& aState);
@ -318,12 +308,6 @@ private:
int16_t mDrawingModel;
nsIOSurface *mIOSurface;
#endif // definied(OS_MACOSX)
// ObjectFrame layer wrapper
nsRefPtr<gfxASurface> mFrontSurface;
// Don't spam plugin process with extra paint notifications
PRPackedBool mSentPaintNotification;
};

Просмотреть файл

@ -90,11 +90,6 @@ PluginProcessChild::Init()
# error Sorry
#endif
if (NS_FAILED(nsRegion::InitStatic())) {
NS_ERROR("Could not initialize nsRegion");
return false;
}
mPlugin.Init(pluginFilename, ParentHandle(),
IOThreadChild::message_loop(),
IOThreadChild::channel());
@ -108,7 +103,6 @@ PluginProcessChild::CleanUp()
#ifdef XP_WIN
::OleUninitialize();
#endif
nsRegion::ShutdownStatic();
}
/* static */

Просмотреть файл

@ -192,27 +192,3 @@ gfxImageSurface::CopyFrom(gfxImageSurface *other)
return PR_TRUE;
}
already_AddRefed<gfxSubimageSurface>
gfxImageSurface::GetSubimage(const gfxRect& aRect)
{
gfxRect r(aRect);
r.Round();
unsigned char* subData = Data() +
(Stride() * (int)r.Y()) +
(int)r.X() * gfxASurface::BytePerPixelFromFormat(Format());
nsRefPtr<gfxSubimageSurface> image =
new gfxSubimageSurface(this, subData,
gfxIntSize((int)r.Width(), (int)r.Height()));
return image.forget().get();
}
gfxSubimageSurface::gfxSubimageSurface(gfxImageSurface* aParent,
unsigned char* aData,
const gfxIntSize& aSize)
: gfxImageSurface(aData, aSize, aParent->Stride(), aParent->Format())
, mParent(aParent)
{
}

Просмотреть файл

@ -43,8 +43,6 @@
// ARGB -- raw buffer.. wont be changed.. good for storing data.
class gfxSubimageSurface;
/**
* A raw image buffer. The format can be set in the constructor. Its main
* purpose is for storing read-only images and using it as a source surface,
@ -101,11 +99,6 @@ public:
/* Fast copy from another image surface; returns TRUE if successful, FALSE otherwise */
PRBool CopyFrom (gfxImageSurface *other);
/* return new Subimage with pointing to original image starting from aRect.pos
* and size of aRect.size. New subimage keeping current image reference
*/
already_AddRefed<gfxSubimageSurface> GetSubimage(const gfxRect& aRect);
protected:
gfxImageSurface();
void InitFromSurface(cairo_surface_t *csurf);
@ -118,14 +111,4 @@ protected:
long mStride;
};
class THEBES_API gfxSubimageSurface : public gfxImageSurface {
protected:
friend class gfxImageSurface;
gfxSubimageSurface(gfxImageSurface* aParent,
unsigned char* aData,
const gfxIntSize& aSize);
private:
nsRefPtr<gfxImageSurface> mParent;
};
#endif /* GFX_IMAGESURFACE_H */

Просмотреть файл

@ -50,7 +50,6 @@
#include "gfxPattern.h"
#include "nsRect.h"
#include "nsRegion.h"
#include "gfxASurface.h"
#ifdef _MSC_VER
#pragma warning( disable : 4800 )
@ -60,7 +59,6 @@
namespace mozilla {
typedef gfxPattern::GraphicsFilter GraphicsFilterType;
typedef gfxASurface::gfxSurfaceType gfxSurfaceType;
// XXX there are out of place and might be generally useful. Could
// move to nscore.h or something.
@ -421,38 +419,6 @@ struct ParamTraits<mozilla::GraphicsFilterType>
}
}
};
template<>
struct ParamTraits<mozilla::gfxSurfaceType>
{
typedef mozilla::gfxSurfaceType paramType;
static void Write(Message* msg, const paramType& param)
{
if (gfxASurface::SurfaceTypeImage <= param &&
param < gfxASurface::SurfaceTypeMax) {
WriteParam(msg, int32(param));
return;
}
NS_RUNTIMEABORT("surface type not reached");
}
static bool Read(const Message* msg, void** iter, paramType* result)
{
int32 filter;
if (!ReadParam(msg, iter, &filter))
return false;
if (gfxASurface::SurfaceTypeImage <= filter &&
filter < gfxASurface::SurfaceTypeMax) {
*result = paramType(filter);
return true;
}
return false;
}
};
template<>
struct ParamTraits<gfxRGBA>
{
@ -586,24 +552,6 @@ struct ParamTraits<nsIntSize>
}
};
template<>
struct ParamTraits<gfxIntSize>
{
typedef gfxIntSize paramType;
static void Write(Message* msg, const paramType& param)
{
WriteParam(msg, param.width);
WriteParam(msg, param.height);
}
static bool Read(const Message* msg, void** iter, paramType* result)
{
return (ReadParam(msg, iter, &result->width) &&
ReadParam(msg, iter, &result->height));
}
};
} /* namespace IPC */
#endif /* __IPC_GLUE_IPCMESSAGEUTILS_H__ */

Просмотреть файл

@ -218,21 +218,6 @@ function runTest4() {
function runTest4end() {
printpreview();
exitprintpreview();
setTimeout(runTest5, 0);
}
// This is a crash test for bug 595337
function runTest5() {
window.frames[0].document.body.innerHTML =
'<iframe style="position: fixed; visibility: hidden; bottom: 10em;"></iframe>' +
'<input contenteditable="true" style="display: table; page-break-before: left; width: 10000px;">';
setTimeout(runTest5end, 500);
}
function runTest5end() {
printpreview();
exitprintpreview();
SimpleTest.finish();
window.close();
}

Просмотреть файл

@ -1353,11 +1353,11 @@ nsTextControlFrame::SetInitialChildList(nsIAtom* aListName,
// than descending from the root frame of the frame hierarchy.
if (first) {
first->AddStateBits(NS_FRAME_REFLOW_ROOT);
nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
NS_ASSERTION(txtCtrl, "Content not a text control element");
txtCtrl->InitializeKeyboardEventListeners();
}
nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent());
NS_ASSERTION(txtCtrl, "Content not a text control element");
txtCtrl->InitializeKeyboardEventListeners();
return rv;
}

Просмотреть файл

@ -152,7 +152,6 @@ enum { XKeyPress = KeyPress };
#include "nsThreadUtils.h"
#include "gfxContext.h"
#include "gfxPlatform.h"
#ifdef XP_WIN
#include "gfxWindowsNativeDrawing.h"
@ -160,8 +159,6 @@ enum { XKeyPress = KeyPress };
#endif
#include "gfxImageSurface.h"
#include "gfxUtils.h"
#include "Layers.h"
// accessibility support
#ifdef ACCESSIBILITY
@ -236,8 +233,6 @@ static PRLogModuleInfo *nsObjectFrameLM = PR_NewLogModule("nsObjectFrame");
#define MAC_CARBON_PLUGINS
#endif
using namespace mozilla::layers;
// special class for handeling DOM context menu events because for
// some reason it starves other mouse events if implemented on the
// same class
@ -452,28 +447,7 @@ public:
nsIDOMClientRect* clip);
#endif
void NotifyPaintWaiter(nsDisplayListBuilder* aBuilder,
LayerManager* aManager);
// Return true if we set image with valid surface
PRBool SetCurrentImage(ImageContainer* aContainer);
PRBool UseLayers()
{
return (mUsePluginLayers &&
(!mPluginWindow ||
mPluginWindow->type == NPWindowTypeDrawable));
}
private:
// return FALSE if LayerSurface dirty (newly created and don't have valid plugin content yet)
PRBool IsUpToDate()
{
nsRefPtr<gfxASurface> readyToUse;
return NS_SUCCEEDED(mInstance->GetSurface(getter_AddRefs(readyToUse))) &&
readyToUse && readyToUse->GetSize() == gfxIntSize(mPluginWindow->width,
mPluginWindow->height);
}
void FixUpURLS(const nsString &name, nsAString &value);
nsPluginNativeWindow *mPluginWindow;
@ -590,10 +564,6 @@ private:
PRBool UpdateVisibility(PRBool aVisible);
#endif
nsRefPtr<gfxASurface> mLayerSurface;
PRPackedBool mWaitingForPaint;
PRPackedBool mUsePluginLayers;
};
// Mac specific code to fix up port position and clip
@ -1121,12 +1091,7 @@ nsObjectFrame::CallSetWindow()
// this will call pi->SetWindow and take care of window subclassing
// if needed, see bug 132759.
if (mInstanceOwner->UseLayers()) {
pi->AsyncSetWindow(window);
}
else {
window->CallSetWindow(pi);
}
window->CallSetWindow(pi);
mInstanceOwner->ReleasePluginPort(window->window);
}
@ -1235,16 +1200,8 @@ nsObjectFrame::PaintPrintPlugin(nsIFrame* aFrame, nsIRenderingContext* aCtx,
nsRect
nsDisplayPlugin::GetBounds(nsDisplayListBuilder* aBuilder)
{
nsRect r = mFrame->GetContentRect() - mFrame->GetPosition() +
return mFrame->GetContentRect() - mFrame->GetPosition() +
ToReferenceFrame();
nsObjectFrame* f = static_cast<nsObjectFrame*>(mFrame);
if (mozilla::LAYER_ACTIVE == f->GetLayerState(aBuilder, nsnull)) {
gfxIntSize size = f->GetImageContainer()->GetCurrentSize();
PRInt32 appUnitsPerDevPixel = f->PresContext()->AppUnitsPerDevPixel();
r -= nsPoint((r.width - size.width * appUnitsPerDevPixel) / 2,
(r.height - size.height * appUnitsPerDevPixel) / 2);
}
return r;
}
void
@ -1640,137 +1597,6 @@ nsObjectFrame::PrintPlugin(nsIRenderingContext& aRenderingContext,
nsnull, status); // DidReflow will take care of it
}
ImageContainer*
nsObjectFrame::GetImageContainer()
{
if (mImageContainer)
return mImageContainer;
nsRefPtr<LayerManager> manager =
nsContentUtils::LayerManagerForDocument(mContent->GetOwnerDoc());
if (!manager)
return nsnull;
mImageContainer = manager->CreateImageContainer();
return mImageContainer;
}
void
nsPluginInstanceOwner::NotifyPaintWaiter(nsDisplayListBuilder* aBuilder,
LayerManager* aManager)
{
// This is notification for reftests about async plugin paint start
if (!mWaitingForPaint && !IsUpToDate() && aBuilder->ShouldSyncDecodeImages()) {
nsContentUtils::DispatchTrustedEvent(mContent->GetOwnerDoc(), mContent,
NS_LITERAL_STRING("MozPaintWait"),
PR_TRUE, PR_TRUE);
mWaitingForPaint = PR_TRUE;
}
}
PRBool
nsPluginInstanceOwner::SetCurrentImage(ImageContainer* aContainer)
{
mInstance->GetSurface(getter_AddRefs(mLayerSurface));
if (!mLayerSurface)
return PR_FALSE;
Image::Format format = Image::CAIRO_SURFACE;
nsRefPtr<Image> image;
image = aContainer->CreateImage(&format, 1);
if (!image)
return PR_FALSE;
NS_ASSERTION(image->GetFormat() == Image::CAIRO_SURFACE, "Wrong format?");
CairoImage* pluginImage = static_cast<CairoImage*>(image.get());
CairoImage::Data cairoData;
cairoData.mSurface = mLayerSurface.get();
cairoData.mSize = mLayerSurface->GetSize();
pluginImage->SetData(cairoData);
aContainer->SetCurrentImage(image);
return PR_TRUE;
}
mozilla::LayerState
nsObjectFrame::GetLayerState(nsDisplayListBuilder* aBuilder,
LayerManager* aManager)
{
if (!mInstanceOwner || !mInstanceOwner->UseLayers())
return mozilla::LAYER_NONE;
return mozilla::LAYER_ACTIVE;
}
already_AddRefed<Layer>
nsObjectFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
nsDisplayItem* aItem)
{
if (!mInstanceOwner)
return nsnull;
NPWindow* window = nsnull;
mInstanceOwner->GetWindow(window);
if (!window)
return nsnull;
if (window->width <= 0 || window->height <= 0)
return nsnull;
nsRect area = GetContentRect() + aBuilder->ToReferenceFrame(GetParent());
gfxRect r = nsLayoutUtils::RectToGfxRect(area, PresContext()->AppUnitsPerDevPixel());
// to provide crisper and faster drawing.
r.Round();
nsRefPtr<Layer> layer =
(aBuilder->LayerBuilder()->GetLeafLayerFor(aBuilder, aManager, aItem));
if (!layer) {
mInstanceOwner->NotifyPaintWaiter(aBuilder, aManager);
// Initialize ImageLayer
layer = aManager->CreateImageLayer();
}
nsCOMPtr<nsIPluginInstance> pi;
mInstanceOwner->GetInstance(*getter_AddRefs(pi));
// Give plugin info about layer paint
if (pi) {
if (NS_FAILED(pi->NotifyPainted())) {
return nsnull;
}
}
if (!layer)
return nsnull;
NS_ASSERTION(layer->GetType() == Layer::TYPE_IMAGE, "ObjectFrame works only with ImageLayer");
// Create image
nsRefPtr<ImageContainer> container = GetImageContainer();
if (!container)
return nsnull;
if (!mInstanceOwner->SetCurrentImage(container)) {
return nsnull;
}
ImageLayer* imglayer = static_cast<ImageLayer*>(layer.get());
imglayer->SetContainer(container);
imglayer->SetFilter(nsLayoutUtils::GetGraphicsFilterForFrame(this));
layer->SetContentFlags(IsOpaque() ? Layer::CONTENT_OPAQUE : 0);
// Set a transform on the layer to draw the plugin in the right place
gfxMatrix transform;
// Center plugin if layer size != frame rect
r.pos.x += (r.Width() - container->GetCurrentSize().width) / 2;
r.pos.y += (r.Height() - container->GetCurrentSize().height) / 2;
transform.Translate(r.pos);
layer->SetTransform(gfx3DMatrix::From2D(transform));
nsRefPtr<Layer> result = layer.forget();
return result.forget();
}
void
nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect, const nsRect& aPluginRect)
@ -2737,16 +2563,6 @@ nsPluginInstanceOwner::nsPluginInstanceOwner()
mEventModel = NPEventModelCocoa;
#endif
#endif
mWaitingForPaint = PR_FALSE;
mUsePluginLayers =
nsContentUtils::GetBoolPref("mozilla.plugins.use_layers",
#ifdef MOZ_X11
PR_TRUE); // Lets test plugin layers on X11 first
#else
PR_FALSE); // Lets test plugin layers on X11 first
#endif
PR_LOG(nsObjectFrameLM, PR_LOG_DEBUG,
("nsPluginInstanceOwner %p created\n", this));
}
@ -3014,22 +2830,6 @@ NS_IMETHODIMP nsPluginInstanceOwner::InvalidateRect(NPRect *invalidRect)
if (!mObjectFrame || !invalidRect || !mWidgetVisible)
return NS_ERROR_FAILURE;
// Each time an asynchronously-drawing plugin sends a new surface to display,
// InvalidateRect is called. We notify reftests that painting is up to
// date and update our ImageContainer with the new surface.
nsRefPtr<ImageContainer> container = mObjectFrame->GetImageContainer();
if (container) {
SetCurrentImage(container);
}
if (mWaitingForPaint && IsUpToDate()) {
nsContentUtils::DispatchTrustedEvent(mContent->GetOwnerDoc(), mContent,
NS_LITERAL_STRING("MozPaintWaitFinished"),
PR_TRUE, PR_TRUE);
mWaitingForPaint = false;
}
#ifdef MOZ_USE_IMAGE_EXPOSE
PRBool simpleImageRender = PR_FALSE;
mInstance->GetValueFromPlugin(NPPVpluginWindowlessLocalBool,
@ -5285,13 +5085,6 @@ nsPluginInstanceOwner::Destroy()
void
nsPluginInstanceOwner::PrepareToStop(PRBool aDelayedStop)
{
// Drop image reference because the child may destroy the surface after we return.
if (mLayerSurface) {
nsRefPtr<ImageContainer> container = mObjectFrame->GetImageContainer();
container->SetCurrentImage(nsnull);
mLayerSurface = nsnull;
}
#if defined(XP_WIN) || defined(MOZ_X11)
if (aDelayedStop && mWidget) {
// To delay stopping a plugin we need to reparent the plugin

Просмотреть файл

@ -49,8 +49,6 @@
#include "nsRegion.h"
#include "nsDisplayList.h"
#include "nsIReflowCallback.h"
#include "Layers.h"
#include "ImageLayers.h"
#ifdef ACCESSIBILITY
class nsIAccessible;
@ -69,11 +67,6 @@ class nsObjectFrame : public nsObjectFrameSuper,
public nsIObjectFrame,
public nsIReflowCallback {
public:
typedef mozilla::LayerState LayerState;
typedef mozilla::layers::Layer Layer;
typedef mozilla::layers::LayerManager LayerManager;
typedef mozilla::layers::ImageContainer ImageContainer;
NS_DECL_FRAMEARENA_HELPERS
friend nsIFrame* NS_NewObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
@ -176,15 +169,6 @@ public:
virtual PRBool ReflowFinished();
virtual void ReflowCallbackCanceled();
already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
LayerManager* aManager,
nsDisplayItem* aItem);
virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
LayerManager* aManager);
ImageContainer* GetImageContainer();
protected:
nsObjectFrame(nsStyleContext* aContext);
virtual ~nsObjectFrame();
@ -282,10 +266,6 @@ private:
PRBool mPreventInstantiation;
PRPackedBool mReflowCallbackPosted;
// A reference to the ImageContainer which contains the current frame
// of plugin to display.
nsRefPtr<ImageContainer> mImageContainer;
};
class nsDisplayPlugin : public nsDisplayItem {
@ -320,18 +300,6 @@ public:
void GetWidgetConfiguration(nsDisplayListBuilder* aBuilder,
nsTArray<nsIWidget::Configuration>* aConfigurations);
virtual already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
LayerManager* aManager)
{
return static_cast<nsObjectFrame*>(mFrame)->BuildLayer(aBuilder, aManager, this);
}
virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
LayerManager* aManager)
{
return static_cast<nsObjectFrame*>(mFrame)->GetLayerState(aBuilder, aManager);
}
private:
nsRegion mVisibleRegion;
};

Просмотреть файл

@ -95,19 +95,6 @@ var gTestResults = {
};
var gTotalTests = 0;
var gState;
// Plugin layers are painting asynchronously, and to make sure that all
// layer surfaces have right content, we should listen for async
// paint-"begin"/"end" events ("MozPaintWait" and "MozPaintWaitFinished").
// If plugin layer surface is dirty(just created) and layout
// builder->ShouldSyncDecodeImages == true, then "MozPaintWait" event will be
// fired and gExplicitPendingPaintCounter increased.
// When plugin layer surface fully painted and "MozPaintWait" has been fired
// before, then "MozPaintWaitFinished" fired and gExplicitPendingPaintCounter
// decreased. Reftest snapshot can be taken only when gExplicitPendingPaintCounter == 0
var gExplicitPendingPaintCounter = 0;
var gTestContainsAsyncPaintObjects = false;
var gRunningReftestWaitTest = false;
var gAttrListenerFunc = null;
var gCurrentURL;
var gFailureTimeout = null;
var gFailureReason;
@ -175,32 +162,6 @@ function ReleaseCanvas(canvas)
gRecycledCanvases.push(canvas);
}
function PaintWaitListener()
{
// Increate paint wait counter
// prevent snapshots taking with not up to dated content
gExplicitPendingPaintCounter++;
}
function PaintWaitFinishedListener()
{
gExplicitPendingPaintCounter--;
if (gExplicitPendingPaintCounter == 0) {
if (gRunningReftestWaitTest) {
// tests with reftest-wait class already waiting
// and we just need take snapshot and finish reftest
gAttrListenerFunc();
} else if (gTestContainsAsyncPaintObjects) {
gTestContainsAsyncPaintObjects = false;
// tests without reftest-wait class
// and with detected async rendering objects rendering
// need to do mini restart of the test
setTimeout(setTimeout, 0, DocumentLoaded, 0);
}
}
}
function OnRefTestLoad()
{
gBrowser = document.getElementById("browser");
@ -273,10 +234,6 @@ function OnRefTestLoad()
// Focus the content browser
gBrowser.focus();
// Connect to async rendering notifications
gBrowser.addEventListener("MozPaintWait", PaintWaitListener, true);
gBrowser.addEventListener("MozPaintWaitFinished", PaintWaitFinishedListener, true);
StartTests();
}
@ -896,7 +853,6 @@ function OnDocumentLoad(event)
setupZoom(contentRootElement);
if (shouldWait()) {
gRunningReftestWaitTest = true;
// The testcase will let us know when the test snapshot should be made.
// Register a mutation listener to know when the 'reftest-wait' class
// gets removed.
@ -947,8 +903,7 @@ function OnDocumentLoad(event)
// When stopAfteraintReceived is set, we can stop --- but we should keep going as long
// as there are paint events coming (there probably shouldn't be any, but it doesn't
// hurt to process them)
if (stopAfterPaintReceived && !utils.isMozAfterPaintPending &&
!gExplicitPendingPaintCounter) {
if (stopAfterPaintReceived && !gWindowUtils.isMozAfterPaintPending) {
FinishWaitingForTestEnd();
}
}
@ -970,14 +925,8 @@ function OnDocumentLoad(event)
// to complete and unsuppress painting before we check isMozAfterPaintPending.
setTimeout(AttrModifiedListenerContinuation, 0);
}
// Set global pointer to this function to be able call it from PaintWaitFinishedListener
gAttrListenerFunc = AttrModifiedListener;
function AttrModifiedListenerContinuation() {
if (gExplicitPendingPaintCounter) {
return;
}
if (doPrintMode())
setupPrintMode();
FlushRendering();
@ -1024,7 +973,6 @@ function OnDocumentLoad(event)
// StartWaitingForTestEnd runs after that invalidation has been requested.
setTimeout(StartWaitingForTestEnd, 0);
} else {
gRunningReftestWaitTest = false;
if (doPrintMode())
setupPrintMode();
@ -1241,14 +1189,6 @@ function DocumentLoaded()
gCurrentCanvas = gURICanvases[gCurrentURL];
} else if (gCurrentCanvas == null) {
InitCurrentCanvasWithSnapshot();
if (gExplicitPendingPaintCounter) {
// reftest contain elements wich are waiting paint to be finished
// lets cancel this reftest run, and let "MozPaintWaitFinished"-listener
// know that we need to restart reftest when all paints are finished
gTestContainsAsyncPaintObjects = true;
gCurrentCanvas = null;
return;
}
}
if (gState == 1) {
gCanvas1 = gCurrentCanvas;