Mac fix for HTML embed region being painted the default background color bug 83159 r=av sr=sfraser a=asa

git-svn-id: svn://10.0.0.236/trunk@107713 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
peterlubczynski%netscape.com
2001-11-09 00:42:02 +00:00
parent 2391301a89
commit 46a8719065
2 changed files with 40 additions and 0 deletions

View File

@@ -3728,6 +3728,11 @@ static void ConvertTwipsToPixels(nsIPresContext& aPresContext, nsRect& aTwipsRec
}
#endif // DO_DIRTY_INTERSECT
inline PRUint16 COLOR8TOCOLOR16(PRUint8 color8)
{
return (color8 << 8) | color8; /* (color8 * 257) == (color8 * 0x0101) */
}
void nsPluginInstanceOwner::FixUpPluginWindow()
{
if (mWidget) {
@@ -3745,6 +3750,21 @@ void nsPluginInstanceOwner::FixUpPluginWindow()
mPluginWindow.clipRect.left = widgetClip.x;
mPluginWindow.clipRect.bottom = mPluginWindow.clipRect.top + widgetClip.height;
mPluginWindow.clipRect.right = mPluginWindow.clipRect.left + widgetClip.width;
// the Mac widget doesn't set the background color right away!!
// the background color needs to be set here on the plugin port
GrafPtr savePort;
::GetPort(&savePort); // save our current port
nsPluginPort* pluginPort = GetPluginPort();
::SetPort((GrafPtr)pluginPort->port);
nscolor color = mWidget->GetBackgroundColor();
RGBColor macColor;
macColor.red = COLOR8TOCOLOR16(NS_GET_R(color)); // convert to Mac color
macColor.green = COLOR8TOCOLOR16(NS_GET_G(color));
macColor.blue = COLOR8TOCOLOR16(NS_GET_B(color));
::RGBBackColor(&macColor);
::SetPort(savePort); // restore port
}
}