diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index 9e7f0f4092c..1b7a5f2774c 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -1461,13 +1461,27 @@ nsObjectFrame::Paint(nsIPresContext& aPresContext, return NS_OK; } - if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { - const nsStyleFont* font = (const nsStyleFont*) - mStyleContext->GetStyleData(eStyleStruct_Font); - - aRenderingContext.SetFont(font->mFont); + if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) + { aRenderingContext.SetColor(NS_RGB(192, 192, 192)); aRenderingContext.FillRect(0, 0, mRect.width, mRect.height); + + //~~~ + nsIPluginInstance * inst; + if(NS_OK == GetPluginInstance(inst)) + { + NS_RELEASE(inst); + // Look if it's windowless + nsPluginWindow * window; + mInstanceOwner->GetWindow(window); + if(window->type == nsPluginWindowType_Drawable) + mInstanceOwner->Paint(aDirtyRect); + return NS_OK; + } + + const nsStyleFont* font = (const nsStyleFont*)mStyleContext->GetStyleData(eStyleStruct_Font); + + aRenderingContext.SetFont(font->mFont); aRenderingContext.SetColor(NS_RGB(0, 0, 0)); aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); float p2t; @@ -1506,7 +1520,6 @@ nsObjectFrame::HandleEvent(nsIPresContext& aPresContext, { switch (anEvent->message) { - case NS_PAINT: case NS_MOUSE_LEFT_BUTTON_DOWN: case NS_MOUSE_LEFT_BUTTON_UP: case NS_MOUSE_LEFT_DOUBLECLICK: @@ -1520,7 +1533,7 @@ nsObjectFrame::HandleEvent(nsIPresContext& aPresContext, case NS_KEY_UP: case NS_KEY_DOWN: //case set cursor must be here: - anEventStatus = mInstanceOwner->ProcessEvent(*anEvent); + //anEventStatus = mInstanceOwner->ProcessEvent(*anEvent); return rv; case NS_GOTFOCUS: case NS_LOSTFOCUS: @@ -2451,6 +2464,13 @@ void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect) mInstance->HandleEvent(&pluginEvent, &eventHandled); } #endif + +//~~~ +#ifdef XP_WIN + nsPluginEvent pluginEvent; + PRBool eventHandled = PR_FALSE; + mInstance->HandleEvent(&pluginEvent, &eventHandled); +#endif } // Here's how we give idle time to plugins. diff --git a/layout/html/base/src/nsObjectFrame.cpp b/layout/html/base/src/nsObjectFrame.cpp index 9e7f0f4092c..1b7a5f2774c 100644 --- a/layout/html/base/src/nsObjectFrame.cpp +++ b/layout/html/base/src/nsObjectFrame.cpp @@ -1461,13 +1461,27 @@ nsObjectFrame::Paint(nsIPresContext& aPresContext, return NS_OK; } - if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { - const nsStyleFont* font = (const nsStyleFont*) - mStyleContext->GetStyleData(eStyleStruct_Font); - - aRenderingContext.SetFont(font->mFont); + if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) + { aRenderingContext.SetColor(NS_RGB(192, 192, 192)); aRenderingContext.FillRect(0, 0, mRect.width, mRect.height); + + //~~~ + nsIPluginInstance * inst; + if(NS_OK == GetPluginInstance(inst)) + { + NS_RELEASE(inst); + // Look if it's windowless + nsPluginWindow * window; + mInstanceOwner->GetWindow(window); + if(window->type == nsPluginWindowType_Drawable) + mInstanceOwner->Paint(aDirtyRect); + return NS_OK; + } + + const nsStyleFont* font = (const nsStyleFont*)mStyleContext->GetStyleData(eStyleStruct_Font); + + aRenderingContext.SetFont(font->mFont); aRenderingContext.SetColor(NS_RGB(0, 0, 0)); aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); float p2t; @@ -1506,7 +1520,6 @@ nsObjectFrame::HandleEvent(nsIPresContext& aPresContext, { switch (anEvent->message) { - case NS_PAINT: case NS_MOUSE_LEFT_BUTTON_DOWN: case NS_MOUSE_LEFT_BUTTON_UP: case NS_MOUSE_LEFT_DOUBLECLICK: @@ -1520,7 +1533,7 @@ nsObjectFrame::HandleEvent(nsIPresContext& aPresContext, case NS_KEY_UP: case NS_KEY_DOWN: //case set cursor must be here: - anEventStatus = mInstanceOwner->ProcessEvent(*anEvent); + //anEventStatus = mInstanceOwner->ProcessEvent(*anEvent); return rv; case NS_GOTFOCUS: case NS_LOSTFOCUS: @@ -2451,6 +2464,13 @@ void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect) mInstance->HandleEvent(&pluginEvent, &eventHandled); } #endif + +//~~~ +#ifdef XP_WIN + nsPluginEvent pluginEvent; + PRBool eventHandled = PR_FALSE; + mInstance->HandleEvent(&pluginEvent, &eventHandled); +#endif } // Here's how we give idle time to plugins. diff --git a/widget/src/windows/nsWindow.cpp b/widget/src/windows/nsWindow.cpp index 9653bd46012..01ac36c1325 100644 --- a/widget/src/windows/nsWindow.cpp +++ b/widget/src/windows/nsWindow.cpp @@ -52,6 +52,9 @@ //#include "DropSrc.h" #endif +//~~~ for windowless plugin support +#include "nsplugindefs.h" + // For clipboard support #include "nsIServiceManager.h" #include "nsIClipboard.h" @@ -397,8 +400,6 @@ void nsWindow::InitEvent(nsGUIEvent& event, PRUint32 aEventType, nsPoint* aPoint mLastPoint.x = event.point.x; mLastPoint.y = event.point.y; - - event.nativeMsg = (void *)&mPluginEvent; } //------------------------------------------------------------------------- @@ -2156,11 +2157,6 @@ BOOL nsWindow::OnChar( UINT aVirtualKeyCode ) //------------------------------------------------------------------------- PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *aRetValue) { - //~~~ Cache this for event.nativeMsg initialization - mPluginEvent.event = msg; - mPluginEvent.wParam = wParam; - mPluginEvent.lParam = lParam; - static UINT vkKeyCached = 0; // caches VK code fon WM_KEYDOWN static BOOL firstTime = TRUE; // for mouse wheel logic static int iDeltaPerLine, iAccumDelta ; // for mouse wheel logic diff --git a/widget/src/windows/nsWindow.h b/widget/src/windows/nsWindow.h index 8f4f067cce6..1d5f5075521 100644 --- a/widget/src/windows/nsWindow.h +++ b/widget/src/windows/nsWindow.h @@ -34,10 +34,6 @@ #include "nsVoidArray.h" -//~~~ for windowless plugin support -#include "nsplugindefs.h" - - #ifdef NEW_DRAG_AND_DROP class nsNativeDragTarget; #endif @@ -214,9 +210,6 @@ protected: HPALETTE mPalette; WNDPROC mPrevWndProc; - //~~~ - nsPluginEvent mPluginEvent; - PRBool mHas3DBorder; HBRUSH mBrush; PRBool mIsShiftDown;