зеркало из https://github.com/mozilla/pjs.git
Implement InvalidatingCoreAnimation Drawing Model. b=559211 r=josh
This commit is contained in:
Родитель
6a3de07a02
Коммит
6c5f81357a
|
@ -358,6 +358,11 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar,
|
|||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
case NPNVsupportsInvalidatingCoreAnimationBool: {
|
||||
*((NPBool*)aValue) = true;
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
case NPNVsupportsCocoaBool: {
|
||||
*((NPBool*)aValue) = true;
|
||||
return NPERR_NO_ERROR;
|
||||
|
|
|
@ -343,14 +343,16 @@ PluginInstanceParent::AnswerNPN_SetValue_NPPVpluginDrawingModel(
|
|||
const int& drawingModel, NPError* result)
|
||||
{
|
||||
#ifdef XP_MACOSX
|
||||
if (drawingModel == NPDrawingModelCoreAnimation) {
|
||||
if (drawingModel == NPDrawingModelCoreAnimation ||
|
||||
drawingModel == NPDrawingModelInvalidatingCoreAnimation) {
|
||||
// We need to request CoreGraphics otherwise
|
||||
// the nsObjectFrame will try to draw a CALayer
|
||||
// that can not be shared across process.
|
||||
mDrawingModel = NPDrawingModelCoreAnimation;
|
||||
mDrawingModel = drawingModel;
|
||||
*result = mNPNIface->setvalue(mNPP, NPPVpluginDrawingModel,
|
||||
(void*)NPDrawingModelCoreGraphics);
|
||||
if (mQuirks & COREANIMATION_REFRESH_TIMER) {
|
||||
if (drawingModel == NPDrawingModelCoreAnimation &&
|
||||
mQuirks & COREANIMATION_REFRESH_TIMER) {
|
||||
mParent->AddToRefreshTimer(this);
|
||||
}
|
||||
} else {
|
||||
|
@ -505,7 +507,8 @@ PluginInstanceParent::NPP_SetWindow(const NPWindow* aWindow)
|
|||
|
||||
#if defined(XP_MACOSX)
|
||||
if (mShWidth != window.width || mShHeight != window.height) {
|
||||
if (mDrawingModel == NPDrawingModelCoreAnimation) {
|
||||
if (mDrawingModel == NPDrawingModelCoreAnimation ||
|
||||
mDrawingModel == NPDrawingModelInvalidatingCoreAnimation) {
|
||||
if (mIOSurface) {
|
||||
delete mIOSurface;
|
||||
}
|
||||
|
@ -720,7 +723,8 @@ PluginInstanceParent::NPP_HandleEvent(void* event)
|
|||
|
||||
#ifdef XP_MACOSX
|
||||
if (npevent->type == NPCocoaEventDrawRect) {
|
||||
if (mDrawingModel == NPDrawingModelCoreAnimation) {
|
||||
if (mDrawingModel == NPDrawingModelCoreAnimation ||
|
||||
mDrawingModel == NPDrawingModelInvalidatingCoreAnimation) {
|
||||
if (!mIOSurface) {
|
||||
NS_ERROR("No IOSurface allocated.");
|
||||
return false;
|
||||
|
|
|
@ -785,9 +785,6 @@ nsObjectFrame::CreateWidget(nscoord aWidth,
|
|||
pluginWidget->SetPluginEventModel(mInstanceOwner->GetEventModel());
|
||||
|
||||
if (mInstanceOwner->GetDrawingModel() == NPDrawingModelCoreAnimation) {
|
||||
NPWindow* window;
|
||||
mInstanceOwner->GetWindow(window);
|
||||
|
||||
mInstanceOwner->SetupCARefresh();
|
||||
}
|
||||
#endif
|
||||
|
@ -1573,7 +1570,9 @@ nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext,
|
|||
// delegate all painting to the plugin instance.
|
||||
if (mInstanceOwner) {
|
||||
if (mInstanceOwner->GetDrawingModel() == NPDrawingModelCoreGraphics ||
|
||||
mInstanceOwner->GetDrawingModel() == NPDrawingModelCoreAnimation) {
|
||||
mInstanceOwner->GetDrawingModel() == NPDrawingModelCoreAnimation ||
|
||||
mInstanceOwner->GetDrawingModel() ==
|
||||
NPDrawingModelInvalidatingCoreAnimation) {
|
||||
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.
|
||||
|
@ -1652,7 +1651,9 @@ nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext,
|
|||
#endif
|
||||
|
||||
mInstanceOwner->BeginCGPaint();
|
||||
if (mInstanceOwner->GetDrawingModel() == NPDrawingModelCoreAnimation) {
|
||||
if (mInstanceOwner->GetDrawingModel() == NPDrawingModelCoreAnimation ||
|
||||
mInstanceOwner->GetDrawingModel() ==
|
||||
NPDrawingModelInvalidatingCoreAnimation) {
|
||||
// CoreAnimation is updated, render the layer and perform a readback.
|
||||
mInstanceOwner->RenderCoreAnimation(cgContext, window->width, window->height);
|
||||
} else {
|
||||
|
@ -3684,7 +3685,8 @@ void* nsPluginInstanceOwner::GetPluginPortCopy()
|
|||
return &mQDPluginPortCopy;
|
||||
#endif
|
||||
if (GetDrawingModel() == NPDrawingModelCoreGraphics ||
|
||||
GetDrawingModel() == NPDrawingModelCoreAnimation)
|
||||
GetDrawingModel() == NPDrawingModelCoreAnimation ||
|
||||
GetDrawingModel() == NPDrawingModelInvalidatingCoreAnimation)
|
||||
return &mCGPluginPortCopy;
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -3719,7 +3721,8 @@ void* nsPluginInstanceOwner::SetPluginPortAndDetectChange()
|
|||
mPluginPortChanged = PR_TRUE;
|
||||
}
|
||||
} else if (drawingModel == NPDrawingModelCoreGraphics ||
|
||||
drawingModel == NPDrawingModelCoreAnimation)
|
||||
drawingModel == NPDrawingModelCoreAnimation ||
|
||||
drawingModel == NPDrawingModelInvalidatingCoreAnimation)
|
||||
#endif
|
||||
{
|
||||
#ifndef NP_NO_CARBON
|
||||
|
@ -5770,7 +5773,8 @@ void* nsPluginInstanceOwner::GetPluginPortFromWidget()
|
|||
#endif
|
||||
#ifdef XP_MACOSX
|
||||
if (GetDrawingModel() == NPDrawingModelCoreGraphics ||
|
||||
GetDrawingModel() == NPDrawingModelCoreAnimation)
|
||||
GetDrawingModel() == NPDrawingModelCoreAnimation ||
|
||||
GetDrawingModel() == NPDrawingModelInvalidatingCoreAnimation)
|
||||
result = mWidget->GetNativeData(NS_NATIVE_PLUGIN_PORT_CG);
|
||||
else
|
||||
#endif
|
||||
|
@ -5943,7 +5947,8 @@ void* nsPluginInstanceOwner::FixUpPluginWindow(PRInt32 inPaintState)
|
|||
mPluginWindow->y = -static_cast<NP_Port*>(pluginPort)->porty;
|
||||
}
|
||||
else if (drawingModel == NPDrawingModelCoreGraphics ||
|
||||
drawingModel == NPDrawingModelCoreAnimation)
|
||||
drawingModel == NPDrawingModelCoreAnimation ||
|
||||
drawingModel == NPDrawingModelInvalidatingCoreAnimation)
|
||||
#endif
|
||||
{
|
||||
// This would be a lot easier if we could use obj-c here,
|
||||
|
|
|
@ -257,7 +257,8 @@ typedef enum {
|
|||
#endif
|
||||
NPDrawingModelCoreGraphics = 1,
|
||||
NPDrawingModelOpenGL = 2,
|
||||
NPDrawingModelCoreAnimation = 3
|
||||
NPDrawingModelCoreAnimation = 3,
|
||||
NPDrawingModelInvalidatingCoreAnimation = 4
|
||||
} NPDrawingModel;
|
||||
|
||||
typedef enum {
|
||||
|
@ -392,6 +393,7 @@ typedef enum {
|
|||
, NPNVsupportsCoreGraphicsBool = 2001
|
||||
, NPNVsupportsOpenGLBool = 2002
|
||||
, NPNVsupportsCoreAnimationBool = 2003
|
||||
, NPNVsupportsInvalidatingCoreAnimationBool = 2004
|
||||
#ifndef NP_NO_CARBON
|
||||
, NPNVsupportsCarbonBool = 3000 /* TRUE if the browser supports the Carbon event model */
|
||||
#endif
|
||||
|
|
|
@ -2067,6 +2067,12 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
|||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
case NPNVsupportsInvalidatingCoreAnimationBool: {
|
||||
*(NPBool*)result = PR_TRUE;
|
||||
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
#ifndef NP_NO_CARBON
|
||||
case NPNVsupportsCarbonBool: {
|
||||
|
|
Загрузка…
Ссылка в новой задаче